Options
All
  • Public
  • Public/Protected
  • All
Menu

Stores all data and metadata of resources in a SPARQL backend. Communication is done by sending SPARQL queries. Queries are constructed in such a way to keep everything consistent, such as updating containment triples and deleting old data when it is overwritten.

Since metadata is hidden, no containment triples are stored for metadata files.

All input container metadata is stored in its metadata identifier. The containment triples are stored in the graph corresponding to the actual identifier so those don't get overwritten.

Hierarchy

  • SparqlDataAccessor

Implements

Index

Constructors

constructor

Properties

Private Readonly endpoint

endpoint: string

Private Readonly fetcher

fetcher: SparqlEndpointFetcher

Private Readonly generator

generator: SparqlGenerator

Private Readonly identifierStrategy

identifierStrategy: IdentifierStrategy

Protected Readonly logger

logger: Logger = ...

Methods

canHandle

deleteResource

getChildren

  • Returns metadata for all resources in the requested container. This should not be all metadata of those resources (but it can be), but instead the main metadata you want to show in situations where all these resources are presented simultaneously. Generally this would be metadata that is present for all of these resources, such as resource type or last modified date.

    It can be safely assumed that the incoming identifier will always correspond to a container.

    Parameters

    Returns AsyncIterableIterator<RepresentationMetadata>

getData

getMetadata

Private getMetadataNode

  • getMetadataNode(name: NamedNode<string>): NamedNode<string>

Private getRelatedNames

  • getRelatedNames(identifier: ResourceIdentifier): { name: NamedNode<string>; parent?: NamedNode<string> }
  • Helper function to get named nodes corresponding to the identifier and its parent container. In case of a root container only the name will be returned.

    Parameters

    Returns { name: NamedNode<string>; parent?: NamedNode<string> }

    • name: NamedNode<string>
    • Optional parent?: NamedNode<string>

Private isMetadataIdentifier

Private sendSparqlConstruct

  • sendSparqlConstruct(sparqlQuery: ConstructQuery): Promise<Guarded<Readable>>

Private sendSparqlUpdate

  • sendSparqlUpdate(sparqlQuery: Update): Promise<void>

Private sparqlConstruct

  • sparqlConstruct(name: NamedNode<string>): ConstructQuery

Private sparqlDelete

  • sparqlDelete(name: NamedNode<string>, parent?: NamedNode<string>): Update
  • Creates a query that deletes everything related to the given name.

    Parameters

    • name: NamedNode<string>

      Name of resource to delete.

    • Optional parent: NamedNode<string>

      Parent of the resource to delete so the containment triple can be removed (unless root).

    Returns Update

Private sparqlInsert

  • sparqlInsert(name: NamedNode<string>, metadata: RepresentationMetadata, parent?: NamedNode<string>, triples?: Quad[]): Update
  • Creates an update query that overwrites the data and metadata of a resource. If there are no triples we assume it's a container (so don't overwrite the main graph with containment triples).

    Parameters

    • name: NamedNode<string>

      Name of the resource to update.

    • metadata: RepresentationMetadata

      New metadata of the resource.

    • Optional parent: NamedNode<string>

      Name of the parent to update the containment triples.

    • Optional triples: Quad[]

      New data of the resource.

    Returns Update

Private sparqlSelectGraph

  • sparqlSelectGraph(name: NamedNode<string>, triples: Quad[]): GraphPattern

Private sparqlUpdateDeleteAll

  • sparqlUpdateDeleteAll(name: NamedNode<string>): InsertDeleteOperation
  • Helper function for creating SPARQL update queries. Creates an operation for deleting all triples in a graph.

    Parameters

    • name: NamedNode<string>

      Name of the graph to delete.

    Returns InsertDeleteOperation

Private sparqlUpdateGraph

  • sparqlUpdateGraph(name: NamedNode<string>, triples: Quad[]): GraphQuads
  • Helper function for creating SPARQL update queries. Creates a Graph selector with the given triples.

    Parameters

    • name: NamedNode<string>

      Name of the graph.

    • triples: Quad[]

      Triples/triple patterns to select.

    Returns GraphQuads

writeContainer

writeDocument