RDFQ: RDF Query

Overview

RDFQ is an RDF vocabulary and query model for resource and resource knowledge discovery.

RDFQ is a tool for knowledge discovery, rather than for knowledge management or knowledge manipulation. Requesting agents submitting RDFQ queries need not know how knowledge is organized, partitioned, modeled, stored, accessed, or manipulated internally by the server.

The RDFQ vocabulary provides for the definition of templates which can be matched against actual resource descriptions. The results of an RDFQ query is a an RDF graph containing either (a) the concise bounded descriptions of all resources matched by one or more of the specified target templates, or (b) a set of variable binding declarations expressed using the Result Set Vocabulary. Any number of queries can be submitted in the same request, and any number of templates can be specified as part of the same query, and the results of all matched templates and queries specified in the input request are merged together in the results.

A typical RDFQ query corresponds to the request: "Tell me everything you know about the resources which have the following characteristics..."

In addition to one or more target templates, an input request may contain any amount of auxilliary knowledge which will be taken into account when executing the query. For servers which provide basic inference support, this is particularly useful for asserting vocabulary relationships between terms used by the server and terms used by the requesting agent, to tailor the results to the agent's needs, or to impose agent-specific assumptions on the evaluation of the query which are not shared by the server.

RDFQ Vocabulary

The RDFQ vocabulary is formally defined by the RDF schema http://swdev.nokia.com/rdfq/schemas/RDFQ-1.0.rdf.

The following is a summary of the vocabulary terms.

Term * Type Label Description
rdfq:Query rdfs:Class Query A query is a collection of one or more templates to be matched against resource descriptions.
rdfq:Target rdfs:Class Query Target A target is a template to be matched against resource descriptions.

Property values for target resources may be exact, or qualified.
rdfq:Graph rdfs:Class Target Graph A target graph is a template to be matched against named graphs, if supported by the query service.

A named graph corresponds to a particular set of RDF statements (a graph) identified explicitly by a URI and typically qualified by one or more warrants providing a means to verify the source, authority, and validity of the graph.

Comparison of resource target templates is restricted to named graphs which match a target graph template.

Property values for target graphs may be exact, or qualified.
rdfq:Value rdfs:Class Qualified Value A qualified value is a target property value which matches an actual resource value according to one or more operators.

All operators must match in order for the qualified value to match the resource value.

If no operators are specified, then the qualified value will match any target property value, but at least one target property value must exist for the match to succeed.
rdfq:OptionalValue rdfs:Class Optional Value A optional value is a qualified value which need not match, but if it does, is bound to any specified local identifier specified with rdfq:id which can be selected using rdfq:select.
rdfq:Predicate rdfs:Class Predicate A predicate of an RDF statement.
rdfq:id rdf:Property local identifier A local identifier (variable) associated with a node within a particular target template.

Local identifiers are used both for equating two or more otherwise unspecified values (e.g. two property values are the same, no matter what those values are) as well as binding variables for result set output as specified by an rdfq:select variable list.
rdfq:select rdf:Property variable selection Specifies a list (set) of variables for which bindings should be defined in the results.

If a variable selection list is specified for an rdfq:Query, the results of that query will be output as variable bindings expressed in RDF using the Result Set Vocabulary rather than outputting the concise bounded descriptions of all matched targets in the query.
rdfq:graph rdfg:Graph target graph Specifies a target graph to be matched.

If the specified target is an anonymous target graph template, the template is matched against all named graphs in the knowledge base, with the statements of all matched graphs being included in the scope of the query. If the target graph is an explicitly named graph, the statements of that graph are included in the scope of the query.
rdfq:target rdf:Property query target Specifies a target to be matched.

If the specified target is an anonymous target template, the template is matched against all resources in the knowledge base. If the target is a named resource, the description of that resource is included in the results.
rdfq:property rdf:Property property The super-property of all properties. Every property is inferred to be a sub-property of this property; thus, this property matches every property in the graph.

Not to be confused with rdfq:predicate.
rdfq:predicate rdf:Property predicate The predicate of a particular property:value pair.

