RDF Query Survey (original) (raw)

Abstract

This document provides a survey of RDF query language and implementations and describes their capabilities in terms described in RDF Query and Rules Framework. This list was taken from www-rdf-rules, , and the SWWS2001 query BOF. Web service-related examples come from a strawman WSDL RDF model proposed in another document. The rules languages included in this document are used only in a query capacity.

Libby Miller has written an RDF query syntax converter producing the queries from this survey. Andy Seaborne is working on an taxonomy for recording (and comparing) the results of these queries.

Status of This Document

This document has no formal standing in terms of the W3C 'recommendation track' standards process. It is the product of collaborative work in progress by the authors and contributors to www-rdf-rules list.

Table of Contents

ascii

The languages express the query in customized grammars. @@ These tend to be the tersest representations. @@

Algae2

Algae is a table-oriented query (and rules) language.

expressivity representation report style
arbitrary graph variable predicates literal evaluation node patterns optional arcs safe negation neg as failure RDF ascii aggregate graph bindings solution propositions source identification
+ + + - + + - - + + + + +

ns rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# ns wsdl=http://schemas.xmlsoap.org/wsdl/ ns wssoap=http://schemas.xmlsoap.org/wsdl/soap/ slurp http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf () ask (?service rdf:type wsdl:service. ?service wsdl:hasPort ?port. ?port wsdl:binding ?binding. ?binding wssoap:style wssoap:document. ?binding wsdl:name ?bindingName) collect (?port ?bindingName)

RDQL

RDQL is an SQL-like RDF query language derived from Squish.

expressivity representation report style
arbitrary graph variable predicates literal evaluation node patterns optional arcs safe negation neg as failure RDF ascii aggregate graph bindings solution propositions source identification
+ + + ? ? ? ? ? + - + - -

SELECT ?port, ?binding FROM http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf WHERE (?service rdf:type wsdl:service) (?service wsdl:hasPort ?port) (?port wsdl:binding ?binding) (?binding wsdl:name ?bindingName) (?binding wsdl:hasBinding ?x) (?x wssoap:style wssoap:document) USING wsdl FOR http://schemas.xmlsoap.org/wsdl/ , wssoap FOR http://schemas.xmlsoap.org/wsdl/soap/

There are implementations of RDQL for Jena (java), Sesame (java), PHPxmlclasses (PHP), and RDFStore (Perl). More examples at the sourceforge rdf-query site.

Squish

(described)

expressivity representation report style
arbitrary graph variable predicates literal evaluation node patterns optional arcs safe negation neg as failure RDF ascii aggregate graph bindings solution propositions source identification
+ + + ? ? ? ? ? + - + - -

SELECT ?port, ?binding FROM http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf WHERE (rdf::type ?service wsdl::service) (wsdl::hasPort ?service ?port) (wsdl::binding ?port ?binding) (wssoap::style ?binding wssoap::document) (wsdl::name ?binding ?bindingName) USING rdf for http://www.w3.org/1999/02/22-rdf-syntax-ns# wsdl for http://schemas.xmlsoap.org/wsdl/ wssoap for http://schemas.xmlsoap.org/wsdl/soap/

Inkling

Inkling is part of the Squish, RDQL family.

SELECT ?port, ?binding FROM http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf WHERE (rdf:type ?service wsdl:service) (wsdl:hasPort ?service ?port) (wsdl:binding ?port ?binding) (wssoap:style ?binding wssoap:document) (wsdl:name ?binding ?bindingName) USING rdf FOR http://www.w3.org/1999/02/22-rdf-syntax-ns# wsdl FOR http://schemas.xmlsoap.org/wsdl/ wssoap FOR http://schemas.xmlsoap.org/wsdl/soap/

RQL

(described)

select P1, B1 from #service.#hasPort{P1}.#binding{B1}.#style {SD}, {B1}#name where SD = "document"

TRIPLE

(described)

