Handson Automating the Use of Web APIs through Lightweight Semantics

Post on 11-May-2015

402 views 1 download

Tags:

description

ICWE 2011 Tutorial - Hands-onAutomating the Use of Web APIs through Lightweight Semantics Maria Maleshkova, Carlos Pedrinaci and Dong Liu

Transcript of Handson Automating the Use of Web APIs through Lightweight Semantics

Automating the Use of Web APIs -Hands-on Session-

The Open University

ICWE 2011, Paphos, Cyprus

Presenters

• Maria Maleshkova m.maleshkova@open.ac.uk

• Dong Liu d.liu@open.ac.uk

• Carlos Pedrinaci c.pedrinaci@open.ac.uk

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

• 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