Re: Default and named graphs within TDB/Fuseki

2013-07-12 Thread Andy Seaborne

On 10/07/13 14:42, Rob Walpole wrote:

Hi Andy,

Thanks for your reply.



That load for the purpose of the query ... you already have the data in
the dataset.  Remove these.

Did you load into "http://example.org/bob";



So I used tdbloader2 to store dft.ttl into an empty instance of TDB. I
assume this places the data in the default graph? The dft.ttl data looks
like this:

@prefix dc:  .

dc:publisher  "Bob Hacker" .
  dc:publisher  "Alice Hacker" .


and as you see in the putput, all record of "dft.ttl" has gone.  When 
loaded into the unnamed default graph, there is no name.


Then you use:

"""
SELECT ?who ?g ?mbox
FROM 
FROM NAMED 
FROM NAMED 
"""
but there is no  (which in TDB means it's 
empty).


And
   ?g dc:publisher ?who .
matches nothing.

You don't need the FROM/FROM NAMED for this query.



Then I used s-put to store bob.ttl and alice.ttl into the named graphs
http://example.org/bob and http://example.org/alice respectively.

bob.ttl looks like this:-

@prefix foaf:  .

_:a foaf:name "Bob" .
_:a foaf:mbox  .

and alice.ttl looks like this...

@prefix foaf:  .

_:a foaf:name "Alice" .
_:a foaf:mbox  .

When I run the query though I get no results.



Run this:

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

to see what you have.



I have this:-


| s  | p
 | o| g  |

|    |
 | "Bob Hacker"
 ||
|  |
 | "Alice Hacker"
 ||
| _:b0   | 
 |  |    |
| _:b0   | 
 | "Bob"|    |
| _:b1   | 
 |   |  |
| _:b1   | 
 | "Alice"  |  |







  I have tried using the form >
but this has no affect (although I can download the data from here...)



Longer:

In TDB it picks FROM/FROM NAMED from the set of already loaded named
graphs.

http://jena.apache.org/**documentation/tdb/dynamic_**datasets.html

But it is only from data already loaded.  You probably don't want to do
that.




Are you using union mode?


Well yes that is what I want - all of the data is loaded but some is in
what I think is the default graph and some is in named graphs. Are you
saying that the default graph is either the data not in named graph or the
combination of named graphs?  It can only be one or the other?


Yes, roughly speaking.  The default union graph at query time masks the 
stored default graph.  Actually, the default graph is there under the 
pseudo name:




Andy



Thanks
Rob





Re: Default and named graphs within TDB/Fuseki

2013-07-10 Thread Rob Walpole
Hi Andy,

Thanks for your reply.

>
> That load for the purpose of the query ... you already have the data in
> the dataset.  Remove these.
>
> Did you load into "http://example.org/bob";


So I used tdbloader2 to store dft.ttl into an empty instance of TDB. I
assume this places the data in the default graph? The dft.ttl data looks
like this:

@prefix dc:  .

dc:publisher  "Bob Hacker" .
  dc:publisher  "Alice Hacker" .

Then I used s-put to store bob.ttl and alice.ttl into the named graphs
http://example.org/bob and http://example.org/alice respectively.

bob.ttl looks like this:-

@prefix foaf:  .

_:a foaf:name "Bob" .
_:a foaf:mbox  .

and alice.ttl looks like this...

@prefix foaf:  .

_:a foaf:name "Alice" .
_:a foaf:mbox  .

When I run the query though I get no results.


> Run this:
>
> SELECT * {
>   { ?s ?p ?o } UNION { GRAPH ?g { ?s ?p ?o } }
> }
>
> to see what you have.
>
>
I have this:-


| s  | p
| o| g  |

|    |
 | "Bob Hacker"
||
|  |
 | "Alice Hacker"
||
| _:b0   | 
|  |    |
| _:b0   | 
| "Bob"|    |
| _:b1   | 
|   |  |
| _:b1   | 
| "Alice"  |  |





>
>  I have tried using the form > dataset/data?default >
>> but this has no affect (although I can download the data from here...)
>>
>
> Longer:
>
> In TDB it picks FROM/FROM NAMED from the set of already loaded named
> graphs.
>
> http://jena.apache.org/**documentation/tdb/dynamic_**datasets.html
>
> But it is only from data already loaded.  You probably don't want to do
> that.
>
>
Well yes that is what I want - all of the data is loaded but some is in
what I think is the default graph and some is in named graphs. Are you
saying that the default graph is either the data not in named graph or the
combination of named graphs?  It can only be one or the other?

Thanks
Rob


Re: Default and named graphs within TDB/Fuseki

2013-07-09 Thread Andy Seaborne

On 09/07/13 14:50, Rob Walpole wrote:

Hi,

I could use some help to understand default and named graphs within Jena
(TDB/Fuseki)...

In the following example taken from the W3C SPARQL 1.1 spec what needs to
go in place of...

FROM 

...assuming I have loaded dft.ttl into the 'default' graph of TDB and am
querying via Fuseki?

PREFIX foaf: 
PREFIX dc: 

SELECT ?who ?g ?mbox
FROM 
FROM NAMED 
FROM NAMED 


That load for the purpose of the query ... you already have the data in 
the dataset.  Remove these.


Did you load into "http://example.org/bob";


WHERE
{
?g dc:publisher ?who .
GRAPH ?g { ?x foaf:mbox ?mbox }
}



Run this:

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

to see what you have.


I have tried using the form 
but this has no affect (although I can download the data from here...)


Longer:

In TDB it picks FROM/FROM NAMED from the set of already loaded named graphs.

http://jena.apache.org/documentation/tdb/dynamic_datasets.html

But it is only from data already loaded.  You probably don't want to do 
that.


Andy



Many thanks
Rob





Default and named graphs within TDB/Fuseki

2013-07-09 Thread Rob Walpole
Hi,

I could use some help to understand default and named graphs within Jena
(TDB/Fuseki)...

In the following example taken from the W3C SPARQL 1.1 spec what needs to
go in place of...

FROM 

...assuming I have loaded dft.ttl into the 'default' graph of TDB and am
querying via Fuseki?

PREFIX foaf: 
PREFIX dc: 

SELECT ?who ?g ?mbox
FROM 
FROM NAMED 
FROM NAMED 
WHERE
{
   ?g dc:publisher ?who .
   GRAPH ?g { ?x foaf:mbox ?mbox }
}

I have tried using the form 
but this has no affect (although I can download the data from here...)

Many thanks
Rob

-- 

Rob Walpole
Email robkwalp...@gmail.com
Tel. +44 (0)7969 869881
Skype: RobertWalpolehttp://www.linkedin.com/in/robwalpole