I know I can select default and/or named graphs for queries, but my question is:
Can I hide any named graphs in Apache Jena from being listed or queried via SPARQL, only allowing access to the default graph (a setting/configuration)?
Thanks!
This can be done by making a dataset out of the default model.
API:
Dataset dataset = ...;
Dataset datasetDefaultOnly = DatasetFactory.wrap(dataset.getDefaultModel);
For a Fuseki configuration, the same approach:
# Dataset with only the default graph.
:dataset rdf:type ja:RDFDataset ;
ja:defaultGraph :oneGraph
.
# Graph from a TDB2 dataset
:oneGraph rdf:type tdb2:GraphTDB2 ;
tdb2:dataset :tdbDataset .
## Data in TDB.
:tdbDataset rdf:type tdb2:DatasetTDB2 ;
tdb2:location "DB" ;
.
Another approach is to check SPARQL queries to make sure they have no FROM
, FROM NAMED
or GRAPH
in them.