This document defines RDFQ, a vocabulary for expressing queries in RDF.
An rdfq:Query describes a resource which may be defined in a RDF knowledge base. The total set of RDF statements made about a target resource constitutes its RDFQ profile.
A RDFQ query consists of a series of full or partial descriptions of target resources to be identified in the knowledge base, including the ability to qualify target property values by various comparison operators.
A property in a query with no value is considered equivalent to, and a shorthand for a property having a qualified value with a rdfq:any qualification (see the definition of rdfq:QValue below).
If the query pertains to knowledge about one or more particular targets, these may be specified explicitly by asserting one or more rdfq:target statements for the rdfq:Query.
An rdfq:Query having one or more targets explicitly specified yet having no other statements has a special interpretation, whereby all knowledge about the specified target(s) is returned.
Statements about an rdfq:Query differ from normal statements about a resource in that query properties are allowed to take values in ways which may deviate from the constraints implicitly or explicitly specified for those properties as follows:
Multiple Values
Properties normally allowing only a single value may have multiple values defined in a query. The interpretation of multiple query values is to apply 'AND' logic such that the property matches if all of the query values match one of the target values.
Regular Expressions
Query values for properties taking restricted string-based values (tokens, name lists, etc.) may contain regular expressions; in which case the property matches if the specified regular expression pattern matches the target value.
Qualified Values
An rdfq:QValue, or qualified value, is a property value that is qualified by one of several comparison operators. Not all comparison operators are necessarily meaningful for all property value types. If no operator is specified for a given query value, equality is assumed. There is no explicit equality operator.
Name Label Description ne Not Equal To The property matches if the target value fails to match the query value.
lt Less Than The property matches if the target value is less than the query value.
gt Greater Than The property matches if the target value is greater than the query value.
le Less Than or Equal To The property matches if the target value is less than or equal to the query value.
ge Greater Than or Equal To The property matches if the target value is greater than or equal to the query value.
any Has Any Defined The property matches if the target has any value defined whatsoever.
none Has None Defined The property matches if the target has no value defined whatsoever.
Variables
Any subject or object in a query may have a variable associated with it, via the rdfq:variable property, which will be asserted (bound) for all matching resources in the query results; providing variable binding in conjunction with the returned statements.
This approach allows applications which operate on variable bindings and applications which operate on statements to both utilize the same query language and query results, both of which are expressed in RDF/XML. No additional syntax for either queries or results need be supported.
An rdfq:QuerySeq, or query sequence, is a sequence of RDFQ queries where the results of each preceeding query serve to describe a bounded set of resource descriptions upon which to execute each subsequent query. Among other use cases, this is convenient for performing an absolute match query for manditory properties followed by a best match query for optional but desirable properties (see below).
An rdfq:Select, or selection, describes a selection of a subset of a RDFQ profile and acts as a filter on the RDFQ profile. A query sequence can end in one or more selections to obtain only those properties of interest.
Similar to a rdfq:Query, a RDFQ selection consists of a series of full or partial property definitions. If a property has no specified value, it is to be included in the results iff it is defined. If the property has a qualified value, it is to be included in the results iff all values in the profile satisfy the specified qualifications.
A property in a selection with no value is considered equivalent to, and a shorthand for a property having a qualified value with a rdfq:any qualification.
Any property not successfully matched by the selection is omitted from the results.
A query engine can be directed to apply two types of thresholds to constrain the total number of targets described in the results of a given query. Both thresholds may be applied together to the same query results.
Maximum Targets
The 'max_return' property can be specified for the query to define the maximum number of targets to be described in the results returned.
In the case that targets are scored and ordered by relevance, the maximum number of targets are to be taken from the highest scoring targets.
Minimum Relevance
The 'min_relevance' property can be specified for the query to define the minimum score which must be equaled or exceeded by every target described in the results returned.
Note that specifying a minimum relevance of 100 requires that targets match perfectly, allowing one to choose between best match and absolute match.
<?xml version="1.0"?> <!DOCTYPE rdf:RDF [ <!ENTITY schema "http://sw.nokia.com/sw/schemas/Core/RDFQ-2.0.rdf"> <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns"> <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema"> <!ENTITY xsd "http://www.w3.org/2001/XMLSchema"> <!ENTITY dc "http://purl.org/dc/elements/1.1"> <!ENTITY voc "http://sw.nokia.com/VOC-1"> <!ENTITY rdfq "http://sw.nokia.com/RDFQ-2"> ]> <rdf:RDF xmlns:rdf ="&rdf;#" xmlns:rdfs ="&rdfs;#" xmlns:xsd ="&xsd;#" xmlns:voc ="&voc;/" xmlns:dc ="&dc;/" > <rdf:Description rdf:about="&schema;"> <dc:title>Vocabulary Definition for RDF Query 2.0</dc:title> <dc:creator>Patrick Stickler (patrick.stickler@nokia.com)</dc:creator> <dc:publisher>Nokia</dc:publisher> <dc:format>application/rdf+xml</dc:format> <dc:rights> Copyright (C) 1999-2003 Nokia. All rights reserved. This document may be copied, published, and distributed, without restriction of any kind, provided it is not modified in any way. THIS DOCUMENT IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE DOCUMENT IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND USABILITY OF THIS DOCUMENT IS WITH YOU. SHOULD THIS DOCUMENT PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT NOKIA, ITS LICENSORS OR AFFILIATES OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. </dc:rights> </rdf:Description> <voc:Vocabulary rdf:about="&rdfq;"> <voc:term> <rdfs:Class rdf:about="&rdfq;/QuerySeq"> <rdfs:subClassOf rdf:resource="&rdf;Seq"/> <rdfs:comment> A rdfq:QuerySeq is a sequence of RDFQ queries where the results of each preceeding query serve to describe a bounded set of targets upon which to execute each subsequent query. Among other use cases, this is convenient for performing an absolute match query for manditory properties followed by a best match query for optional but desirable properties. </rdfs:comment> </rdfs:Class> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </voc:term> <voc:term> <rdfs:Class rdf:about="&rdfq;/Query"> <rdfs:comment> A rdfq:Query describes a resource which may be defined in a RDF knowledge base. The total set of RDF statements made about a target resource constitutes its RDFQ profile. A RDFQ query consists of a series of full or partial descriptions of target resources to be identified in the knowledge base, including the ability to qualify target property values by various comparison operators. A property in a query with no value is considered equivalent to, and a shorthand for a property having a qualified value with a rdfq:any qualification (see rdfq:QValue). </rdfs:comment> </rdfs:Class> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </voc:term> <voc:term> <rdfs:Class rdf:about="&rdfq;/Select"> <rdfs:comment> A rdfq:Select describes a selection of a subset of a RDFQ profile and acts as a filter on the RDFQ profile. A query sequence can end in one or more selections to obtain only those properties of interest. Similar to a rdfq:Query, a RDFQ selection consists of a series of full or partial property definitions. If a property has no specified value, it is to be included in the results iff it is defined. If the property has a qualified value, it is to be included in the results iff all values in the profile satisfy the specified qualifications. A property in a selection with no value is considered equivalent to, and a shorthand for a property having a qualified value with a rdfq:any qualification. Any property not successfully matched by the selection is omitted from the results. </rdfs:comment> </rdfs:Class> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </voc:term> <voc:term> <rdfs:Class rdf:about="&rdfq;/QValue"> <rdfs:comment> A rdfq:QValue is an anonymous node which denotes a property value which is qualified according to zero or more RDFQ query operators such as rdfq:gt, rdfq:not, etc. The anonymous node matches any actual target property value which satisfies all of the qualification constraints defined. If no operators are specified, then the anonymous node by itself constitutes a requirement that some value be specified for the property, and matches any value whatsoever. </rdfs:comment> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Class> </voc:term> <voc:term> <rdf:Property rdf:about="&rdfq;/target"> <rdfs:domain rdf:resource="&rdfq;/Query"/> <rdfs:label>Target Resource</rdfs:label> <rdfs:comment> A explicit target resource to which the query applies. </rdfs:comment> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdf:Property> </voc:term> <voc:term> <rdf:Property rdf:about="&rdfq;/variable"> <rdfs:label>Variable</rdfs:label> <rdfs:comment> A variable to which all matching resources will be bound. </rdfs:comment> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdf:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/max_return"> <rdfs:domain rdf:resource="&rdfq;/Query"/> <rdfs:label>Maximum Matches to Return</rdfs:label> <rdfs:range rdf:resource="&xsd;nonNegativeInteger"/> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/min_relevance"> <rdfs:domain rdf:resource="&rdfq;/Query"/> <rdfs:label>Minimum Relevance to Return</rdfs:label> <rdfs:range rdf:resource="&xsd;nonNegativeInteger"/> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/ne"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Not Equal To</rdfs:label> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/lt"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Less Than</rdfs:label> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/gt"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Greater Than</rdfs:label> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/le"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Less Than or Equal To</rdfs:label> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/ge"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Greater Than or Equal To</rdfs:label> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/any"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Has Any Defined</rdfs:label> <dc:isPartOf rdf:resource="&rdfq;"/> <rdfs:isDefinedBy rdf:resource="&schema;"/> </rdfs:Property> </voc:term> <voc:term> <rdfs:Property rdf:about="&rdfq;/none"> <rdfs:domain rdf:resource="&rdfq;/QValue"/> <rdfs:label>Has None Defined</rdfs:label> </rdfs:Property> </voc:term> </voc:Vocabulary> </rdf:RDF>
<?xml version="1.0"?> <!DOCTYPE uridef [ <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns"> <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema"> <!ENTITY dc "http://purl.org/dc/elements/1.1"> <!ENTITY dcterms "http://purl.org/dc/terms"> <!ENTITY dctype "http://purl.org/dc/dcmitype"> <!ENTITY xsd "http://www.w3.org/2001/XMLSchema"> <!ENTITY rdfq "http://sw.nokia.com/RDFQ-2"> ]> <rdf:RDF xmlns:rdf ="&rdf;#" xmlns:rdfs ="&rdfs;#" xmlns:dc ="&dc;/" xmlns:dcterms ="&dcterms;/" xmlns:dctype ="&dctype;/" xmlns:rdfq ="&rdfs;/" > <!-- Language must be equal to English: --> <rdfq:Query> <dc:language rdf:datatype="&xsd;#lang">en</dc:language> </rdfq:Query> <!-- Language must not be equal to English: --> <rdfq:Query> <dc:language> <rdfq:QValue> <rdfq:ne rdf:datatype="&xsd;#lang">en</dc:language> </rdfq:QValue> </dc:language> </rdfq:Query> <!-- Timestamp when last modified must occur between the specified timestamps (match exclusive): --> <rdfq:Query> <dcterms:modified> <rdfq:QValue> <rdfq:gt rdf:datatype="&xsd;#dateTime">2001-08-11T10:30:00Z</rdfq:gt> <rdfq:lt rdf:datatype="&xsd;#dateTime">2002-02-28T20:45:00Z</rdfq:lt> </rdfq:QValue> </dcterms:modified> </rdfq:Query> <!-- Timestamp when last modified must occur between, or be equal to one of the specified timestamps (match inclusive): --> <rdfq:Query> <dcterms:modified> <rdfq:QValue> <rdfq:ge rdf:datatype="&xsd;#dateTime">2001-08-11T10:30:00Z</rdfq:ge> <rdfq:le rdf:datatype="&xsd;#dateTime">2002-02-28T20:45:00Z</rdfq:le> </rdfq:QValue> </dcterms:modified> </rdfq:Query> <!-- Title must be defined: --> <rdfq:Query> <dc:title> <rdfq:QValue> <rdfq:any/> </rdfq:QValue> </dc:title> </rdfq:Query> <!-- Comment must not be defined: --> <rdfq:Query> <rdfs:comment> <rdfq:QValue> <rdfq:none/> </rdfq:QValue> </rdfs:comment> </rdfq:Query> <!-- Target must have a creator which has a first name of "John", a last name of "Doe" and have an age that is greater than 30: --> <rdfq:Query> <dc:creator> <rdf:Description> <person:firstName rdf:datatype="&xsd;#string">John</person:firstName> <person:lastName rdf:datatype="&xsd;#string">Doe</person:lastName> <person:age> <rdfq:QValue> <rdfq:gt rdf:datatype="&xsd;#integer">30</rdfq:gt> </rdfq:QValue> </person:age> </rdf:Description> </dc:creator> </rdfq:Query> <!-- Query sequence "template" for manditory/optional query pair, where the first query must perfectly match all manditory properties and the secondary query ranks the target resources according to how accurately they match the optional properties, and returns a description of the top ten ranking resources: --> <rdfq:QuerySeq> <rdf:li> <rdfq:Query> <rdfq:min_relevance rdf:datatype="&xsd;#integer">100</rdfq:min_relevance> <rdfq:max_return rdf:datatype="&xsd;#integer">500</rdfq:max_return> <!-- ... manditory properties ... --> </rdfq:Query> </rdf:li> <rdf:li> <rdfq:Query> <rdfq:max_return rdf:datatype="&xsd;#integer">10</rdfq:max_return> <!-- ... optional but desirable properties ... --> </rdfq:Query> </rdf:li> </rdfq:QuerySeq> <!-- Query sequence "template" for search/select query pair, where the first query must perfectly match all manditory properties and the secondary query selects the properties to be included in the description returned: --> <rdfq:QuerySeq> <rdf:li> <rdfq:Query> <rdfq:min_relevance rdf:datatype="&xsd;#integer">100</rdfq:min_relevance> <!-- ... manditory properties ... --> </rdfq:Query> </rdf:li> <rdf:li> <rdfq:Select> <!-- ... properties to be included in description of matched resources ... --> </rdfq:Select> </rdf:li> </rdfq:QuerySeq> <!-- E.g., for all resources where timestamp last modified between, or equal to the specified timestamps, limit the descriptions returned to statements specifying their title and creator: --> <rdfq:QuerySeq> <rdf:li> <rdfq:Query> <rdfq:min_relevance rdf:datatype="&xsd;#integer">100</rdfq:min_relevance> <dcterms:modified> <rdfq:QValue> <rdfq:ge rdf:datatype="&xsd;#dateTime">2001-08-11T10:30:00Z</rdfq:ge> <rdfq:le rdf:datatype="&xsd;#dateTime">2002-02-28T20:45:00Z</rdfq:le> </rdfq:QValue> </dcterms:modified> </rdfq:Query> </rdf:li> <rdf:li> <rdfq:Select> <dc:title/> <dc:creator/> </rdfq:Select> </rdf:li> </rdfq:QuerySeq>
Copyright (C) 1999-2003 Nokia