handson automating the use of web apis through lightweight semantics

15
Automating the Use of Web APIs -Hands-on Session- The Open University ICWE 2011, Paphos, Cyprus

Upload: mmaleshkova

Post on 11-May-2015

398 views

Category:

Technology


1 download

DESCRIPTION

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

TRANSCRIPT

Page 1: 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

Page 3: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 4: Handson Automating the Use of Web APIs through Lightweight Semantics

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/

Page 5: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 6: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 7: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 8: Handson Automating the Use of Web APIs through Lightweight Semantics

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’

Page 9: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 10: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 11: Handson Automating the Use of Web APIs through Lightweight Semantics

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!!!

Page 12: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 14: Handson Automating the Use of Web APIs through Lightweight Semantics

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

Page 15: Handson Automating the Use of Web APIs through Lightweight Semantics

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