Re: RDFQ - RDF Queries in RDF

Firstly, let me stress that I am proposing RDFQ, or something
like it, as a *starting* point, not an *ending* point, so if
it does not include some particular feature/function that the WG
feels is essential, that shouldn't exclude the WG exploring
such an avenue.

I.e. the comparison of QLs should not be basis for selecting one
"as-is" but simply as fodder for discussion about what ultimately
would be the most optimal approach to pursue.

That said...


On Apr 08, 2004, at 09:34, Patrick Stickler wrote:
>>
>> Can one express queries in RDFQ where an arbitrary subset of the terms
>> in the graph are logical disjuctions according to a popular definition
>> of "disjuction" [2] ? ...

> Perhaps not as presently defined. But being an RDF vocabulary, it would
> probably be straightforward to add.
>

E.g. something along the lines of

rdfq:oneOf a rdf:Property ;
    rdfs:range rdfs:List ;
    rdfs:comment "A list of alternatives." .

rdfq:TargetSubset a rdfs:Class ;
    rdfs:comment "A target template subset." .

with the following closure rules

IF
    ?target ?property ?value .
    ?value rdfq:oneOf ?list .
    ?list rdfs:member ?alternate .
THEN
    ?alternate rdf:type rdfq:Value .

I.e., a list of alternatives associated with a value
is a list of alternative values.

IF
    ?query rdfq:target ?target .
    ?target rdfq:oneOf ?list .
    ?list rdfs:member ?subset .
THEN
    ?subset rdf:type rdfq:TargetSubset .
    ?subset rdfq:resource ?r .
    ?target rdfq:resource ?r .

I.e., a list of alternatives associated with a target
is a list of alternate target template subsets, and a target
template and a target template subset describe the
same thing.

Thus, taking your example FatAnnotationQuery (EP-4) [1]:

ask
(<http://example.com/annot1>  rdf:type    a:Annotation.
  <http://example.com/annot1>  a:annotates ?annotates.
  <http://example.com/annot1>  a:context   ?context.
  ( <http://example.com/annot1>  dc0:creator ?creator ||
    <http://example.com/annot1>  dc1:creator ?creator )
  ?creator                     a:E-mail    ?email.
  ?creator                     a:name      ?name.
  <http://example.com/annot1>  a:ceated    ?created.
  ( <http://example.com/annot1>  dc0:date    ?date ||
    <http://example.com/annot1>  dc1:date    ?date )
  <http://example.com/annot1>  a:body           ?body.
  ?body                        http:Body        ?bodyData.
  ?body                        http:ContentType ?contentType)
collect (?annotation ?body)

we get in RDFQ (serialized as Turtle, in minimal form):

[ :select ( "annotation" "body" ) ;
   :target [ :resource <http://example.com/annot1> ;
             :id "annotation" ;
             rdf:type a:Annotation ;
             a:annotates [ ] ;
             a:context [ ] ;
             :oneOf ( [ dc0:creator [ :id "creator" ] ; dc0:date [ ] ]
                      [ dc1:creator [ :id "creator" ] ; dc1:date [ ] ] )  
;
             a:created [ :id "creator" ] ;
             a:body [ :id "body" ; http:Body [ ] ; http:ContentType [ ]  
] ] ] .

or more explicitly (not trusting the RDFS closure rules to do their  
thing):

[ a rdfq:Query ;
   rdfq:select ( "annotation" "body" ) ;
   rdfq:target [ a rdfq:Target ;
                 rdfq:resource <http://example.com/annot1> ;
                 rdfq:id "annotation" ;
                 rdf:type a:Annotation ;
                 a:annotates [ a rdfq:Value ] ;
                 a:context [ a rdfq:Value ] ;
                 rdfq:oneOf ( [ a rdfq:TargetSubset ;
                                dc0:creator [ a rdfq:Value ; rdfq:id  
"creator" ] ;
                                dc0:date [ a rdfq:Value ] ]
                              [ a rdfq:TargetSubset ;
                                dc1:creator [ a rdfq:Value ; rdfq:id  
"creator" ] ;
                                dc1:date [ a rdfq:Value ] ] ) ;
                 a:created [ rdfq:id "creator" ] ;
                 a:body [ rdfq:id "body" ;
                          http:Body [ a rdfq:Value ] ;
                          http:ContentType [ a rdfq:Value ] ] ] ] .

(note, I omitted rdfq:id qualifications where all that appeared
  to be relevant was that some value was defined)

--

Of course, this is just off the top of my head, so is sure to have
at least one imperfection. But it illustrates my point, I think,
that "fuller" disjunction could be done with a QL such as RDFQ
in a relatively intuitive manner.

It is, perhaps fair though, to conclude that RDFQ as presently
defined does not support the "kind of" disjunction that you had
in mind for that classification.

Patrick


[1]  
http://lists.w3.org/Archives/Public/public-rdf-dawg/2004JanMar/ 
0083.html

--

Patrick Stickler
Nokia, Finland
patrick.stickler@nokia.com

Received on Thursday, 8 April 2004 04:23:59 UTC