What are the titles and pages of some books on Weaving?
PREFIX aws: <http://dev.w3.org/cvsweb/perl/modules/W3C/SPDL/descriptions/AWSECommerceService-SAWSDL-item-terms.ttl#>
SELECT ?title ?page WHERE {
_:b aws:devID "0FWYBWB91M5S26YBE382" ;
aws:keywords "Weaving" ;
aws:index "Books" ;
aws:asin ?asin ;
aws:title ?title ;
aws:page ?page . }
The machine will discover and execute this for us...
... and generate requests:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/1999/XMLSchema"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
<ItemSearch xmlns="">
<SubscriptionId xsi:type="xsd:string">0FWYBWB91M5S26YBE382</SubscriptionId>
<Request>
<Keywords xsi:type="xsd:string">Weaving</Keywords>
<SearchIndex xsi:type="xsd:string">Books</SearchIndex>
</Request>
</ItemSearch>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
... and parse responses:
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
<SOAP-ENV:Body>
<ItemSearchResponse xmlns="http://webservices.amazon.com/AWSECommerceService/2005-10-05">
<Items>
<Item>
<ASIN>1883010039</ASIN>
<DetailPageURL>http://www.amazon.com/exec/obidos/redirect?tag=ws%26link_code=sp1%26camp=2025%26creative=165953%26path=http://www.amazon.com/gp/redirect.html%253fASIN=1883010039%2526tag=ws%2526lcode=sp1%2526cID=2025%2526ccmID=165953%2526location=/o/ASIN/1883010039%25253FSubscriptionId=0FWYBWB91M5S26YBE382</DetailPageURL>
<ItemAttributes>
<Author>Deborah Chandler</Author>
<Author>Debbie Redding</Author>
<ProductGroup>Book</ProductGroup>
<Title>Learning to Weave, Revised Edition</Title>
</ItemAttributes>
</Item>
...
SELECT ?tile WHERE { ?response aws:doctitle ?title }aws:ItemSearchResponse/aws:Items/aws:Item/aws:Title
<definitions><types><element name="ItemSearchResponse"></element></types>...
<message name="ItemSearchResponseMsg"/></definitions><xs:element name="Item"
spat:SPAT='?book aws:doctitle xpath("aws:Title")'/>
Very simple inference appears to model reasonable use cases.

<operation name="ItemSearch">
<input message="aws:ItemSearchRequestMsg"/>
<output message="aws:ItemSearchResponseMsg"/>
</operation>
for the annotations:
<xs:element name="ItemSearch"
spat:SPAT='?req aws:asin xpath("aws:ASIN")'>
...
<xs:element name="ASIN" type="xs:string" minOccurs="0"/>
...
</xs:element>
┌ op {http://webservices.amazon.com/AWSECommerceService/2004-11-10}ItemLookup:
│ fwrule ask(?req this:id XPath(., 91642dc) &&
│ ?req this:asin XPath(., 919d638))
│ assert(?req this:page _:<>:8.XPath(this:Items/this:Item/this:DetailPageURL, 91d37c8) &&
│ ?req this:reqId _:<>:9.XPath(., 9211c38) &&
│ ?req this:asin _:<>:10.XPath(aws:ASIN, 920b2b0) &&
│ ?req this:title _:<>:11.XPath(aws:Title, 9298a50))
│ -->{<qname:{http://webservices.amazon.com/AWSECommerceService/2004-11-10}ItemLookup>}The closure of the rules is now useful for answering user queries:
PREFIX tnss: <http://webservices.amazon.com/AWSECommerceService/2004-11-10>
SELECT ?title ?page WHERE {
_:b tnss:id "0FWYBWB91M5S26YBE382" ;
tnss:keywords "Weaving" ;
tnss:index "Books" ;
tnss:asin ?asin ;
tnss:doctitle ?title ;
aws:page ?page }
| title | page | _:b | asin |
|---|---|---|---|
XPath(aws:Title) | XPath(...PageURL) | _:22 | _:20.XPath(aws:ASIN) |
XPath(aws:Title) | XPath(...PageURL) | _:22 | _:10.XPath(aws:ASIN) |
The proofs of these rules illustrate how to invoke the services:
There's always more to play with...
