You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Arthur Vaïsse-Lesteven <ar...@yahoo.fr> on 2013/06/06 10:29:16 UTC

Got unexpected request result with a DESCRIBE FROM Request

Hi,

I have created a totally new data set on my computer, and executed the following update request :

prefix ex:<http://example.com#>


INSERT DATA {

   GRAPH ex:a_graph {
        ex:Alice ex:like ex:cats .
    }  

  

    GRAPH ex:meta_data_graph {
        ex:a_graph ex:author ex:Bob.

        ex:Alice ex:IsDescribedIn ex:a_graph.
    }

}

My data set contains now 2 graphs with minimal triples.

I now use the following SPARQL request :

prefix ex:<http://example.com#>
DESCRIBE ex:Alice

This request give me the following result ( XML formated )
<rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>

That the answer that I expected, but now if I send this request : 

prefix ex:<http://example.com#>
DESCRIBE ex:Alice
FROM ex:a_graph

I got the same result :
<rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>


I was expecting that only the triple "Alice like cats" as a result. The other triple isn't stored in the graph ex:a_graph and I was expecting it was not in the result.


Do I made a mistake anywhere ? Do it is the normal result ?

NB : I executed this 3 SPARQL queries on the web interface of a fuseki server

Sincerelly.

VAISSE-LESTEVEN Arthur.

Re: Got unexpected request result with a DESCRIBE FROM Request

