On 21/12/2016 17:07, Andy Seaborne wrote:
> 
> 
> On 21/12/16 13:13, George News wrote:
>> On 21/12/2016 13:46, Andy Seaborne wrote:
>>>
>>>
>>> On 21/12/16 12:23, George News wrote:
>>>> szQuery = "" + " PREFIX dc: <http://purl.org/dc/elements/1.1/>" + "
>>>> PREFIX foaf: <http://xmlns.com/foaf/0.1/>" + " SELECT ?graph ?who
>>>> ?mbox"
>>>> + " FROM NAMED <http://example.org/alice>" + " FROM NAMED
>>>> <http://example.org/bob>" + " WHERE " + " { \n" + " ?graph dc:publisher
>>>> ?who . " + " GRAPH ?graph { ?x foaf:mbox ?mbox . } " + " }";
>>>
>>> Take out the FROM NAMED.
>>>
>>> Adding FROM or FROM NAMED creates a view of the original data - in this
>>> case with just 2 named graphs.  You don't want a view - you want the
>>> real thing.
>>>
>>>     Andy
>>>
>>
>> But then, how can I define to search only in some graphs? I was planning
>> to have more than two in total, and only search on some of them.
> 
> There are various ways
> 
> 1/ Use  FROM <urn:x-arq:DefaultGraph> to include the default graph in
> the view dataset.

Thanks a lot for that one. I didn't know how to access the default graph
in a SPARQL sentence.

> 2/ Make a union model and query that.
> 
> 3/ Use GRAPH <g> in a query (when it is just one graph)
> 
> 4/ Use GRAPH ?g {} FILTER( ... ?g ....) in a query (when it is just one
> graph)
> 
> (They are not exactly equivalent. )
> 
> The details of the usage will suggest a particular approach as will the
> total volume of data.

Great!! Just a last question: is it better to have many named graphs and
restrict queries to them or a union of some o them, or would it be
better to have just only one big graph?

I think the answer is quite straight ;) but just for curiosity.

Regards
Jorge

>     Andy
> 
>>
>> See you
>> Jorge
>>
> 

Reply via email to