Not to be confused with rdfq:property.
rdfq:ne rdf:Property not equal to The resource value is not equal to the specified value.
rdfq:lt rdf:Property less than The resource value is less than the specified value.
rdfq:gt rdf:Property greater than The resource value is greater than the specified value.
rdfq:le rdf:Property less than or equal to The resource value is less than or equal to the specified value.
rdfq:ge rdf:Property greater than or equal to The resource value is greater than or equal to the specified value.
rdfq:re rdf:Property matches regular expression The resource value's string representation matches the specified regular expression. Applies to literal values only. For typed literals, the string representation corresponds to the lexical form. For plain literals, the string representation is the literal itself, irrespective of language tag.
rdfq:lang rdf:Property language tag The resource value's language tag matches the specified language tag. Applies to plain literal values only. Comparison of language tags is case insensitive.
rdfq:one-hour-ago rdf:Resource one hour ago Denotes the date and time exactly one hour ago from the present.
rdfq:one-day-ago rdf:Resource one day ago Denotes the date and time exactly one day ago from the present.
rdfq:one-week-ago rdf:Resource one week ago Denotes the date and time exactly one week ago from the present.
rdfq:one-month-ago rdf:Resource one month ago Denotes the date and time exactly one month ago from the present.
rdfq:one-year-ago rdf:Resource one year ago Denotes the date and time exactly one year ago from the present.
rdfq:null rdf:Resource no defined value Denotes the absence of any defined value.

* xmlns:rdfq="http://sw.nokia.com/RDFQ-1/"

RDFQ Service Parameters

In addition to the vocabulary and query resolution behavior described above, RDFQ also defines a simple service interface for submitting queries to a semantic web server.

All RDFQ service implementations must provide support for the parameters defined below:

Parameter Value * Description
query Serialized RDF Graph An RDF graph containing one or more rdfq:Query instances having one or more rdfq:Target templates, serialized using RDF/XML.

* All service parameter values must be URL encoded as appropriate.

Queries may be submitted using either of the HTTP methods GET or POST. The GET method is both suitable and also preferable for shorter queries, as these may be saved as bookmarks for convenient resubmission. Larger queries, however, may exceed the capacities of some servers' support for GET query strings; in which case POST can be used.

The Nokia RDFQ Service

The Prototype RDFQ service, implemented as an RDF Gateway Package, provides a reference implementation demonstrating the correct behavior of a RDFQ service, and may be downloaded and used free of charge, in accordance with the terms specified.

Nokia RDFQ Service Extended Parameters

The Nokia RDFQ service supports the following parameters, which includes full support for all RDFQ required parameters:

Parameter Value * Description
query Serialized RDF Graph An RDF graph containing one or more rdfq:Query instances having one or more rdfq:Target templates.
parsetype application/rdf+xml

Query input is serialized using RDF/XML.

[default]

application/turtle

Query input is serialized using Turtle.

format application/rdf+xml

Return query results serialized using RDF/XML.

[default]

application/rss

Return query results as an RSS 1.0 channel.

text/html

Return query results presented as browseable HTML.

naming label

When format is HTML, use labels, titles, or localname suffixes in place of complete URIs.

[default]

uri

When format is HTML, use URIs to denote resources.

inference exclude

Only explicitly asserted statements are returned. No inference is performed.

[default]

query-only

All explicitly asserted statements, as well as statements inferable by select rules are employed during the execution of the query, but only explicitly asserted statements are included in the returned resource descriptions.

description-only

All explicitly asserted statements, as well as statements inferable by select rules are included in the returned resource descriptions, but no inference is employed during the execution of the query.

include

All explicitly asserted statements, as well as statements inferable by select rules are employed during execution of the query as well included in the returned resource descriptions.



Examples

The following examples illustrate a broad range of queries which can be expressed in RDFQ.

Note: because the Nokia RDFQ service implementation supports basic inference, which is always applied when evaluating the input query graph (even if not applied to the execution of the query itself on the knowlege base), it is able to infer the rdf:type of rdfq:Query, rdfq:Target, and rdfq:Value resources based on the defined rdfs:range and rdfs:domain of the RDFQ vocabulary terms. Thus, queries can be expressed in Turtle in a more compact form. This compact form is shown following each full Turtle example.

Implementations supporting queries expressed in Turtle SHOULD apply rdfs:range and rdfs:domain closures for RDFQ vocabulary terms used in input queries, even if inference is not otherwise supported, so as to facilitate the more compact form of expression.

The following namespaces declarations are presumed for all examples:

   dc         http://purl.org/dc/elements/1.1/
   dct        http://purl.org/dc/terms/
   rss        http://purl.org/rss/1.0/
   xsd        http://www.w3.org/2001/XMLSchema#
   ex         http://example.org/
   voc        http://sw.nokia.com/VOC-1/
   {default}  http://sw.nokia.com/RDFQ-1/

