models

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2020 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SparqlQueryURL string

SparqlQueryURL is the fully qualified URI to the SPARQL endpoint

View Source
var SparqlRepo *sparql.Repo

SparqlRepo is the repository used for querying

View Source
var SparqlUpdateRepo *sparql.Repo

SparqlUpdateRepo is the repository used for updating the TripleStore

View Source
var SparqlUpdateURL string

SparqlUpdateURL is the fully qualified URI to the SPARQL Update endpoint

Functions

func ApplyPostHookJob

func ApplyPostHookJob(ph *PostHookJob)

ApplyPostHookJob applies the PostHookJob to all the configured URLs

func AskSPARQL

func AskSPARQL(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(spec string) (int, error)

CountGraphsBySpec counts all the named graphs for a spec

func CountRDFRecords

func CountRDFRecords(spec string) int

CountRDFRecords returns an int with the records count for spec. If the spec is empty it should return a count for all

func CreateDeletePostHooks

func CreateDeletePostHooks(ctx context.Context, q elastic.Query, wp *w.WorkerPool) error

CreateDeletePostHooks scrolls through the elasticsearch index and adds entries to be delete to the PostHook workerpool.

func DeleteAllGraphsBySpec

func DeleteAllGraphsBySpec(spec string) (bool, error)

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

func DeleteGraphsOrphansBySpec

func DeleteGraphsOrphansBySpec(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 DescribeSPARQL

func DescribeSPARQL(uri string) (map[string][]rdf.Term, error)

DescribeSPARQL creates a describe query for a given URI.

func NewDataSetHistogram

func NewDataSetHistogram() ([]*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 ProcessSpec

func ProcessSpec(spec string) bool

ProcessSpec determines if a PostHookJob should be applied for a specific spec

func ResetEADCache added in v0.1.4

func ResetEADCache()

func ResetStorm

func ResetStorm()

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"`
	UniqueLinks    uint64         `json:"uniqueLinks"`
	DuplicateLinks map[string]int `json:"duplicateLinks"`
}

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(spec string) (*DataSet, bool, error)

CreateDataSet creates and returns a DataSet

func GetDataSet

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

GetDataSet returns a DataSet object when found

func GetOrCreateDataSet

func GetOrCreateDataSet(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() ([]DataSet, error)

ListDataSets returns an array of Datasets stored in Storm ORM

func NewDataset

func NewDataset(spec string) DataSet

NewDataset creates a new instance of a DataSet

func (DataSet) Delete

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

Delete deletes the DataSet from BoltDB

func (DataSet) DropAll

func (ds DataSet) DropAll(ctx context.Context, wp *w.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 *w.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 *w.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(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, 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 PostHookJob

type PostHookJob struct {
	Graph   *fragments.SortedGraph
	Spec    string
	Deleted bool
	Subject string
}

PostHookJob holds the info for building a crea

func NewPostHookJob

func NewPostHookJob(sg *fragments.SortedGraph, spec string, delete bool, subject, hubID string) *PostHookJob

NewPostHookJob creates a new PostHookJob and populates the rdf2go Graph

func (PostHookJob) Bytes

func (ph PostHookJob) Bytes() (bytes.Buffer, error)

Bytes returns the PostHookJob as an JSON-LD bytes.Buffer

func (PostHookJob) Post

func (ph PostHookJob) Post(url string) error

Post sends json-ld to the specified endpointt

func (PostHookJob) String

func (ph PostHookJob) String() (string, error)

Bytes returns the PostHookJob as an JSON-LD string

func (PostHookJob) Valid

func (ph PostHookJob) Valid() bool

Valid determines if the posthok is valid to apply.

type PostHookJobFactory

type PostHookJobFactory struct {
	Spec string
	// contains filtered or unexported fields
}

PostHookJobFactory can be used to fire off PostHookJob jobs

type RDFRecord

type RDFRecord struct {
	HubID         string    `json:"hubId" storm:"id,index"`
	ContentHash   string    `json:"contentHash"`
	Spec          string    `json:"spec" storm:"index"`
	Graph         string    `json:"graph"`
	NamedGraphURI string    `json:"NamedGraphURI" storm:"unique"`
	Modified      time.Time `json:"modified" storm:"index"`
	Created       time.Time `json:"created"`

	// the revision is used to mark records as orphans. it is autoincremented on each full save of the dataset
	Revision int `json:"revision" storm:"index"`

	// Deleted marks a record as an orphan
	Deleted bool `json:"deleted"`
}

RDFRecord contains all the information about a grouping of RDF triples that are considered a single search record. RDFRecord can be stored in various backends. The default is a Boltdb database

func GetOrCreateRDFRecord

func GetOrCreateRDFRecord(hubID, spec string) (RDFRecord, error)

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

func NewRDFRecord

func NewRDFRecord(hubID string, spec string) RDFRecord

NewRDFRecord creates a new RDFRecord

func (RDFRecord) ExtractHubID

func (r RDFRecord) ExtractHubID() (orgID string, spec string, localID string, err error)

ExtractHubID extracts the orgId, spec and localId from the HubID

func (RDFRecord) Save

func (r RDFRecord) Save() error

Save saves the RDFRecord to Boltdb

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 ResourceSortOrder

type ResourceSortOrder struct {
	Resource map[string]interface{}
	SortKey  int
}

ResourceSortOrder holds information to sort RDF:type webresources based on their nave:resourceSortOrder key

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