You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Bob DuCharme <bo...@snee.com> on 2011/03/23 15:12:43 UTC

Using USING in Fuseki?

I was hoping to get the following query working on the the SPARQL Update 
panel in the 11 March build of Fuseki 0.2:

   INSERT
   { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }
   USING <http://rdf.freebase.com/ns/en.miles_davis>
   WHERE
   { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }

Fuseki tells me that "Update succeeded", but there are no new triples in 
the default graph.

Because the Update spec describes USING as being similar to FROM, I 
tried this query:

   CONSTRUCT
   { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }
   FROM <http://rdf.freebase.com/ns/en.miles_davis>
   WHERE
   { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }

It retrieved several hundred triples when I ran it with ARQ, but when I 
entered it in Fuseki's SPARQL Query panel, I got "Error 400: Query may 
not include a dataset description (FROM/FROM NAMED)"

Am I misunderstanding how this should work, or is this kind of retrieval 
from other data sources just not supported by Fuseki yet?

thanks,

Bob

Re: Using USING in Fuseki?

Posted by Andy Seaborne <an...@epimorphics.com>.
This works for me:

PREFIX : <http://example/>

INSERT DATA
{ GRAPH :g { :s :p :o } }

INSERT
{ :s ?p ?o }
USING :g
WHERE
{ :s ?p ?o }


then

SELECT * { { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }}

On 23/03/11 14:12, Bob DuCharme wrote:
> I was hoping to get the following query working on the the SPARQL Update
> panel in the 11 March build of Fuseki 0.2:
>
> INSERT
> { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }
> USING <http://rdf.freebase.com/ns/en.miles_davis>

USING sets the default to the named one.

It does not read from the web (use LOAD)

> WHERE
> { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }

LOAD <http://rdf.freebase.com/ns/en.miles_davis> ;

reads directly into the default graph but without a pattern match on the 
triples

LOAD <http://rdf.freebase.com/ns/en.miles_davis> INTO GRAPH 
<http://example/tmp> ;

INSERT { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }
WHERE { GRAPH <http://example/tmp>
    { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o } }

if freebase does not provide a SPARQL CONSTRUCT interface.

>
> Fuseki tells me that "Update succeeded", but there are no new triples in
> the default graph.
>
> Because the Update spec describes USING as being similar to FROM, I
> tried this query:

Indeed it does say that - it's wrong.  I've send email to the WG.

> CONSTRUCT
> { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }
> FROM <http://rdf.freebase.com/ns/en.miles_davis>

Warning: that reads http://rdf.freebase.com/ns/en.miles_davis from the web.

> WHERE
> { <http://rdf.freebase.com/ns/en.miles_davis> ?p ?o }
>
> It retrieved several hundred triples when I ran it with ARQ, but when I
> entered it in Fuseki's SPARQL Query panel, I got "Error 400: Query may
> not include a dataset description (FROM/FROM NAMED)"

Separate issue - the SPARQL processor in Fuseki only queries the local 
dataset.  It's not a general processor like http://sparql.org/sparql.

>
> Am I misunderstanding how this should work, or is this kind of retrieval
> from other data sources just not supported by Fuseki yet?

The spec is wrong.

Ways to do it above.

	Andy

>
> thanks,
>
> Bob