This document shows example executions of SPARQL queries that relying on web services. These use WSDL annotated with SPDL.
This is the work of the author — it is not endorsed by the W3C members.
This is a working excerpt of the Amazone Web Services WSDL currently used at Amazon. It shows:
Most of the elements are abbreviated. Hovering with the mouse or copying the region should get you the compete text.
<?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservices.amazon.com/AWSECommerceService/2004-11-10" xmlns:spat="http://dev.w3.org/cvsweb/perl/modules/W3C/SPDL/" targetNamespace="http://webservices.amazon.com/AWSECommerceService/2004-11-10"> <types> <xs:schema targetNamespace="http://webservices.amazon.com/AWSECommerceService/2004-11-10" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://webservices.amazon.com/AWSECommerceService/2004-11-10" elementFormDefault="qualified"> <xs:element name="ItemSearch"> <xs:complexType> <xs:sequence> <xs:element name="SubscriptionId" type="xs:string" minOccurs="0" spat:SPAT='?req tns:id xpath(".")'/> <xs:element name="Request" type="tns:ItemSearchRequest" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="ItemSearchRequest" spat:SPAT='?req tns:keywords xpath("tns:Keywords") ; tns:index xpath("tns:SearchIndex")'> <xs:sequence> <xs:element name="Keywords" type="xs:string" minOccurs="0"/> <xs:element name="SearchIndex" type="xs:string" minOccurs="0"/> <!-- xs:annotation><xs:appinfo><spat:SPAT> PATHPATTERN { ?req tns:keywords xpath("tns:Keywords") ; tns:index xpath("tns:SearchIndex") } # LIMIT xpath(tns:Count) # ORDER xpath(tns:Sort) </spat:SPAT></xs:appinfo></xs:annotation --> </xs:sequence> </xs:complexType> <xs:element name="ItemLookup"> <xs:complexType> <xs:sequence> <xs:element name="SubscriptionId" type="xs:string" minOccurs="0"/> <xs:element name="Request" type="tns:ItemLookupRequest" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="ItemLookupRequest"> <xs:sequence> <xs:element ref="tns:Condition" minOccurs="0"/> <xs:element name="FutureLaunchDate" type="xs:string" minOccurs="0"/> <xs:element name="IdType" minOccurs="0"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="ASIN"/> <xs:enumeration value="UPC"/> <xs:enumeration value="SKU"/> <xs:enumeration value="EAN"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="ISPUPostalCode" type="xs:string" minOccurs="0"/> <xs:element name="ItemId" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="ResponseGroup" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="SearchIndex" type="xs:string" minOccurs="0"/> </xs:sequence> </xs:complexType> <xs:element name="Condition"> <xs:simpleType> <xs:restriction base="xs:string"> <xs:enumeration value="All"/> <xs:enumeration value="New"/> <xs:enumeration value="Used"/> <xs:enumeration value="Collectible"/> <xs:enumeration value="Refurbished"/> </xs:restriction> </xs:simpleType> </xs:element> <xs:element name="MultiOperation"> <xs:complexType> <xs:sequence> <xs:element ref="tns:ItemSearch" minOccurs="0"/> <xs:element ref="tns:ItemLookup" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ItemSearchResponse"> <xs:complexType> <xs:sequence> <xs:element ref="tns:OperationRequest" minOccurs="0"/> <xs:element ref="tns:Items" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ItemLookupResponse"> <xs:complexType> <xs:sequence> <xs:element ref="tns:OperationRequest" minOccurs="0"/> <xs:element ref="tns:Items" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="OperationRequest"> <xs:complexType> <xs:sequence> <xs:element ref="tns:HTTPHeaders" minOccurs="0"/> <xs:element name="RequestId" type="xs:string" minOccurs="0"/> <xs:element ref="tns:Arguments" minOccurs="0"/> <xs:element ref="tns:Errors" minOccurs="0"/> <xs:element name="RequestProcessingTime" type="xs:float" minOccurs="0" maxOccurs="1"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Request"> <xs:complexType> <xs:sequence> <xs:element name="IsValid" type="xs:string" minOccurs="0"/> <xs:element name="ItemSearchRequest" type="tns:ItemSearchRequest" minOccurs="0"/> <xs:element name="ItemLookupRequest" type="tns:ItemLookupRequest" minOccurs="0"/> <xs:element ref="tns:Errors" minOccurs="0"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Arguments"> <xs:complexType> <xs:sequence> <xs:element name="Argument" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="Name" type="xs:string" use="required"/> <xs:attribute name="Value" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="HTTPHeaders"> <xs:complexType> <xs:sequence> <xs:element name="Header" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:attribute name="Name" type="xs:string" use="required"/> <xs:attribute name="Value" type="xs:string" use="required"/> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Errors"> <xs:complexType> <xs:sequence> <xs:element name="Error" maxOccurs="unbounded"> <xs:complexType> <xs:sequence> <xs:element name="Code" type="xs:string"/> <xs:element name="Message" type="xs:string"/> </xs:sequence> </xs:complexType> </xs:element> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Items"> <xs:complexType> <xs:sequence> <xs:element ref="tns:Request" minOccurs="0"/> <xs:element name="TotalResults" type="xs:nonNegativeInteger" minOccurs="0"/> <xs:element name="TotalPages" type="xs:nonNegativeInteger" minOccurs="0"/> <xs:element ref="tns:Item" minOccurs="0" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="Item"> <xs:complexType> <xs:sequence spat:SPAT='?item tns:asin xpath("tns:ASIN")'> <xs:element name="ASIN" type="xs:string"/> <!-- spat:SPAT='?item tns:asin xpath(".")'/ --> <xs:element ref="tns:Errors" minOccurs="0"/> <xs:element name="DetailPageURL" type="xs:string" minOccurs="0"/> <xs:element ref="tns:ItemAttributes" minOccurs="0"/> <!-- xs:annotation><xs:appinfo><spat:SPAT> PATHPATTERN { ?item tns:asin xpath("tns:ASIN") } </spat:SPAT></xs:appinfo></xs:annotation --> </xs:sequence> </xs:complexType> </xs:element> <xs:element name="ItemAttributes"> <xs:complexType> <xs:sequence> <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded"/> <xs:element name="Creator" minOccurs="0" maxOccurs="unbounded"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:string"> <xs:attribute name="Role" type="xs:string" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> <xs:element name="ProductGroup" type="xs:string" minOccurs="0"/> <xs:element name="Title" type="xs:string" minOccurs="0"/> <xs:annotation><xs:appinfo><spat:SPAT> PATHPATTERN { ?item tns:title xpath("tns:Title") } </spat:SPAT></xs:appinfo></xs:annotation> </xs:sequence> </xs:complexType> </xs:element> <xs:complexType name="NonNegativeIntegerWithUnits"> <xs:simpleContent> <xs:extension base="xs:nonNegativeInteger"> <xs:attribute name="Units" type="xs:string" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> <xs:complexType name="FloatWithUnits"> <xs:simpleContent> <xs:extension base="xs:float"> <xs:attribute name="Units" type="xs:string" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:schema> </types> <message name="ItemSearchRequestMsg"> <part name="body" element="tns:ItemSearch"/> </message> <message name="ItemSearchResponseMsg"> <part name="body" element="tns:ItemSearchResponse"/> </message> <message name="ItemLookupRequestMsg"> <part name="body" element="tns:ItemLookup"/> </message> <message name="ItemLookupResponseMsg"> <part name="body" element="tns:ItemLookupResponse"/> </message> <portType name="AWSECommerceServicePortType"> <operation name="ItemSearch"> <input message="tns:ItemSearchRequestMsg"/> <output message="tns:ItemSearchResponseMsg"/> </operation> <operation name="ItemLookup"> <input message="tns:ItemLookupRequestMsg"/> <output message="tns:ItemLookupResponseMsg"/> </operation> </portType> <binding name="AWSECommerceServiceBinding" type="tns:AWSECommerceServicePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="ItemSearch"> <soap:operation soapAction="http://soap.amazon.com"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="ItemLookup"> <soap:operation soapAction="http://soap.amazon.com"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="MultiOperation"> <soap:operation soapAction="http://soap.amazon.com"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="AWSECommerceService"> <port name="AWSECommerceServicePort" binding="tns:AWSECommerceServiceBinding"> <soap:address location="http://soap.amazon.com/onca/soap?Service=AWSECommerceService"/> <!-- soap:address location="http://localhost:8000/onca/soap?Service=AWSECommerceService"/ --> </port> </service> </definitions>
@@todo@@ add a discussion of the process model and the effects on the result set. Hare are some raw materials:
Find out if Amazon has the publictions listed in a book's bibliography.:
PREFIX amazon: <http://amazon...>
PREFIX citeseer: <http://citeseer...>
SELECT ?who ?mid
WHERE
{
GRAPH ?ep1
{
?book amazon:title "Databases for Dummies" .
?book amazon:author "C.J. Date" .
?book amazon:isbn ?isbn1
}
?service spdl:operation <http://amazon...> .
?service spdl:endPoint ?ep1
isbn |
---|
8 |
GRAPH ?citeseerep
{
?citation citeseer:isbn ?isbn1 .
?citation citeseer:title ?title .
?citation bin:author ?author
}
?service spdl:operation <http://citeseer...>
?service spdl:endPoint ?citeseerep
isbn | title | author |
---|---|---|
8 | foo | bob |
8 | bar | joe |
GRAPH ?ep1
{
?book amazon:title ?title .
?book amazon:author ?author
?book amazon:isbn ?isbn2
}
isbn | title | author | isbn2 |
---|---|---|---|
8 | foo | bob | 7 |
8 | bar | joe | 9 |
}
PREFIX amazon: <http://amazon...> PREFIX citeseer: <http://citeseer...> SELECT ?who ?mid WHERE { || || GRAPH ?ep1 { ?book amazon:title "Databases for Dummies" . ?book amazon:author "C.J. Date" . ?book amazon:isbn ?isbn1 } ?service spdl:operation <http://amazon...> . ?service spdl:endPoint ?ep1 |isbn1| |8 | GRAPH ?citeseerep { ?citation citeseer:isbn ?isbn1 . ?citation citeseer:title ?title . ?citation bin:author ?author } ?service spdl:operation <http://citeseer...> ?service spdl:endPoint ?citeseerep |isbn1|title|authr| |8 | foo | bob | |8 | bar | joe | GRAPH ?ep1 { ?book amazon:title ?title . ?book amazon:author ?author ?book amazon:isbn ?isbn2 } |isbn1|title|authr|isbn2| |8 | foo | bob | 7 | |8 | bar | joe | 9 | }
$Log: Examples.html,v $Revision 1.4 2006/07/15 00:01:36 eric~ nicole says the expansions look better in (justified) blocksRevision 1.3 2006/06/16 11:34:51 eric+ Example — annotated Amazon Web Services WSDL