models

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2022 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedResponse = errors.New("expected response != nil")
)

Functions

func AskSPARQL

func AskSPARQL(orgID, query string) (bool, error)

AskSPARQL performs a SPARQL ASK query

func CloseStorm

func CloseStorm()

CloseStorm close the underlying BoltDB for Storm

func CountGraphsBySpec

func CountGraphsBySpec(orgID, spec string) (int, error)

CountGraphsBySpec counts all the named graphs for a spec

func DeleteAllGraphsBySpec

func DeleteAllGraphsBySpec(orgID, spec string) (bool, error)

DeleteAllGraphsBySpec issues an SPARQL Update query to delete all graphs for a DataSet from the triple store

func DeleteDataSet added in v0.2.0

func DeleteDataSet(orgID, spec string, ctx context.Context) error

DeleteDataset deletes a set.

func DeleteGraphsOrphansBySpec

func DeleteGraphsOrphansBySpec(orgID, spec string, revision int) (bool, error)

DeleteGraphsOrphansBySpec issues an SPARQL Update query to delete all orphaned graphs for a DataSet from the triple store.

func NewDataSetHistogram

func NewDataSetHistogram(orgID string) ([]*elastic.AggregationBucketHistogramItem, error)

NewDataSetHistogram returns a histogram for dates that items in the index are modified

func ORM

func ORM() *storm.DB

func PrepareAsk

func PrepareAsk(uri string) (string, error)

PrepareAsk takes an a string and returns a valid SPARQL ASK query

func ResetEADCache added in v0.1.4

func ResetEADCache()

func ResetStorm

func ResetStorm()

func SparqlRepo

func SparqlRepo(orgID string) *sparql.Repo

func SparqlUpdateRepo

func SparqlUpdateRepo(orgID string) *sparql.Repo

Types

type Access

type Access struct {
	OAIPMH bool `json:"oaipmh"`
	Search bool `json:"search"`
	LOD    bool `json:"lod"`
}

Access determines the which types of access are enabled for this dataset

type DaoStats

type DaoStats struct {
	ExtractedLinks     uint64            `json:"extractedLinks"`
	RetrieveErrors     uint64            `json:"retrieveErrors"`
	DigitalObjects     uint64            `json:"digitalObjects"`
	Errors             []string          `json:"errors"` // Old field replaced with ErrorsPerInventory. Needs to be kept or else breaks the gob decoder when reading older data.
	UniqueLinks        uint64            `json:"uniqueLinks"`
	DuplicateLinks     map[string]int    `json:"duplicateLinks"`
	ErrorsPerInventory map[string]string `json:"errorsPerInventory"`
}

DaoStats holds the stats for EAD digital objects extracted from METS links.

type DataSet

type DataSet struct {
	// MapToPrefix string    `json:"mapToPrefix"`
	Spec             string    `json:"spec" storm:"id,index,unique"`
	URI              string    `json:"uri" storm:"unique,index"`
	Revision         int       `json:"revision"` // revision is used to mark the latest version of ingested RDFRecords
	FragmentRevision int       `json:"fragmentRevision"`
	Modified         time.Time `json:"modified" storm:"index"`
	Created          time.Time `json:"created"`
	Deleted          bool      `json:"deleted"`
	OrgID            string    `json:"orgID"`
	Access           `json:"access" storm:"inline"`
	Tags             []string `json:"tags"`
	RecordType       string   `json:"recordType"` //
	Label            string   `json:"label"`
	Owner            string   `json:"owner"`
	Abstract         []string `json:"abstract"`
	Period           []string `json:"period"`
	Length           string   `json:"length"`
	Files            string   `json:"files"`
	Language         string   `json:"language"`
	Material         string   `json:"material"`
	ArchiveCreator   []string `json:"archiveCreator"`
	MetsFiles        int      `json:"metsFiles"`
	Description      string   `json:"description"`
	Clevels          int      `json:"clevels"`
	DaoStats         `json:"daoStats" storm:"inline"`
	Fingerprint      string `json:"fingerPrint"`
}

DataSet contains all the known informantion for a hub3 metadata dataset

func CreateDataSet

func CreateDataSet(orgID, spec string) (*DataSet, bool, error)

CreateDataSet creates and returns a DataSet

func GetDataSet

func GetDataSet(orgID, spec string) (*DataSet, error)

GetDataSet returns a DataSet object when found

func GetOrCreateDataSet

func GetOrCreateDataSet(orgID, spec string) (*DataSet, bool, error)

GetOrCreateDataSet returns a DataSet object from the Storm ORM. If none is present it will create one

func ListDataSets

func ListDataSets(orgID string) ([]*DataSet, error)

ListDataSets returns an array of Datasets stored in Storm ORM

func NewDataset

func NewDataset(orgID, spec string) DataSet

NewDataset creates a new instance of a DataSet

