Alexander Huber
Alexander Huber

Reputation: 53

Can I allow access to ONLY the default graph in Apache Jena?

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!

Upvotes: 0

Views: 211

Answers (2)

Laith Abu-Nawwas
Laith Abu-Nawwas

Reputation: 21

As per AndyS's response, access control in RDF can be implemented at the dataset level; thus, I always advise researchers to create multiple datasets if they have private data that they do not want others to access. The configuration of shiro makes using the access control implemented in fuseki simple and straightforward. You can restrict access to specific datasets to specific users.

I might add to AndyS's response the option from the Fuseki UI to create multiple datasets and upload the various ttl data files there, as per the attached screenshot.

Then after each dataset will be available in a separate SPARQL endpoint to share.

Upvotes: 2

AndyS
AndyS

Reputation: 16700

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.

Upvotes: 2

Related Questions