A simple RDF query syntax converter

Copyright University of Bristol, 2003
2003-03-06
libby.miller@bristol.ac.uk

This is a tiny RDF api used at this stage for converting between RDF query syntaxes. See Eric Prud'hommeaux's page

It's open source, using the W3C license. The author is Libby Miller.

inkling.app.DifferentSyntaxes converts and saves the queries to the current directory. It uses an N-Triple query (in queries/nt/) and converts to Algae, Inkling (Squish), DQL, RuleML, N3. I can't vouch for the accuracy or generality of these translations at the moment. Comments are provided with the conversions.

Useage:

java -jar compareQueries-0.1.jar [filename]

where [filename] is an N Triple query in a ./queries/nt/ directory

or type

jar -xvf compareQueries-0.1.jar

and type

'make'

Results

These are quite likely incorrect - let me know.


/usr/bin/java -cp . inkling.app.DifferentSyntaxes 


syntaxes test
Converting to different syntaxes - see Eric Prud'hommeaux's work at http://www.w3.org/2001/11/13-RDF-Query-Rules/
URL file:queries/nt/ericp.nt
trying to read queries/nt/ericp.nt
QUERY 
_:service <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schemas.xmlsoap.org/wsdl/service> .
_:service <http://schemas.xmlsoap.org/wsdl/hasPort> _:port .
_:port <http://schemas.xmlsoap.org/wsdl/binding> _:binding .
_:binding <http://schemas.xmlsoap.org/wsdl/name> _:bindingName .


ALGAE
Can you have more than one graph? what does it look  like?
As it stands cannot pick variables, have shortened namespaces, as  well as not handling optional variables, constraints etc etc.