Match all resources having a dc:title defined, returning the concise bounded description of each matched resource:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dc:title>
            <rdfq:Value/>
         </dc:title>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; dc:title [a rdfq:Value]]].

or

[:target [dc:title []]].


Match all resources having a dc:title defined, returning the variable bindings for 'target' and 'title' for each matched resource:

RDF/XML:

<rdfq:Query>
   <rdfq:select>
      <rdf:List>
         <rdf:first>target</rdf:first>
         <rdf:rest>
            <rdf:List>
               <rdf:first>title</rdf:first>
               <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
            </rdf:List>
         </rdf:rest>
      </rdf:List>
   </rdfq:select>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:id>
            target
         </rdfq:id>
         <dc:title>
            <rdfq:Value>
               <rdfq:id>
                  title
               </rdfq:id>
            </rdfq:Value>
         </dc:title>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:select ("target" "title");
   rdfq:target [a rdfq:Target; rdfq:id "target"; dc:title [a rdfq:Value; rdfq:id "title"]]].

or

[:select ("target" "title"); :target [:id "target"; dc:title [:id "title"]]].


Match all resources which have no rdfs:comment defined:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdfs:comment rdf:resource="http://sw.nokia.com/RDFQ-1/null"/>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; rdfs:comment rdfq:null]].

or

[:target [rdfs:comment :null]].


Match all resources having any property with a value equal to ten:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:property rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">10</rdfq:property>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; rdfq:property "10"^^xsd:integer]].

or

[:target [:property "10"^^xsd:integer]].


Match all resources having a dc:language equal to English:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dc:language rdf:datatype="http://www.w3.org/2001/XMLSchema#lang">en</dc:language>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; dc:language "en"^^xsd:lang]].

or

[:target [dc:language "en"^^xsd:lang]].


Match all resources having a dc:language not equal to English:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dc:language>
            <rdfq:Value>
               <rdfq:ne rdf:datatype="http://www.w3.org/2001/XMLSchema#lang">en</rdfq:ne>
            </rdfq:Value>
         </dc:language>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; dc:language [a rdfq:Value; rdfq:ne "en"^^xsd:lang]]].

or

[:target [dc:language [:ne "en"^^xsd:lang]]].


Match all resources having an rdfs:label matching a particular regular expression:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdfs:label>
            <rdfq:Value>
               <rdfq:re>[a-zA-Z][-_a-zA-Z0-9]*</rdfq:re>
            </rdfq:Value>
         </rdfs:label>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; rdfs:label [a rdfq:Value; rdfq:re "[a-zA-Z][-_a-zA-Z0-9]*"]].

or

[:target [rdfs:label [:re "[a-zA-Z][-_a-zA-Z0-9]*"]].


Match all resources having an rdfs:label specified as Finnish:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdfs:label>
            <rdfq:Value>
               <rdfq:lang>fi</rdfq:lang>
            </rdfq:Value>
         </rdfs:label>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; rdfs:label [a rdfq:Value; rdfq:lang "fi"]].

or

[:target [rdfs:label [:lang "fi"]].


Match all resources where their dct:modified timestamp occurs between the specified timestamps (match exclusive):

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dct:modified>
            <rdfq:Value>
               <rdfq:gt rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2001-08-11T10:30:00Z</rdfq:gt>
               <rdfq:lt rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2002-02-28T20:45:00Z</rdfq:lt>
            </rdfq:Value>
         </dct:modified>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
          dct:modified
             [a rdfq:Value;
                rdfq:gt "2001-08-11T10:30:00Z"^^xsd:dateTime;
                rdfq:lt "2002-02-28T20:45:00Z"^^xsd:dateTime
             ]
      ]
].

or

[:target [dct:modified [:gt "2001-08-11T10:30:00Z"^^xsd:dateTime; :lt "2002-02-28T20:45:00Z"^^xsd:dateTime]]].


Match all targets where their dct:modified timestamp occurs between, or equal to either of the specified timestamps (match inclusive):

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dct:modified>
            <rdfq:Value>
               <rdfq:ge rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2001-08-11T10:30:00Z</rdfq:ge>
               <rdfq:le rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2002-02-28T20:45:00Z</rdfq:le>
            </rdfq:Value>
         </dct:modified>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
          dct:modified
             [a rdfq:Value;
                rdfq:ge "2001-08-11T10:30:00Z"^^xsd:dateTime;
                rdfq:le "2002-02-28T20:45:00Z"^^xsd:dateTime
             ]
      ]
].

