You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Philip Fennell <Ph...@marklogic.com> on 2012/04/11 13:15:13 UTC

[Fuseki] SPARQL 1.1 Protocol and Named Graphs

Hello.

I can quite happily create, retrieve, update and delete Named Graphs in Fuseki (0.2.1-incubating) using the SPARQL 1.1 Graph Store HTTP Protocol but when it comes to querying a Named graph over HTTP with the SPARQL 1.1 Protocol I'm not so lucky it seems...

I start-up Fuseki with an empty dataset:

> ./fuseki-server --update --mem /test


I create a Named Graph <http://www.books.com/harry-potter> thus:

PUT http://localhost:3030/test/data?graph=http%3A%2F%2Fwww.books.com%2Fharry-potter
Content-Type: application/rdf+xml
    ... RDF payload ...


If I send the following request to query the Named Graph <http://www.books.com/harry-potter> I get no results:

GET http://localhost:3030/test/query?query=[URL Encoded SPARQL Query]&named-graph-uri=http%3A%2F%2Fwww.books.com%2Fharry-potter

PREFIX dc: <http://purl.org/dc/elements/1.1/>
SELECT *
WHERE
{
         $x ?y ?z.
} LIMIT 10

I've experimented with using FROM <http://www.books.com/harry-potter> and FROM NAMED <http://www.books.com/harry-potter> to see what'd happen but one way or another I cannot get the query to see the Named Graph dataset.


Have I missed something fundamentally important?


Regards

Philip


RE: [Fuseki] SPARQL 1.1 Protocol and Named Graphs

Posted by Philip Fennell <Ph...@marklogic.com>.
Andy,

> GRAPH accesses named graphs, not FROM

I thought I'd tried that too, but I've double-checked and it works now.


> FROM sets the dataset to be queried - where FROM is allowed, FROM means 
> load the data from the web and not use the dataset at the service point.

Ah, that makes sense now. So, if I read the SPARQL 1.1 Protocol spec properly then default-graph-uri and named-graph-uri parameters of a request are the same as using FROM and FROM NAMED, respectively, in the query itself.


Many thanks

Philip
 
-----Original Message-----
From: Andy Seaborne [mailto:andy.seaborne.apache@gmail.com] On Behalf Of Andy Seaborne
Sent: Wednesday, April 11, 2012 1:12 PM
To: jena-users@incubator.apache.org
Subject: Re: [Fuseki] SPARQL 1.1 Protocol and Named Graphs

On 11/04/12 12:15, Philip Fennell wrote:
> Hello.
>
> I can quite happily create, retrieve, update and delete Named Graphs in Fuseki (0.2.1-incubating) using the SPARQL 1.1 Graph Store HTTP Protocol but when it comes to querying a Named graph over HTTP with the SPARQL 1.1 Protocol I'm not so lucky it seems...
>
> I start-up Fuseki with an empty dataset:
>
>> ./fuseki-server --update --mem /test
>
>
> I create a Named Graph<http://www.books.com/harry-potter>  thus:
>
> PUT http://localhost:3030/test/data?graph=http%3A%2F%2Fwww.books.com%2Fharry-potter
> Content-Type: application/rdf+xml
>      ... RDF payload ...
>
>
> If I send the following request to query the Named Graph<http://www.books.com/harry-potter>  I get no results:
>
> GET http://localhost:3030/test/query?query=[URL Encoded SPARQL Query]&named-graph-uri=http%3A%2F%2Fwww.books.com%2Fharry-potter
>
> PREFIX dc:<http://purl.org/dc/elements/1.1/>
> SELECT *
> WHERE
> {
>           $x ?y ?z.
> } LIMIT 10
>
> I've experimented with using FROM<http://www.books.com/harry-potter>  and FROM NAMED<http://www.books.com/harry-potter>  to see what'd happen but one way or another I cannot get the query to see the Named Graph dataset.
>
>
> Have I missed something fundamentally important?

GRAPH accesses named graphs, not FROM

SELECT * {
   GRAPH <http://www.books.com/harry-potter> { $x ?y ?z. }
}

FROM sets the dataset to be queried - where FROM is allowed, FROM means 
load the data from the web and not use the dataset at the service point.

(In TDB, it selects graphs out of the collection of all graphs - only 
really useful for FROm and not FROM NAMED).

	Andy


>
>
> Regards
>
> Philip
>
>


Re: [Fuseki] SPARQL 1.1 Protocol and Named Graphs

Posted by Andy Seaborne <an...@apache.org>.
On 11/04/12 12:15, Philip Fennell wrote:
> Hello.
>
> I can quite happily create, retrieve, update and delete Named Graphs in Fuseki (0.2.1-incubating) using the SPARQL 1.1 Graph Store HTTP Protocol but when it comes to querying a Named graph over HTTP with the SPARQL 1.1 Protocol I'm not so lucky it seems...
>
> I start-up Fuseki with an empty dataset:
>
>> ./fuseki-server --update --mem /test
>
>
> I create a Named Graph<http://www.books.com/harry-potter>  thus:
>
> PUT http://localhost:3030/test/data?graph=http%3A%2F%2Fwww.books.com%2Fharry-potter
> Content-Type: application/rdf+xml
>      ... RDF payload ...
>
>
> If I send the following request to query the Named Graph<http://www.books.com/harry-potter>  I get no results:
>
> GET http://localhost:3030/test/query?query=[URL Encoded SPARQL Query]&named-graph-uri=http%3A%2F%2Fwww.books.com%2Fharry-potter
>
> PREFIX dc:<http://purl.org/dc/elements/1.1/>
> SELECT *
> WHERE
> {
>           $x ?y ?z.
> } LIMIT 10
>
> I've experimented with using FROM<http://www.books.com/harry-potter>  and FROM NAMED<http://www.books.com/harry-potter>  to see what'd happen but one way or another I cannot get the query to see the Named Graph dataset.
>
>
> Have I missed something fundamentally important?

GRAPH accesses named graphs, not FROM

SELECT * {
   GRAPH <http://www.books.com/harry-potter> { $x ?y ?z. }
}

FROM sets the dataset to be queried - where FROM is allowed, FROM means 
load the data from the web and not use the dataset at the service point.

(In TDB, it selects graphs out of the collection of all graphs - only 
really useful for FROm and not FROM NAMED).

	Andy


>
>
> Regards
>
> Philip
>
>