TDB/Datasets
From Jena wiki
An RDF Dataset is a collection of one, unnamed, default graph and zero, or more named graphs. In a SPARQL query, a query pattern is matched against the default graph unless the GRAPH keyword is applied to a pattern.
[edit] Dataset Storage
(TDB Version 0.7.0 and later)
TDB supports storage as a single graph or in an RDF datasets. One file location (directory) can be used for either one graph or for one RDF dataset. The unnamed graph of the dataset is held as a single graph while all the named graphs are helpd in a collection of quad indexes.
[edit] Dataset Query
(TDB Version 0.7.0 and later)
There is full support for SPARQL query over named graphs in a TDB-back dataset.
All the named graphs can be treated as a single graph which is the union (RDF merge) of all the named graphs. This is given the special graph name <urn:x-arq:UnionGraph> in a GRAPH pattern.
When querying the RDF merge of named graphs, the default graph in the store is not included. This feature applies to queries only. It does not affect the storage nor does it change loading.
Alternatively, if the symbol tdb:unionDefaultGraph (see TDB Configuration) is set, the unnamed graph for the query is the union of all the named graphs in the datasets. The stored default graph is ignored and is not part of the the data of the union graph although it is accessible by the special name <urn:x-arq:DefaultGraph> in a GRAPH pattern.
| Symbol | Meaning |
|---|---|
urn:x-arq:UnionGraph
| The RDF merge of all the named graphs in the datasets of the query. |
urn:x-arq:DefaultGraph
| The default graph of the dataset, used when the default graph of the query is the union graph. |
Note that setting tdb:unionDefaultGraph does not affect the default graph or default model obtained with dataset.getDefaultModel().
The RDF merge of all named graph can be accessed as the named graph urn:x-arq:UnionGraph.
