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 |
The source resource IRI is also its named graph IRI. The catalog is updated when source files are created, moved, or deleted.
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 ] .
}
}
}