or

[:target [dct:modified [:ge "2001-08-11T10:30:00Z"^^xsd:dateTime; :le "2002-02-28T20:45:00Z"^^xsd:dateTime]]].


Match all resources where the dct:modified value is between or equal to either of the two specified timestamps, and which have values defined for both dc:title and dc:creator:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dct:modified>
            <rdfq:Value>
               <rdfq:ge rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2001-08-11T10:30:00Z</rdfq:ge>
               <rdfq:le rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2002-02-28T20:45:00Z</rdfq:le>
            </rdfq:Value>
         </dct:modified>
         <dc:title>
            <rdfq:Value/>
         </dc:title>
         <dc:creator>
            <rdfq:Value/>
         </dc:creator>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
         dct:modified
            [a rdfq:Value;
               rdfq:ge "2001-08-11T10:30:00Z"^^xsd:dateTime;
               rdfq:le "2002-02-28T20:45:00Z"^^xsd:dateTime 
            ];
         dc:title   
            [a rdfq:Value];
         dc:creator 
            [a rdfq:Value]
      ]
].

or

[:target [dct:modified [:ge "2001-08-11T10:30:00Z"^^xsd:dateTime; :le "2002-02-28T20:45:00Z"^^xsd:dateTime]
          dc:title [];
          dc:creator []]].


Match all resources where the dct:created value is equal to the dct:modified value:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dct:created>
            <rdfq:Value rdfq:id="x"/>
         </dct:created>
         <dct:modified>
            <rdfq:Value rdfq:id="x"/>
         </dct:modified>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
         dct:created  [a rdfq:Value; rdfq:id "x"];
         dct:modified [a rdfq:Value; rdfq:id "x"]
      ]
].

or

[:target [dct:created  [:id "x"]; dct:modified [:id "x"]]].


Match all resources where the dct:modified value is less than one week ago (i.e. all resources modified in the last week):

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dct:modified>
            <rdfq:Value>
               <rdfq:le rdf:resource="http://sw.nokia.com/RDFQ-1/one-week-ago"/>
            </rdfq:Value>
         </dct:modified>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:target [a rdfq:Target; dct:modified [a rdfq:Value; rdfq:le rdfq:one-week-ago]]].

or

[:target [dct:modified [:le :one-week-ago]]].


Match all resources which have a dc:creator which an ex:Person who has a ex:firstName of "John", an ex:lastName of "Doe" and has an ex:age that is greater than 30:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dc:creator>
            <rdfq:Value>
               <rdf:type rdf:resource="http://example.org/Person"/>
               <ex:firstName>John</ex:firstName>
               <ex:lastName>Doe</ex:lastName>
               <ex:age>
                  <rdfq:Value>
                     <rdfq:gt rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">30</rdfq:gt>
                  </rdfq:Value>
               </ex:age>
            </ex:Person>
         </dct:modified>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
         dc:creator
         [a rdfq:Value;
            rdf:type ex:Person;
            ex:firstName "John";
            ex:lastName  "Doe";
            ex:age [a rdfq:Value; rdfq:gt "30"^^xsd:integer]
         ]
      ]
].

or

[:target [dc:creator [a ex:Person; ex:firstName "John"; ex:lastName "Doe"; ex:age [:gt "30"^^xsd:integer]]]].


Return the descriptions of all of the explicitly specified resources:

RDF/XML:

<rdfq:Query>
   <rdfq:target rdf:resource="http://example.com/foo"/>
   <rdfq:target rdf:resource="http://example.com/bar"/>
   <rdfq:target rdf:resource="http://example.com/bas"/>
   <rdfq:target rdf:resource="http://example.com/boo"/>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target <http://example.com/foo>;
   rdfq:target <http://example.com/bar>;
   rdfq:target <http://example.com/bas>;
   rdfq:target <http://example.com/boo>
].

or