Posted by Andy Seaborne <an...@apache.org>.
On 06/06/13 16:23, Arthur Vaïsse-Lesteven wrote:
> Thanks for your quick answer.
>
>> DESCRIBE looks in the default graph to get the description so I'll guess
>> that your fuseki involves the union default graph otherwise I can't
>> explain the first (correct) results.
>
> Do that mean that the default union graph contains all the triple of the triple store ? ( I'm not sure I really understand this quote )

Forget the bit about default union graph - I misremember how the default 
DescribeHandler works.

>
> Because if I use the query "SELECT ?s ?p ?o WHERE {?s ?p ?o}" without any "from/from named" clause I don't obtain any result. So the default graph must be empty.
>
> I was expecting the result of "DESCRIBE ex:Alice FROM ex:a_graph" be the same result of the query "SELECT ?s ?p ?o FROM ex:a_graph WHERE { ?s ?p ?o FILTER ( ?s = ex:Alice ) }" and it's not.
>
> Does default graph isn't the same for select and describe queries ?

The FROM clause does not affect the DESCRIBE process, at least in the 
default DESCRIBE handler that you're using.  You can add DESCRIBE 
handlers specific to your needs (requires java coding) or take control 
in the SPARQL query using CONSTRUCT.

The FROM clause only affects the pattern part (in {} or absent). 
Otherwise, the default describe handler tries looking in all graphs in 
the dataset.

	Andy

>
>
>> Hi Arthur,
>>
>> DESCRIBE looks in the default graph to get the description so I'll guess
>> that your fuseki involves the union default graph otherwise I can't
>> explain the first (correct) results.
>>
>> Also, I guess you using TDB else the FROM isn't going to work as there
>> isn't a graph at the web URL http://example.com#Alice.
>>
>> If so, then the second second DESCRIBE executes the pattern (there isn't
>> one given so it's the empty patter) on the FROM graph but uses the
>> default graph of the dataset to fulfil the DESCRIBEing part.  As before,
>> that's all triples.
>>
>> If you want more control, consider using CONSTRUCT, otherwise you may
>> need to provide your own DESCRIBE handler.
>>
>>      Andy
>>
>> On 06/06/13 09:29, Arthur Vaïsse-Lesteven wrote:
>>> Hi,
>>>
>>> I have created a totally new data set on my computer, and executed the following update request :
>>>
>>> prefix ex:<http://example.com#>
>>>
>>>
>>> INSERT DATA {
>>>
>>>      GRAPH ex:a_graph {
>>>            ex:Alice ex:like ex:cats .
>>>        }
>>>
>>>
>>>
>>>        GRAPH ex:meta_data_graph {
>>>            ex:a_graph ex:author ex:Bob.
>>>
>>>            ex:Alice ex:IsDescribedIn ex:a_graph.
>>>        }
>>>
>>> }
>>>
>>> My data set contains now 2 graphs with minimal triples.
>>>
>>> I now use the following SPARQL request :
>>>
>>> prefix ex:<http://example.com#>
>>> DESCRIBE ex:Alice
>>>
>>> This request give me the following result ( XML formated )
>>> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>
>>>
>>> That the answer that I expected, but now if I send this request :
>>>
>>> prefix ex:<http://example.com#>
>>> DESCRIBE ex:Alice
>>> FROM ex:a_graph
>>>
>>> I got the same result :
>>> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>
>>>
>>>
>>> I was expecting that only the triple "Alice like cats" as a result. The other triple isn't stored in the graph ex:a_graph and I was expecting it was not in the result.
>>>
>>>
>>> Do I made a mistake anywhere ? Do it is the normal result ?
>>>
>>> NB : I executed this 3 SPARQL queries on the web interface of a fuseki server
>>>
>>> Sincerelly.
>>>
>>> VAISSE-LESTEVEN Arthur.
>>>
>


Re: Got unexpected request result with a DESCRIBE FROM Request

Posted by Arthur Vaïsse-Lesteven <ar...@yahoo.fr>.
Thanks for your quick answer.

>DESCRIBE looks in the default graph to get the description so I'll guess
>that your fuseki involves the union default graph otherwise I can't
>explain the first (correct) results.

Do that mean that the default union graph contains all the triple of the triple store ? ( I'm not sure I really understand this quote )

Because if I use the query "SELECT ?s ?p ?o WHERE {?s ?p ?o}" without any "from/from named" clause I don't obtain any result. So the default graph must be empty.

I was expecting the result of "DESCRIBE ex:Alice FROM ex:a_graph" be the same result of the query "SELECT ?s ?p ?o FROM ex:a_graph WHERE { ?s ?p ?o FILTER ( ?s = ex:Alice ) }" and it's not.

Does default graph isn't the same for select and describe queries ?


>Hi Arthur,
>
>DESCRIBE looks in the default graph to get the description so I'll guess
>that your fuseki involves the union default graph otherwise I can't
>explain the first (correct) results.
>
>Also, I guess you using TDB else the FROM isn't going to work as there
>isn't a graph at the web URL http://example.com#Alice.
>
>If so, then the second second DESCRIBE executes the pattern (there isn't
>one given so it's the empty patter) on the FROM graph but uses the
>default graph of the dataset to fulfil the DESCRIBEing part.  As before,
>that's all triples.
>
>If you want more control, consider using CONSTRUCT, otherwise you may
>need to provide your own DESCRIBE handler.
>
>    Andy
>
>On 06/06/13 09:29, Arthur Vaïsse-Lesteven wrote:
>> Hi,
>>
>> I have created a totally new data set on my computer, and executed the following update request :
>>
>> prefix ex:<http://example.com#>
>>
>>
>> INSERT DATA {
>>
>>    GRAPH ex:a_graph {
>>          ex:Alice ex:like ex:cats .
>>      }
>>
>>
>>
>>      GRAPH ex:meta_data_graph {
>>          ex:a_graph ex:author ex:Bob.
>>
>>          ex:Alice ex:IsDescribedIn ex:a_graph.
>>      }
>>
>> }
>>
>> My data set contains now 2 graphs with minimal triples.
>>
>> I now use the following SPARQL request :
>>
>> prefix ex:<http://example.com#>
>> DESCRIBE ex:Alice
>>
>> This request give me the following result ( XML formated )
>> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>
>>
>> That the answer that I expected, but now if I send this request :
>>
>> prefix ex:<http://example.com#>
>> DESCRIBE ex:Alice
>> FROM ex:a_graph
>>
>> I got the same result :
>> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>
>>
>>
>> I was expecting that only the triple "Alice like cats" as a result. The other triple isn't stored in the graph ex:a_graph and I was expecting it was not in the result.
>>
>>
>> Do I made a mistake anywhere ? Do it is the normal result ?
>>
>> NB : I executed this 3 SPARQL queries on the web interface of a fuseki server
>>
>> Sincerelly.
>>
>> VAISSE-LESTEVEN Arthur.
>>

Re: Got unexpected request result with a DESCRIBE FROM Request

Posted by Andy Seaborne <an...@apache.org>.
Hi Arthur,

DESCRIBE looks in the default graph to get the description so I'll guess 
that your fuseki involves the union default graph otherwise I can't 
explain the first (correct) results.

Also, I guess you using TDB else the FROM isn't going to work as there 
isn't a graph at the web URL http://example.com#Alice.

If so, then the second second DESCRIBE executes the pattern (there isn't 
one given so it's the empty patter) on the FROM graph but uses the 
default graph of the dataset to fulfil the DESCRIBEing part.  As before, 
that's all triples.

If you want more control, consider using CONSTRUCT, otherwise you may 
need to provide your own DESCRIBE handler.

	Andy

On 06/06/13 09:29, Arthur Vaïsse-Lesteven wrote:
> Hi,
>
> I have created a totally new data set on my computer, and executed the following update request :
>
> prefix ex:<http://example.com#>
>
>
> INSERT DATA {
>
>     GRAPH ex:a_graph {
>          ex:Alice ex:like ex:cats .
>      }
>
>
>
>      GRAPH ex:meta_data_graph {
>          ex:a_graph ex:author ex:Bob.
>
>          ex:Alice ex:IsDescribedIn ex:a_graph.
>      }
>
> }
>
> My data set contains now 2 graphs with minimal triples.
>
> I now use the following SPARQL request :
>
> prefix ex:<http://example.com#>
> DESCRIBE ex:Alice
>
> This request give me the following result ( XML formated )
> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>
>
> That the answer that I expected, but now if I send this request :
>
> prefix ex:<http://example.com#>
> DESCRIBE ex:Alice
> FROM ex:a_graph
>
> I got the same result :
> <rdf:RDF  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"  xmlns:ex="http://example.com#"> <rdf:Description rdf:about="http://example.com#Alice"> <ex:IsDescribedIn rdf:resource="http://example.com#a_graph"/> <ex:like rdf:resource="http://example.com#cats"/> </rdf:Description></rdf:RDF>
>
>
> I was expecting that only the triple "Alice like cats" as a result. The other triple isn't stored in the graph ex:a_graph and I was expecting it was not in the result.
>
>
> Do I made a mistake anywhere ? Do it is the normal result ?
>
> NB : I executed this 3 SPARQL queries on the web interface of a fuseki server
>
> Sincerelly.
>
> VAISSE-LESTEVEN Arthur.
>