rdf := http://www.w3.org/1999/02/22-rdf-syntax-ns# . wsdl := http://schemas.xmlsoap.org/wsdl/ . wssoap := http://schemas.xmlsoap.org/wsdl/soap/ .

FORALL port, binding, service, bindingName <- rdf:type[service -> wsdl:service AND wsdl:hasPort[service -> port AND wsdl:binding[port -> binding AND wssoap:style[binding ->< wssoap:document AND wsdl:name[binding -> bindingName .

SeRQL

SeRQL is in the RDQL family with more SQL-like functions (for instance, aggregates). This specification has no way to define a datasource (eg http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf used in the other examples).

SELECT port, binding FROM {} rdf:type wsdl:service; wsdl:hasPort {port} {port} wsdl:binding {binding} wsdl:name {bindingName}; wsdl:hasBinding {} wssoap:style wssoap:document USING NAMESPACE rdf = <!http://www.w3.org/1999/02/22-rdf-syntax-ns#> , wsdl = <!http://schemas.xmlsoap.org/wsdl/> , wssoap = <!http://schemas.xmlsoap.org/wsdl/soap/>

KOAN

(described)

WITH wsdl AS 'http://www.wsdl.org#', wssoap AS 'http://www.wssoap.org#' ( [wsdl:Service) AND SOME(wsdl:hasPort.<wsdl:binding), SOME( wssoap:style, {!wssoap:document!} ) AND SOME( wsdl:name, [Root] ) )

From mail from Raphael Volz, 6 Mar 2003:

To obtain the other bindings, you have to issue other queries. Generally, at most two bindings can be returned to the user.

Buchingae

(described)

prefix rdf = http://www.w3.org/1999/02/22-rdf-syntax-ns#; prefix wsdl = http://schemas.xmlsoap.org/wsdl/; prefix wssoap = http://schemas.xmlsoap.org/wsdl/soap/; namespace = http://mknows.etri.re.kr/buchingae-ex001#;

rulebase rb001 { rule FindBindingName001 is if wsdl:service(?service) and wsdl:hasPort(?service,?port) and wsdl:binding(?port,?binding) and wssoap:style(?binding,wssoap:document) and wsdl:name(?binding,?bindingName) then answer(?service, ?bindingName); }

From mail from Minsu Jang, 8 Jan 2004

RDF (model)

These lanuages express the query as an RDF graph. Some expressly promote the use of other serializations for expressing the RDF data.

DQL

DQL is a proposal before the DAML+OIL joint committee. This example is abreviated, see the complete example.

expressivity representation report style
arbitrary graph variable predicates literal evaluation node patterns optional arcs safe negation neg as failure RDF ascii aggregate graph bindings solution propositions source identification
+ + + - - - - + - + - - -

<qa:Query rdf:ID="WQ8"> qa:queryPremisehttp://www.ksl.stanford.edu/DAML/query-answer/wines-short8.daml qa:queryPattern <qa:Conjunction rdf:ID="QP">

    <!-- ?service --rdf:type-- wsdl:service -->
<qa:conjunct>
  <qa:Triple rdf:ID="CJ1">
    <qa:predicate>
      <qa:PropertyConstant rdf:ID="P1">
    <qa:qName>
      <qa:QualifiedName rdf:ID="Q1">
        <qa:nsName>
          http://www.w3.org/1999/02/22-rdf-syntax-ns#
        </qa:nsName>
        <qa:localName>
          type
        </qa:localName>
      </qa:QualifiedName>
    </qa:qName>
      </qa:PropertyConstant>
    </qa:predicate>

        <qa:subject>
      <qa:Variable rdf:ID="S1">
    <qa:vName>
      ?service
    </qa:vName>
      </qa:Variable>
    </qa:subject>
    <qa:object>
         ...
    </qa:object>
  </qa:Triple>
</qa:conjunct>
<qa:conjunct>
      ...
</qa:conjunct>
<qa:conjunct>
      ...
</qa:conjunct>
<qa:conjunct>
      ...
</qa:conjunct>
<qa:conjunct>
      ...
</qa:conjunct>
  </qa:Conjunction>
</qa:queryPattern>

RDFQ

(described)

expressivity representation report style
arbitrary graph variable predicates literal evaluation patterns optional arcs neg as failure RDF ascii aggregate graph bindings solution propositions source identification

RDFQ defines antology to express queries. It leans on either RDFXML

rdfq:Query rdfq:select rdf:List rdf:firstport rdf:rest rdf:List rdf:firstbindingName <rdf:rest rdf:resource="" title="undefined" rel="noopener noreferrer">http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/> rdfq:target rdfq:Target rdfq:id service <rdf:type rdf:resource="" title="undefined" rel="noopener noreferrer">http://schemas.xmlsoap.org/wsdl/service"/> <wsdl:hasPort rdf:parseType="resource"> rdfq:id port <wsdl:binding rdf:parseType="resource"> <wsdl:name rdf:parseType="resource"> rdfq:id bindingName <wsdl:hasBinding rdf:parseType="resource"> <wssoap:style rdf:resource="" title="undefined" rel="noopener noreferrer">http://schemas.xmlsoap.org/wsdl/soap/document"/>

or Turtle

[ a rdfq:Query ; rdfq:select ( "port" "bindingName" ) ; rdfq:target [ rdf:type http://schemas.xmlsoap.org/wsdl/service ; wsdl:hasPort [ rdfq:id "port"; wsdl:binding [ wsdl:name [ rdfq:id "bindingName" ] ; wsdl:hasBinding [ wssoap:style http://schemas.xmlsoap.org/wsdl/soap/document ]]]]] .

or n3 (or algae, I guess) to serialize the query.

QEL

QEL (Query Exchange Language) has been developed as part of the Edutella project. It is used to distribute queries to various RDF repositories, where the query is transformed to the repository query language (e.g. SQL, RDQL). For simple queries (graph matching) a syntax in query-by-example style is provided:

]> <rdf:RDF xmlns:rdf="&rdf;" xmlns:edu="&edu;" xmlns:wsdl="&wsdl;" xmlns:wssoap="&wssoap;">

<edu:QEL1Query rdf:about="#sampleQuery"> edu:hasVariable <edu:Variable rdf:about="#SERVICE"/> edu:hasVariable <edu:Variable rdf:about="#PORT"/> edu:hasVariable <edu:Variable rdf:about="#BINDING"/> edu:hasVariable <edu:Variable rdf:about="#BINDINGNAME"/>

<wsdl:service rdf:about="#SERVICE"> wsdl:hasPort <rdf:Description rdf:about="#PORT"> wsdl:binding <rdf:Description rdf:about="#BINDING"> <wssoap:style rdf:resource="&wssoap;document"/> <wsdl:name rdf:resource="#BINDINGNAME"/>

A more powerful and verbose format is shown in the bottom of a contribution by Wolf Siberski.

RDF Database Access Protocol - Language

RDF Database Access Protocol Language is an SQL-like syntax designed to be familiar to programmers.

This exmaple is purely conjectural on my part and represents a guess at what Sandro's desired query format would be!

USE DATABASE http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf SELECT TRIPLE (service http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://schemas.xmlsoap.org/wsdl/service) AND TRIPLE (service http://schemas.xmlsoap.org/wsdl/hasPort port) AND TRIPLE (port http://schemas.xmlsoap.org/wsdl/bindingbinding") AND TRIPLE (binding http://schemas.xmlsoap.org/wsdl/soap/style http://schemas.xmlsoap.org/wsdl/soap/document) AND TRIPLE (binding http://schemas.xmlsoap.org/wsdl/name bindingName) RETURN port, bindingName

RDF Database Access Protocol - Model

The RDF Database Access Protocol Model is an early attempt to unify these syntaxes into a comprehensive model. It is believed to express algae and the RDAP language. The rest of the langueages will be checked presently. This example is abreviated, see the complete example.

<rdf:RDF xmlns:db="http://www.w3.org/2002/01/rdf-databases/db-ont-1#" xmlns:rei="http://www.w3.org/2002/01/rdf-databases/rei-ont-1#" xmlns:rdf="" title="undefined" rel="noopener noreferrer">http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rei:Constant rdf:ID="c_type"><rei:denotation rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#type" /> <rei:Constant rdf:ID="c_port"><rei:denotation rdf:resource="http://schemas.xmlsoap.org/wsdl/hasPort" /> <rei:Constant rdf:ID="c_binding"><rei:denotation rdf:resource="http://schemas.xmlsoap.org/wsdl/binding" /> <rei:Constant rdf:ID="c_style"><rei:denotation rdf:resource="http://schemas.xmlsoap.org/wsdl/soap/style" /> <rei:Constant rdf:ID="c_name"><rei:denotation rdf:resource="http://schemas.xmlsoap.org/wsdl/name" /> <rei:Constant rdf:ID="c_service"><rei:denotation rdf:resource="http://schemas.xmlsoap.org/wsdl/service" /> <rei:Constant rdf:ID="c_document"><rei:denotation rdf:resource="http://schemas.xmlsoap.org/wsdl/soap/document" /> <rei:Variable rdf:ID="v_service" rei:name="service" /> <rei:Variable rdf:ID="v_port" rei:name="port" /> <rei:Variable rdf:ID="v_binding" rei:name="binding" /> <rei:Variable rdf:ID="v_bindingName" rei:name="bindingName" /> <db:Conjunction rdf:ID="__cond"> <db:conjuncts rdf:parseType="daml:collection"> rei:Triple<rei:predicate rdf:resource="#c_type" /> <rei:subject rdf:resource="#v_service" /> <rei:object rdf:resource="#c_service" /> rei:Triple<rei:predicate rdf:resource="#c_port" /> <rei:subject rdf:resource="#v_service" /> <rei:object rdf:resource="#v_port" /> rei:Triple<rei:predicate rdf:resource="#c_binding" /> <rei:subject rdf:resource="#v_port" /> <rei:object rdf:resource="#v_binding" /> rei:Triple<rei:predicate rdf:resource="#c_style" /> <rei:subject rdf:resource="#v_binding" /> <rei:object rdf:resource="#c_document" /> rei:Triple<rei:predicate rdf:resource="#c_name" /> <rei:subject rdf:resource="#v_binding" /> <rei:object rdf:resource="#v_bindingName" /> <db:Query ID="q1"> <db:where rdf:resource="#__cond" /> db:minRows1 db:request db:Return <db:parts rdf:parseType="daml:collection"> <db:Return rdf:about="#v_port" /> <db:Return rdf:about="#v_bindingName" />

N3

N3 is a declarative logic language with a rich enough set of native functions that applications are written in N3 rather than using N3 to extract the data they need. @@ It may not belong under the heading of RDF (model) languages as the '{}'s go beyond the expressivity of RDF.

@prefix rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# . @prefix wsdl: http://schemas.xmlsoap.org/wsdl/ . @prefix wssoap: http://schemas.xmlsoap.org/wsdl/soap/ . @prefix agg: http://example.com/xmlns/aggregation-demo#.

this log:forAll :service, :port, :binding, :bindingName. { :service rdf:type wsdl:service. :service wsdl:hasPort :port. :port wsdl:binding :binding. :binding wssoap:style wssoap:document. :binding wsdl:name :bindingName). } log:implies { :service a agg:Q1Answer. :bindingName a agg:Q1Answer. } .

Note: the agg namespace properties come from smuch-query.n3.

XML with RDF extensions

XDD

XDD - XML Declarative Description (Representation Language)

<xdd:Clause rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" wsdl="http://schemas.xmlsoap.org/wsdl/" wssoap="http://schemas.xmlsoap.org/wsdl/soap/" xdd="" title="undefined" rel="noopener noreferrer">http://kr.cs.ait.ac.th/xdd"> xdd:Head <rdf:Description about="query_answer"> <wsdl:service about=$S:service_id> <wsdl:hasport about=$S:port_id/> <wsdl:binding about=$S:binding/>

xdd:Body wsdl:service <rdf:Description rdf:about=$S:service_id> wsdl:hasport <rdf:Description rdf:about=$S:port_id> wsdl:binding <rdf:Description rdf:about=$S:binding> <wssoap:style rdf:resource="wsdl:soapdocument"/> wsdl:name$S:bindingname $E:binding $E:port $E:service

RuleML

RuleML is an XML language for deduction, rewriting, and further inferential-transformational tasks. It is based on an extension of RDF/XML where the order of elements may be preserved. This example may also be expressed in pure RDF/XML.

<_body> <_opr> service <_opr> service port <_opr> port binding <_opr> binding <_opr> binding bindingName

XQuery with Functional Accessors

This XQuery syntax uses functional accessors to address the graph and match parts of statements.

{ let $doc := th:document('http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf') for portinport in portindoc/rdf-has-predicate-object(rdf:type, wsdl:service)/rdf-navigate-predicate(wsdl:hasPort)/* return { $port } { $port/rdf-navigate-predicate(wsdl:binding)/ rdf-navigate-object(*)/rdf-navigate-predicate(wsdl:hasBinding)/ rdf-navigate-object(*)/rdf-navigate-predicate(wssoap:style) [@rdf:resource='http://schemas.xmlsoap.org/wsdl/soap/document']/../../../wsdl:name/* } }

TreeHugger

TreeHugger is a recently developed use of XQuery syntax to access RDF data. It overloads the

declare namespace th = "java:net.rootdev.treehugger.TreeHugger"; declare namespace rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; declare namespace wsdl = "http://schemas.xmlsoap.org/wsdl/"; declare namespace wssoap = "http://schemas.xmlsoap.org/wsdl/soap/"; { let $doc := th:document('http://www.w3.org/2001/03/19-annotated-RDF-WSDL.rdf') for portinport in portindoc/wsdl:service/wsdl:hasPort/* return { $port } { $port/wsdl:binding//wsdl:hasBinding//wssoap:style[@rdf:resource='http://schemas.xmlsoap.org/wsdl/soap/document']/../../../wsdl:name/* } }

tell me about ...

Tell me about languages do not support an arbitrary graph pattern, but instead report a specific graph related to the subject of the query. The graph is defined by specification, profile, or convention.

Joseki something-or-other

(described)

Concise Bounded Descriptions

(described)

not done...

QinetiQ

QinetiQ was discusses briefly at the SWWS2001 query BOF. No more information was found.

sorry, no example yet

WebML

is a language for modeling complex web sites. It has a template-based language for querying XML that has been extended to query RDF.

sorry, no example yet

Summary

language name expressivity representation report style
arbitrary graph variable predicates literal evaluation node patterns optional arcs safe negation neg as failure RDF ascii aggregate graph bindings solution propositions source identification
algae + + + - + + - - + + + + +
DQL + + + - - - - + - + - - -
RDFQ + + + + + - + + + + + + +
RDQL + + + ? ? ? ? ? + - + - -
Squish + + + ? ? ? ? ? + - + - -

Todo

XET - XML Equivalent Transformation (Programming Language)

Versa

Obsolete Anchors

Language was updated to Algae2


Valid XHTML 1.0!

Eric Prud'hommeaux

Benjamin Grosof Id:Overview.html,v1.912004/04/2906:48:59ericExpId: Overview.html,v 1.91 2004/04/29 06:48:59 eric Exp Id:Overview.html,v1.912004/04/2906:48:59ericExp