[:target <http://example.com/foo>; 
 :target <http://example.com/bar>;
 :target <http://example.com/bas>;
 :target <http://example.com/boo>].


Return the descriptions of all of the explicitly specified resources (equivalent to the above):

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:resource rdf:resource="http://example.com/foo"/>
      </rdfq:Target>
   </rdfq:target>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:resource rdf:resource="http://example.com/bar"/>
      </rdfq:Target>
   </rdfq:target>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:resource rdf:resource="http://example.com/bas"/>
      </rdfq:Target>
   </rdfq:target>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:resource rdf:resource="http://example.com/boo"/>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target [a rdfq:Target; rdfq:resource <http://example.com/foo>];
   rdfq:target [a rdfq:Target; rdfq:resource <http://example.com/bar>];
   rdfq:target [a rdfq:Target; rdfq:resource <http://example.com/bas>];
   rdfq:target [a rdfq:Target; rdfq:resource <http://example.com/boo>]
].

or

[:target [:resource <http://example.com/foo>];
 :target [:resource <http://example.com/bar>];
 :target [:resource <http://example.com/bas>];
 :target [:resource <http://example.com/boo>]].


Return a description of the explicitly specified resource, but only if it has a value defined for the dc:title property:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:resource rdf:resource="http://example.com/foo"/>
         <dc:title>
            <rdfq:Value/>
         </dc:title>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
         rdfq:resource <http://example.com/foo>;
         dc:title [a rdfq:Value]
      ]
].

or

[:target [:resource <http://example.com/foo>; dc:title []]].


Match all terms which belong to the specified vocabulary:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <rdf:type rdf:resource="http://sw.nokia.com/VOC-1/Term"/>
         <voc:partOf rdf:resource="http://example.com/vocabulary/X"/>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target [a rdfq:Target; 
                  rdf:type voc:Term;
                  voc:partOf <http://example.com/vocabulary/X>
               ]
].

or

[:target [a voc:Term; voc:partOf <http://example.com/vocabulary/X>]].


Match all resources where the dct:modified value is less than one week ago, and which have a value defined for both the dc:title and dc:description properties:

RDF/XML:

<rdfq:Query>
   <rdfq:target>
      <rdfq:Target>
         <dct:modified>
            <rdfq:Value>
               <rdfq:le rdf:resource="http://sw.nokia.com/RDFQ-1/one-week-ago"/>
            </rdfq:Value>
         </dct:modified>
         <dc:title>
            <rdfq:Value/>
         </dc:title>
         <dc:description>
            <rdfq:Value/>
         </dc:description>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query;
   rdfq:target
      [a rdfq:Target;
         dct:modified [a rdfq:Value; rdfq:le rdfq:one-week-ago];
         dc:title [a rdfq:Value];
         dc:description [a rdfq:Value]
      ]
].

or

[:target [dct:modified [:le :one-week-ago]; dc:title []; dc:description []]].


Match all statements, returning the bindings to the variables "subject", "predicate", and "object":

RDF/XML:

<rdfq:Query>
   <rdfq:select>
      <rdf:List>
         <rdf:first>subject</rdf:first>
         <rdf:rest>
            <rdf:List>
               <rdf:first>predicate</rdf:first>
               <rdf:rest>
                  <rdf:List>
                     <rdf:first>object</rdf:first>
                     <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/>
                  </rdf:List>
               </rdf:rest>
            </rdf:List>
         </rdf:rest>
      </rdf:List>
   </rdfq:select>
   <rdfq:target>
      <rdfq:Target>
         <rdfq:id>
            subject
         </rdfq:id>
         <rdfq:property>
            <rdfq:Value>
               <rdfq:id>
                  object
               </rdfq:id>
               <rdfq:predicate>
                  <rdfq:Predicate>
                     <rdfq:id>
                        predicate
                     </rdfq:id>
                  </rdfq:Predicate>
               </rdfq:predicate>
            </rdfq:Value>
         </dc:title>
      </rdfq:Target>
   </rdfq:target>
</rdfq:Query>

Turtle:

[a rdfq:Query; rdfq:select ("subject" "predicate" "object");
   rdfq:target [a rdfq:Target;
                  rdfq:id "subject";
                  rdfq:property [a rdfq:Value;
                                   rdfq:id "object";
                                   rdfq:predicate [a rdfq:Predicate;
                                                     rdfq:id "predicate"]]]].

or

[:select ("subject" "predicate" "object");
 :target [:id "subject"; :property [:id "object"; :predicate [:id "predicate"]]]].

Note the significant utility of compression provided by the minimal Turtle form in this last example!


Contact:  Patrick Stickler Copyright (C) 2003-2004 Nokia