Skip to content

File catalog

The reserved sparqld: graph describes the served directory. It lets queries relate data to the files and directories from which it came.

Resource RDF types Properties
Served directory nfo:FileDataObject, nfo:Folder nfo:fileName
Nested directory nfo:FileDataObject, nfo:Folder nfo:fileName, nfo:belongsToContainer
Source file with embedded graphs nfo:FileDataObject, sd:Dataset nfo:fileName, nfo:belongsToContainer, sd:namedGraph
Named-graph description sd:NamedGraph sd:name
Load error rlog:Entry rlog:resource, rlog:level, rlog:message

The source resource IRI is also its named graph IRI. The catalog is updated when source files are created, moved, or deleted.

Context dependencies

Each source file links to the context URIs requested while parsing it through jsonld:context. This includes local paths and absolute URIs, including imports and nested context requests. Repeated requests produce one edge. Inline context objects produce no URI edge.

These edges record observed requests, including unsuccessful ones. Each edge starts at the source being parsed; it does not identify which nested context made the request. Parsing can stop before all dependencies are discovered.

After each loading attempt, the catalog replaces that source's dependencies with the requests observed during the attempt. Successful loads retain their dependencies after errors are cleared. Deleting a source removes its outgoing edges. Changes to local context files reload their dependent sources, including sources whose previous loading attempt failed.

This source requests a remote context URL. The catalog records the request whether or not a local body registers that URL:

Source context-dependencies.yamlld

"@context":
  - https://example.org/ctx
  - name: https://schema.org/name

$id: http://dbpedia.org/resource/Alpha_Centauri
name: Alpha Centauri

Unresolved requests also produce dependency edges:

Source missing-context.yamlld

"@context": https://example.org/context
"@id": http://dbpedia.org/resource/Alpha_Centauri
name: Alpha Centauri

Query the catalog to find the context requests:

Source context-dependencies-example.rq

PREFIX jsonld: <http://www.w3.org/ns/json-ld#>

SELECT ?file ?context
WHERE {
  VALUES ?file {
    <sparqld:examples/context-dependencies.yamlld>
    <sparqld:examples/missing-context.yamlld>
  }
  GRAPH <sparqld:> {
    ?file jsonld:context ?context .
  }
}
ORDER BY ?file ?context
file context
sparqld:examples/context-dependencies.yamlld https://example.org/ctx
sparqld:examples/missing-context.yamlld https://example.org/context

Remote contexts shows an unregistered absolute context URL, registration with vitrify, and the catalog after that body is available.

Embedded graphs

For every embedded graph, the catalog uses sd:namedGraph to link the source dataset to an sd:NamedGraph description. Its sd:name is the scoped graph IRI. This is the SPARQL Service Description vocabulary's specific model for named graphs in a dataset.

flowchart TB root["Served directory"] folder["Subdirectory"] source["Source file"] description["Named-graph description"] scoped["Scoped graph IRI"] error["Load error"] folder -->|belongs to container| root source -->|belongs to container| folder source -->|has named graph| description description -->|names| scoped error -->|records resource| source

Query the catalog

This query lists every source file and its declared embedded graphs. A source without embedded graphs has an empty ?graph value.

Source file-catalog.rq

PREFIX nfo: <http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#>
PREFIX sd: <http://www.w3.org/ns/sparql-service-description#>

SELECT ?file ?name ?directory ?graph
WHERE {
  GRAPH <sparqld:> {
    ?file a nfo:FileDataObject ;
          nfo:fileName ?name ;
          nfo:belongsToContainer ?directory .
    OPTIONAL {
      ?file sd:namedGraph [ sd:name ?graph ] .
    }
  }
}