This document describes the algorithms used to resolve SPARQL queries against SPDL patterns.
This document is part of the documentation for the SPDL project.
This is the work of the author — it is not endorsed by the W3C members.
The process examples in this document will use a query:
PREFIX tns: <http://webservices.amazon.com/AWSECommerceService/2004-11-10> SELECT ?asin ?title WHERE { ?X tns:id "0FWYBWB91M5S26YBE382" ; tns:keywords "Weaving" ; tns:index "Books" ; tns:asin ?asin ; tns:title ?title };
to invoke an Amazon Web Service annotated with SPDL.
The parsed web service gives you a set of invokers, each with an assocated set of input and output annotations. (Input and output names are designated from the perspective of the web service. This agent issues a request that comforms to some operation's input specification and parses a response conforming to the output specification.)
This rather naive approach involves an exact match between the submitted query and the input and output patterns of the matched web service.
assert(<var:?X> tns:id "0FWYBWB91M5S26YBE382" && <var:?X> tns:keywords "Weaving" && <var:?X> tns:index "Books" && <var:?X> tns:asin <var:?asin> && <var:?X> tns:title <var:?title>)
pattern(?req this:id XPath(., 9880444)) pattern(?req this:keywords XPath(tns:Keywords, 987b8a4) && ?req this:index XPath(tns:SearchIndex, 987b8a4)) pattern(?item this:asin XPath(tns:ASIN, 995d498)) pattern(?item this:title XPath(tns:Title, 9994f94))
<var:?req> <http://dev.w3.org/cvsweb/perl/modules/W3C/SPDL/descriptions/AWSECommerceService-SAWSDL-item-terms.ttl#id> <var:XPath(.,%209880444)> .to the user query database (the one with all the assertions mapped from the user's query).
ask(?req this:id XPath(., 9880444) && ?req this:keywords XPath(tns:Keywords, 987b8a4) && ?req this:index XPath(tns:SearchIndex, 987b8a4) && ?item this:asin XPath(tns:ASIN, 995d498) && ?item this:title XPath(tns:Title, 9994f94))and evaluate that query.
This should make sure that not only does the pattern match, but that all the IN variables correspond to ground values in the user query. For example, you may have access to bot a jpg2png and a png2jpg service and asking for the png of some jpg should invoke the correct one.
$Log: Algorithms.html,v $ Revision 1.1 2006/07/15 23:28:06 eric + started on a plane