3

I am laoding a .ttl file into the Jena Fuseki server and instead of the default graph I am using the named graph <http://examples/test>.

/home/user/jena-fuseki-1.1.1/./s-put http://192.168.1.38:3030/ds/data http://example/test /home/user/testdata.ttl

I am able to load the graph and retrieve result using the following command.

/home/user/jena-fuseki-1.1.1/./s-get http://192.168.1.38:3030/ds/data http://example/test

But when I start querying using the s-query command, it is taking the default unnamed graph. How to make the s-query command work on the named graph.

 /home/user/jena-fuseki-1.1.1/./s-query --service http://localhost:3030/ds/query 'SPARQL Query'

This is doing the query on the default unnamed graph. How to make it work on the named graph <http://example/test>?

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
lost Coder
  • 577
  • 2
  • 8
  • 34

2 Answers2

6

To access the named graph in a query, use the GRAPH keyword.

SELECT ?subject ?predicate ?object
WHERE {
  GRAPH <http://examples/test>
  {
    ?subject ?predicate ?object
  }
}

http://www.w3.org/TR/sparql11-query/#queryDataset

Trey Hunner
  • 10,975
  • 4
  • 55
  • 114
AndyS
  • 16,345
  • 17
  • 21
4

You can specify the named graph in the SPARQL query using a FROM-clause. For example to get all triples in your graph use

SELECT ?subject ?predicate ?object
FROM <http://examples/test>
WHERE {
  ?subject ?predicate ?object
}

A detailed description and further options can be found in the SPARQL 1.1 Query Language specification of W3C.

Jan Martin Keil
  • 1,276
  • 9
  • 9
  • http://stackoverflow.com/questions/34219499/how-to-unload-data-from-jena-fuseki-server how to unload from fuseki? – lost Coder Dec 11 '15 at 12:25