W3C logo
slanted W3C logo

SPARQL Annotations in WSDL

Simple/practical linkages of web services.


Eric Prud'hommeaux, Sanitation Engineer.
Last modified: $Date: 2010/12/06 16:10:09 $
Creative Commons License This work is licensed under a Creative Commons Attribution 3.0 License, with attribution to W3C.

Valid XHTML + RDFa

WS2: Work Package 2

Annotated Service Invocation

Execute (services described by) WSDL interfaces to answer user queries.

Procedure

Features

Features of SPARQL in WSDL (SPDL)

Connecting SPARQL to XML

Identifying information

Demo excerpts

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 ;
    tns:page ?page }
title page
"Learning to Weave, Revised Edition""http://...ASIN=1883010039..."
"Weaving Music into Young Minds with Education (Weaving Music Into Young Minds With Education)""http://...ASIN=0766800199..."
"Spin to Knit: The Knitter's Guide to Making Yarn""http://...ASIN=1596680075"
    

SAWSDL Specification

SAWSDL Specification

SPDL Expressed in SAWSDL

a sawsdl:loweringSchemaMapping:

      <xs:element name="Item">
        <!-- xs:complexType spat:SPAT='?book tns:doctitle xpath("aws:Title") -->
        <xs:complexType sawsdl:loweringSchemaMapping='&AWS;title'>
	  <xs:sequence>
	    <xs:element name="Author" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
	    <xs:element name="Title" type="xs:string" minOccurs="0"/>
	  </xs:sequence>
	</xs:complexType>
      </xs:element>

points to a document containing the SPDL annotations:

:id       spat:SPAT '?req :id xpath(".")' .
:keywords spat:SPAT '?req :keywords xpath("tns:Keywords") ; :index    xpath("tns:SearchIndex")' .
:asin     spat:SPAT '?book :asin xpath("tns:ASIN")' .
:title    spat:SPAT '?book tns:docTitle xpath("aws:Title")' .

Operation Rules

Very simple inference appears to model reasonable use cases.

Rule Construction Details

Rule Invocation Details

The ground facts from the users query:

PREFIX tns: <http://dev.w3.org/cvsweb/perl/modules/W3C/SPDL/descriptions/AWSECommerceService-SAWSDL-item-terms.ttl#>
SELECT ?title ?page WHERE {
_:b tns:id "0FWYBWB91M5S26YBE382" ;
    tns:keywords "Weaving" ;
    tns:index "Books" ... }

combined with a rule head:

┌ op {AWS:ItemSearch: 
│     fwrule ask(?req this:id XPath(., 8ae97f0) && 
│                ?req this:keywords XPath(tns:Keywords, 91b1d40) && 
│                ?req this:index XPath(tns:SearchIndex, 91b1d40))
│            assert(?req this:reqId _:19.XPath(., 92b17b0) && 
│                   ?req this:asin _:20.XPath(tns:ASIN, 92d6890) && 
│                   ?req this:title _:21.XPath(tns:Title, 93150e0))
│               -->{AWS:ItemSearch}

produce new inferences:

_:21 this:reqId _:19.XPath(., 92b17b0) .
_:21 this:asin _:20.XPath(tns:ASIN, 92d6890) .
_:21 this:title _:21.XPath(tns:Title, 93150e0) .

Rule Combination Details

The produce of one inference:

_:21 this:reqId _:19.XPath(., 92b17b0) .
_:21 this:asin _:20.XPath(tns:ASIN, 92d6890) .
_:21 this:title _:21.XPath(tns:Title, 93150e0) .

combined with another rule head:

┌ op {AWS:ItemLookup: 
│     fwrule ask(?req this:id XPath(., 91b1548) && 
│                ?req this:asin XPath(., 920be4c))
│            assert(?req this:page _:8.XPath(tns:Items/tns:Item/tns:DetailPageURL, 9127a6c) && 
│                   ?req this:reqId _:9.XPath(., 92b17b0) && 
│                   ?req this:asin _:10.XPath(tns:ASIN, 92d6890) && 
│                   ?req this:title _:11.XPath(tns:Title, 93150e0))
│               -->{AWS:ItemLookup}

produces new inferences:

_:22  this:page   _:8.XPath(this:Items/this:Item/this:DetailPageURL, 91d37c8) .
_:22  this:reqId  _:9.XPath(., 9211c38) .
_:22  this:asin   _:10.XPath(tns:ASIN, 920b2b0) .
_:22  this:title  _:11.XPath(tns:Title, 9298a50) .

Querying Rule Closure

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 ;
    tns:page ?page }
titlepage_:basin
XPath(tns:Title)
XPath(...PageURL)
_:22
_:20.XPath(tns:ASIN)
XPath(tns:Title)
XPath(...PageURL)
_:22
_:10.XPath(tns:ASIN)

Studying Proof Chain

The proofs of these rules illustrate how to invoke the services:

_:22 this:page XPath(...PageURL) .
-->{
[
fwrule ask(?req this:id XPath(.) && ?req this:asin XPath(.)) assert(?req this:page XPath(...PageURL) && ?req this:reqId _:9.XPath(.) && ?req this:asin _:10.XPath(tns:ASIN) && ?req this:title _:11.XPath(tns:Title)) -->{AWSECommerceService:ItemLookup}
_:22 this:asin _:20.XPath(tns:ASIN) .
-->{
[
fwrule ask(?req this:id XPath(.) && ?req this:keywords XPath(tns:Keywords) && ?req this:index XPath(tns:SearchIndex)) assert(?req this:reqId _:19.XPath(.) && ?req this:asin _:20.XPath(tns:ASIN) && ?req this:title XPath(tns:Title)) -->{AWSECommerceService:ItemSearch}
_:22 this:index "Books" .
-->{<>}
_:22 this:id "0FWYBWB91M5S26YBE382" .
-->{<>}
_:22 this:keywords "Weaving" .
-->{<>}
]
}
_:22 this:id "0FWYBWB91M5S26YBE382" .
-->{<>}
]
}

Invoking Rule Services

Documentation

Conclusions

Future Work

There's always more to play with...

Questions/Discussion

Impressions of the demonstrator.

Applicability to industry today and tomorrow.

Applicability to users today and tomorrow.

data flow/process details