func (DataSet) Delete

func (ds DataSet) Delete(ctx context.Context, wp *wp.WorkerPool) error

Delete deletes the DataSet from BoltDB

func (DataSet) DropAll

func (ds DataSet) DropAll(ctx context.Context, wp *wp.WorkerPool) (bool, error)

DropAll drops the dataset from the Hub3 storages completely (BoltDB, Triple Store, Search Index)

func (DataSet) DropOrphans

func (ds DataSet) DropOrphans(ctx context.Context, p *elastic.BulkProcessor, wp *wp.WorkerPool) (bool, error)

DropOrphans removes all records of different revision that the current from the attached datastores

func (DataSet) DropRecords

func (ds DataSet) DropRecords(ctx context.Context, wp *wp.WorkerPool) (bool, error)

DropRecords Drops all records linked to the dataset from the storage layers

func (*DataSet) IncrementRevision

func (ds *DataSet) IncrementRevision() (*DataSet, error)

IncrementRevision bumps the latest revision of the DataSet

func (DataSet) Save

func (ds DataSet) Save() error

Save saves the DataSet to BoltDB

type DataSetCounter

type DataSetCounter struct {
	Value    string `json:"value"`
	DocCount int    `json:"docCount"`
}

DataSetCounter holds value counters for statistics overviews

type DataSetRevisions

type DataSetRevisions struct {
	Number      int `json:"revisionNumber"`
	RecordCount int `json:"recordCount"`
}

DataSetRevisions holds the type-frequency data for each revision

func CountRevisionsBySpec

func CountRevisionsBySpec(orgID, spec string) ([]DataSetRevisions, error)

CountRevisionsBySpec counts each revision available in the spec

type DataSetStats

type DataSetStats struct {
	Spec                      string `json:"spec"`
	CurrentRevision           int    `json:"currentRevision"`
	IndexStats                `json:"index"`
	RDFStoreStats             `json:"rdfStore"`
	LODFragmentStats          `json:"lodFragmentStats"`
	DaoStats                  `json:"daoStats"`
	WebResourceStats          `json:"webResourceStats"`
	NarthexStats              `json:"narthexStats"`
	VocabularyEnrichmentStats `json:"vocabularyEnrichmentStats"`
}

DataSetStats holds all gather statistics for a DataSet

func CreateDataSetStats

func CreateDataSetStats(ctx context.Context, orgID, spec string) (DataSetStats, error)

CreateDataSetStats returns DataSetStats that contain all relevant counts from the storage layer

type IndexStats

type IndexStats struct {
	Enabled        bool               `json:"enabled"`
	Revisions      []DataSetRevisions `json:"revisions"`
	IndexedRecords int                `json:"indexedRecords"`
	Tags           []DataSetCounter   `json:"tags"`
	ContentTags    []DataSetCounter   `json:"contentTags"`
}

IndexStats hold all Index Statistics for this dataset

type LODFragmentStats

type LODFragmentStats struct {
	Enabled         bool               `json:"enabled"`
	Revisions       []DataSetRevisions `json:"revisions"`
	StoredFragments int                `json:"storedFragments"`
	DataType        []DataSetCounter   `json:"dataType"`
	Language        []DataSetCounter   `json:"language"`
	Tags            []DataSetCounter   `json:"tags"`
}

LODFragmentStats hold all the LODFragment stats for this dataset

type NarthexStats

type NarthexStats struct {
	Enabled        bool `json:"enabled"`
	SourceRecords  int  `json:"sourceRecords"`
	ValidRecords   int  `json:"validRecords"`
	InvalidRecords int  `json:"invalidRecords"`
}

NarthexStats gathers all the record statistics from Narthex

type RDFStoreStats

type RDFStoreStats struct {
	Revisions    []DataSetRevisions `json:"revisions"`
	StoredGraphs int                `json:"storedGraphs"`
	Enabled      bool               `json:"enabled"`
}

RDFStoreStats hold all the RDFStore Statistics for this dataset

type VocabularyEnrichmentStats

type VocabularyEnrichmentStats struct {
	LiteralFields        []string `json:"literalFields"`
	TotalConceptsMapped  int      `json:"totalConceptsMapped"`
	UniqueConceptsMapped int      `json:"uniqueConceptsMapped"`
	VocabularyLinked     []string `json:"vocabularyLinked"`
}

VocabularyEnrichmentStats gathers all counters for the SKOS based enrichment

type WebResourceStats

type WebResourceStats struct {
	Enabled           bool `json:"enabled"`
	SourceItems       int  `json:"sourceItems"`
	ThumbnailsCreated int  `json:"thumbnailsCreated"`
	DeepZoomsCreated  int  `json:"deepZoomsCreated"`
	Missing           int  `json:"missing"`
}

WebResourceStats gathers all the MediaManager information for this DataSet

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL