Use of p* in test cases

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Use of p* in test cases

Jan Wielemaker-5
Hi,

It is not really clear to me whether comments on test cases should be
sent to this list.  Maybe it is also a comment on the document though.
I'm updating the ClioPatria SPARQL endpoint to 1.1.

One issue that causes me trouble are test cases such as '(pp34) Named
Graph 1'.  The query is

prefix :  <http://www.example.org/>
select ?t
where {
   GRAPH <ng-01.ttl> {
     ?s :p1* ?t }
}

Given that the * operator matches zero steps and both end-points
are variables, all resources are an answer.  But, what are all
resources?  It seems the test cases assume all resources that
appear as subject or object in the destination graph.  But,
why not all predicates too?   ClioPatria can generate resources,
but it has no clue to what graph these belong :-(

Although I can write an implementation that will answer this
question as the test-cases suggest it should be answered, I
wonder whether it makes much sense to define the behaviour of
this query exactly.  ?x :p* ?y queries can never be answered on
any sensible sized RDF graph anyway.

I'd propose to either use :p1+ for these queries or specify either
the subject or the object.  That avoids these ambiguities.

        Cheers --- Jan

P.s. Is there a better way to get the test cases than mirroring
        http://www.w3.org/2009/sparql/docs/tests/?  I found a mirror
        git repository on GitHUB, but it was rather outdated when
        I checked.

Reply | Threaded
Open this post in threaded view
|

Re: Use of p* in test cases

Andy Seaborne-3
Jan,

(explanatory answer - not a formal WG response)

The spec deals with this by defining the node set of a graph as all
subjects and objects (not properties).  This is closest to a
mathematical graph, which is a set of vertexes and set of edges; an RDF
graph is defined only as a set of edges.

http://www.w3.org/2009/sparql/docs/query-1.1/rq25.xml#defn_nodeSet

ZeroOrMorePath is then defined using nodes(G) for when the path is
unbounded at each end.  The node set in question is the "active graph"
hence it's GRAPH <ng-01.ttl>.

When you start working with graph algorithms, the need for the set of
vertexes arises.  The Node set of a graph is the minimal set to have all
the vertexes taking the triples as labelled edges of a graph.  The
properties could be included, but property paths connect vertexes to
vertexes, treating the properties as edge labels, when viewed as a
mathematical graph.

        Andy

On 11/10/12 16:29, Jan Wielemaker wrote:

> Hi,
>
> It is not really clear to me whether comments on test cases should be
> sent to this list.  Maybe it is also a comment on the document though.
> I'm updating the ClioPatria SPARQL endpoint to 1.1.
>
> One issue that causes me trouble are test cases such as '(pp34) Named
> Graph 1'.  The query is
>
> prefix :  <http://www.example.org/>
> select ?t
> where {
>    GRAPH <ng-01.ttl> {
>      ?s :p1* ?t }
> }
>
> Given that the * operator matches zero steps and both end-points
> are variables, all resources are an answer.  But, what are all
> resources?  It seems the test cases assume all resources that
> appear as subject or object in the destination graph.  But,
> why not all predicates too?   ClioPatria can generate resources,
> but it has no clue to what graph these belong :-(
>
> Although I can write an implementation that will answer this
> question as the test-cases suggest it should be answered, I
> wonder whether it makes much sense to define the behaviour of
> this query exactly.  ?x :p* ?y queries can never be answered on
> any sensible sized RDF graph anyway.
>
> I'd propose to either use :p1+ for these queries or specify either
> the subject or the object.  That avoids these ambiguities.
>
>      Cheers --- Jan
>
> P.s.    Is there a better way to get the test cases than mirroring
>      http://www.w3.org/2009/sparql/docs/tests/?  I found a mirror
>      git repository on GitHUB, but it was rather outdated when
>      I checked.
>

Reply | Threaded
Open this post in threaded view
|

Re: Use of p* in test cases

Jan Wielemaker-2
Hi Andy,

I see.  If enumerating all nodes is what the test it about, it is fine.
If the test is about whether property paths combine with GRAPH, I'd
prefer if the node-test is a single test and this test uses :p1+.

        Cheers --- Jan

On 10/13/2012 10:46 AM, Andy Seaborne wrote:

> Jan,
>
> (explanatory answer - not a formal WG response)
>
> The spec deals with this by defining the node set of a graph as all
> subjects and objects (not properties).  This is closest to a
> mathematical graph, which is a set of vertexes and set of edges; an RDF
> graph is defined only as a set of edges.
>
> http://www.w3.org/2009/sparql/docs/query-1.1/rq25.xml#defn_nodeSet
>
> ZeroOrMorePath is then defined using nodes(G) for when the path is
> unbounded at each end.  The node set in question is the "active graph"
> hence it's GRAPH <ng-01.ttl>.
>
> When you start working with graph algorithms, the need for the set of
> vertexes arises.  The Node set of a graph is the minimal set to have all
> the vertexes taking the triples as labelled edges of a graph.  The
> properties could be included, but property paths connect vertexes to
> vertexes, treating the properties as edge labels, when viewed as a
> mathematical graph.
>
>      Andy
>
> On 11/10/12 16:29, Jan Wielemaker wrote:
>> Hi,
>>
>> It is not really clear to me whether comments on test cases should be
>> sent to this list.  Maybe it is also a comment on the document though.
>> I'm updating the ClioPatria SPARQL endpoint to 1.1.
>>
>> One issue that causes me trouble are test cases such as '(pp34) Named
>> Graph 1'.  The query is
>>
>> prefix :  <http://www.example.org/>
>> select ?t
>> where {
>>    GRAPH <ng-01.ttl> {
>>      ?s :p1* ?t }
>> }
>>
>> Given that the * operator matches zero steps and both end-points
>> are variables, all resources are an answer.  But, what are all
>> resources?  It seems the test cases assume all resources that
>> appear as subject or object in the destination graph.  But,
>> why not all predicates too?   ClioPatria can generate resources,
>> but it has no clue to what graph these belong :-(
>>
>> Although I can write an implementation that will answer this
>> question as the test-cases suggest it should be answered, I
>> wonder whether it makes much sense to define the behaviour of
>> this query exactly.  ?x :p* ?y queries can never be answered on
>> any sensible sized RDF graph anyway.
>>
>> I'd propose to either use :p1+ for these queries or specify either
>> the subject or the object.  That avoids these ambiguities.
>>
>>      Cheers --- Jan
>>
>> P.s.    Is there a better way to get the test cases than mirroring
>>      http://www.w3.org/2009/sparql/docs/tests/?  I found a mirror
>>      git repository on GitHUB, but it was rather outdated when
>>      I checked.
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Use of p* in test cases

Andy Seaborne-3


On 13/10/12 09:54, Jan Wielemaker wrote:
> Hi Andy,
>
> I see.  If enumerating all nodes is what the test it about, it is fine.
> If the test is about whether property paths combine with GRAPH, I'd
> prefer if the node-test is a single test and this test uses :p1+.
>
>      Cheers --- Jan

(not having written the test ... and not a formal WG response)

The test, which is "approved", looks to me to be in part that the
property path is with a specific graph - specifically the scope of node
set being the active graph not all whole dataset of the query.

ARQ throws its hands up and executes it "directly" -- it does calculate
the node set if there isn't anything else to start on.

        Andy

>
> On 10/13/2012 10:46 AM, Andy Seaborne wrote:
>> Jan,
>>
>> (explanatory answer - not a formal WG response)
>>
>> The spec deals with this by defining the node set of a graph as all
>> subjects and objects (not properties).  This is closest to a
>> mathematical graph, which is a set of vertexes and set of edges; an RDF
>> graph is defined only as a set of edges.
>>
>> http://www.w3.org/2009/sparql/docs/query-1.1/rq25.xml#defn_nodeSet
>>
>> ZeroOrMorePath is then defined using nodes(G) for when the path is
>> unbounded at each end.  The node set in question is the "active graph"
>> hence it's GRAPH <ng-01.ttl>.
>>
>> When you start working with graph algorithms, the need for the set of
>> vertexes arises.  The Node set of a graph is the minimal set to have all
>> the vertexes taking the triples as labelled edges of a graph.  The
>> properties could be included, but property paths connect vertexes to
>> vertexes, treating the properties as edge labels, when viewed as a
>> mathematical graph.
>>
>>      Andy
>>
>> On 11/10/12 16:29, Jan Wielemaker wrote:
>>> Hi,
>>>
>>> It is not really clear to me whether comments on test cases should be
>>> sent to this list.  Maybe it is also a comment on the document though.
>>> I'm updating the ClioPatria SPARQL endpoint to 1.1.
>>>
>>> One issue that causes me trouble are test cases such as '(pp34) Named
>>> Graph 1'.  The query is
>>>
>>> prefix :  <http://www.example.org/>
>>> select ?t
>>> where {
>>>    GRAPH <ng-01.ttl> {
>>>      ?s :p1* ?t }
>>> }
>>>
>>> Given that the * operator matches zero steps and both end-points
>>> are variables, all resources are an answer.  But, what are all
>>> resources?  It seems the test cases assume all resources that
>>> appear as subject or object in the destination graph.  But,
>>> why not all predicates too?   ClioPatria can generate resources,
>>> but it has no clue to what graph these belong :-(
>>>
>>> Although I can write an implementation that will answer this
>>> question as the test-cases suggest it should be answered, I
>>> wonder whether it makes much sense to define the behaviour of
>>> this query exactly.  ?x :p* ?y queries can never be answered on
>>> any sensible sized RDF graph anyway.
>>>
>>> I'd propose to either use :p1+ for these queries or specify either
>>> the subject or the object.  That avoids these ambiguities.
>>>
>>>      Cheers --- Jan
>>>
>>> P.s.    Is there a better way to get the test cases than mirroring
>>>      http://www.w3.org/2009/sparql/docs/tests/?  I found a mirror
>>>      git repository on GitHUB, but it was rather outdated when
>>>      I checked.
>>>
>>
>