handson automating the use of web apis through lightweight semantics
DESCRIPTION
ICWE 2011 Tutorial - Hands-onAutomating the Use of Web APIs through Lightweight Semantics Maria Maleshkova, Carlos Pedrinaci and Dong LiuTRANSCRIPT
Automating the Use of Web APIs -Hands-on Session-
The Open University
ICWE 2011, Paphos, Cyprus
Presenters
• Maria Maleshkova [email protected]
• Dong Liu [email protected]
• Carlos Pedrinaci [email protected]
Outline
• Web API Annotation– Web API annotation with SWEET
– Semantic description publishing in iServe
• Web API Discovery– Without lightweight semantics
– Service search in iServe
• Web API Invocation– Invocation with the Invocation Engine
Preparation for Hands-On
• The material shown in this session will be the basis for the hands-on session afterwards
• You’ll need Firefox• Tabulator extension for Firefox
– http://dig.csail.mit.edu/2007/tab/
Web API Annotation Hands-On
• The script for the Web API annotation hands-on is available at:– http
://iserve.kmi.open.ac.uk/wiki/index.php/Hands-on_Session
Web API Annotation with SWEET
• Open SWEET– http://sweetdemo.kmi.open.ac.uk/war/MicroWSMOeditor.html
• Open GeoNames WebService documentation– http://www.geonames.org/export/web-services.html
• Annotate the CountryCode operation
Annotation Steps
• Create Service property
– Rename it to ‘GeoNames’
• Create Operation property
– Rename it to ‘CountryCode’
• Create Input
• Create Output
• Create Address
– Rename address property (not the label itself) to
– http://api.geonames.org/countryCode
• Create HTTP Method
– Rename method property (not the label itself) to GET
Annotation Steps
• Create Parameter ‘lat’– Select the ‘lat’ string the double-click on ‘Parameter’
– Rename the parameter to ‘lat’
• Create Parameter ‘long’
• Create Parameter ‘username’
• Create Parameter ‘isoCode’
Model References
• Input– lat
• http://www.w3.org/2003/01/geo/wgs84_pos#lat
– long• http://www.w3.org/2003/01/geo/wgs84_pos#long
– username• http://purl.oclc.org/NET/WebApiAuthentication#Username
• Output– isoCode
• http://www.geonames.org/ontology#countryCode
Liftings and Lowerings
• Input lowering– http://people.kmi.open.ac.uk/ning/Schema/GeoNames/CountryC
odeLowering.txt
• Output lifting– http://people.kmi.open.ac.uk/ning/Schema/GeoNames/CountryC
odeLifting.txt
Publishing the Description
• Look at the annotated HTML by saving it to your local machine
• Look at the generated RDF by exporting it to you local machine
• Publish the description in the semantic Web service repository iServe
• http://iserve-dev.kmi.open.ac.uk/iserve– maria
– maria
– Note the service ID!!!
Web API Discovery Hands-On
• The script for the Web API annotation hands-on is available at:– http://iserve.kmi.open.ac.uk/wiki/index.php/
IServe_Higher_Level_Discovery_API
Invocation Example
• Test Invoke – http://iserve-dev.kmi.open.ac.uk/RestServiceInvoke/ServiceIn
voke/4619ca73-bb6e-4b99-8114-ad2e2cae3b60/CountryCode?rdfURL=http://iserve.kmi.open.ac.uk/exampleInput/DE.rdf
–Monitoring Example– http://iserve-dev.kmi.open.ac.uk:8080/RestInvoke/service/e
8f9548e-bbed-43fe-9d8a-71b7fdefb9da/operation/SearchListingsOperation/data
Invocation
• Look at you service description – http://iserve-dev.kmi.open.ac.uk/iserve/page/services/YOURS
ERVICEID
– http://iserve-dev.kmi.open.ac.uk/iserve/page/services/db4b646a-4665-4337-9626-4669cc8bce56
• Invocation URI– http://iserve-dev.kmi.open.ac.uk/RestServiceInvoke/
ServiceInvoke/{YOURSERVICEID} /{OperationName}?rdfURL={URLtoInputRDF}
– http://iserve-dev.kmi.open.ac.uk/RestServiceInvoke/ServiceInvoke/71879558-f1aa-40a1-8a11-5fd3c48a6cde/CountryCode?rdfURL=http://people.kmi.open.ac.uk/ning/Schema/GeoNames/GeoName_input_CY.rdf
Invocation
• Sample input RDF– http://iserve.kmi.open.ac.uk/exampleInput/FR.rdf
– http://iserve.kmi.open.ac.uk/exampleInput/CY.rdf
– http://iserve.kmi.open.ac.uk/exampleInput/BG.rdf
– http://iserve.kmi.open.ac.uk/exampleInput/DE.rdf
– http://iserve.kmi.open.ac.uk/exampleInput/GBR.rdf
• Compare results with– http://api.geonames.org/countryCode?
lat=XXXX&lng=YYYYY&username=mariam