ALGAE version:
(ask '(file:rdf/19-annotated-RDF-WSDL.rdf
	(http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?service http://schemas.xmlsoap.org/wsdl/service
	(http://schemas.xmlsoap.org/wsdl/hasPort ?service ?port)
	(http://schemas.xmlsoap.org/wsdl/binding ?port ?binding)
	(http://schemas.xmlsoap.org/wsdl/name ?binding ?bindingName))
collect '(?service ?port ?binding ?bindingName))


saving to ericp.algae


N3:
This conversion does not do shortened namespaces or picking out the variables you want. I don't know if you can have source graph(s) in N3.



N3 version:
@prefix agg: .

this log:forAll :service, :port, :binding, :bindingName . 
{ 
 :service http://www.w3.org/1999/02/22-rdf-syntax-ns#type http://schemas.xmlsoap.org/wsdl/service .
 :service http://schemas.xmlsoap.org/wsdl/hasPort :port .
 :port http://schemas.xmlsoap.org/wsdl/binding :binding .
 :binding http://schemas.xmlsoap.org/wsdl/name :bindingName .
} log:implies {
:service a agg:QlAnswer . . 
:port a agg:QlAnswer . . 
:binding a agg:QlAnswer . . 
:bindingName a agg:QlAnswer .
} .


saving to ericp.n3


Inkling:
This conversion does not do shortened namespaces or picking out the variables you want.



INKLING version:
SELECT ?service, ?port, ?binding, ?bindingName
FROM file:rdf/19-annotated-RDF-WSDL.rdf
WHERE 
   (http://www.w3.org/1999/02/22-rdf-syntax-ns#type ?service http://schemas.xmlsoap.org/wsdl/service
   (http://schemas.xmlsoap.org/wsdl/hasPort ?service ?port)
   (http://schemas.xmlsoap.org/wsdl/binding ?port ?binding)
   (http://schemas.xmlsoap.org/wsdl/name ?binding ?bindingName)


saving to ericp.squish


RuleML:
This conversion does not do shortened namespaces or picking out the variables you want. Talking to Harold Boley, the syntax, while acceptable, can be done better.



RuleML version:
<?xml version="1.0" standalone="no"?> <!DOCTYPE rulebase SYSTEM 
"http://www.dfki.de/ruleml/dtd/0.8/ruleml-urdatalog.dtd"> 
<rulebase>
  <query>
    <_body>
      <and>
        <atom>
         <_opr><rel href="http://www.w3.org/1999/02/22-rdf-syntax-ns#type"><_opr>
         <var>service</var>
         <ind href="http://schemas.xmlsoap.org/wsdl/service"/>
        <atom>
         <_opr><rel href="http://schemas.xmlsoap.org/wsdl/hasPort"><_opr>
         <var>service</var>
         <var>port</var>
          </atom>
        <atom>
         <_opr><rel href="http://schemas.xmlsoap.org/wsdl/binding"><_opr>
         <var>port</var>
         <var>binding</var>
          </atom>
        <atom>
         <_opr><rel href="http://schemas.xmlsoap.org/wsdl/name"><_opr>
         <var>binding</var>
         <var>bindingName</var>
          </atom>
      </and>
    </_body>
  </query>
</rulebase>


saving to ericp.ruleml


DQL:
Uses more up to date version of the syntax: http://www.ksl.stanford.edu/projects/dql/syntax.shtml (from sandro).  http://www.daml.org/2002/08/dql/dql - can omit premise. Not sure: if we can have more than one KB; if can do xxx, xox, xoo, oox.




DQL:
Uses more up to date version of the syntax: http://www.ksl.stanford.edu/projects/dql/syntax.shtml (from sandro).  http://www.daml.org/2002/08/dql/dql - can omit premise. Not sure: if we can have more than one KB; if can do xxx, xox, xoo, oox.



DQL version:

<dql:query xmlns:dql="http://www.daml.org/2002/10/dql-syntax#" 
           xmlns:var="http://www.daml.org/2002/10/dql-variables#" 
           xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
           xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" 
           xmlns:daml="http://www.daml.org/2001/03/daml+oil#">
  <dql:queryPattern>
    <rdf:RDF>
      <rdf:Description rdf:about="http://www.daml.org/2002/10/dql-variables#service">
     <http://www.w3.org/1999/02/22-rdf-syntax-ns#type rdf:resource="http://schemas.xmlsoap.org/wsdl/service"/>
      </rdf:Description>
    </rdf:RDF>
  </dql:queryPattern>
  <dql:queryPattern>
    <rdf:RDF>
      <rdf:Description rdf:about="http://www.daml.org/2002/10/dql-variables#service">
         <http://schemas.xmlsoap.org/wsdl/hasPort rdf:resource="http://www.daml.org/2002/10/dql-variables#port"/>
      </rdf:Description>
    </rdf:RDF>
  </dql:queryPattern>
  <dql:queryPattern>
    <rdf:RDF>
      <rdf:Description rdf:about="http://www.daml.org/2002/10/dql-variables#port">
         <http://schemas.xmlsoap.org/wsdl/binding rdf:resource="http://www.daml.org/2002/10/dql-variables#binding"/>
      </rdf:Description>
    </rdf:RDF>
  </dql:queryPattern>
  <dql:queryPattern>
    <rdf:RDF>
      <rdf:Description rdf:about="http://www.daml.org/2002/10/dql-variables#binding">
         <http://schemas.xmlsoap.org/wsdl/name rdf:resource="http://www.daml.org/2002/10/dql-variables#bindingName"/>
      </rdf:Description>
    </rdf:RDF>
  </dql:queryPattern>
<dql:mustBindVars>
<http://www.daml.org/2002/10/dql-variables#service/>
<http://www.daml.org/2002/10/dql-variables#port/>
<http://www.daml.org/2002/10/dql-variables#binding/>
<http://www.daml.org/2002/10/dql-variables#bindingName/>
</dql:mustBindVars>
<dql:answerKBPattern>
<dql:kbRef rdf:resource="file:rdf/19-annotated-RDF-WSDL.rdf"/>
</dql:answerKBPattern>
</dql:query>


saving to ericp.dql