Class SparqlDataAccessor

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

Constructors

Properties

endpoint: string
fetcher: SparqlEndpointFetcher
generator: SparqlGenerator
identifierStrategy: IdentifierStrategy
logger: Logger = ...

Methods

  • 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>

  • Creates the name for the metadata of a resource.

    Parameters

    • name: NamedNode<string>

      Name of the (non-metadata) resource.

    Returns 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>
  • Creates a CONSTRUCT query that returns all quads contained within a single resource.

    Parameters

    • name: NamedNode<string>

      Name of the resource to query.

    Returns ConstructQuery

  • 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

  • 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

  • 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

  • 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