This document describes work on rapidly integrating web APIs into the linked data cloud. The researchers developed techniques for building semantic models of APIs, representing API descriptions in RDF, and creating linked APIs that can be invoked using RDF. They evaluated their approach on the Geonames API, generating a semantic model and linked description for several Geonames services in an average of 4 minutes per service. The work aims to help expose more web APIs as linked data to facilitate discovery and composition.
Rapidly Integrating Services into the Linked Data Cloud
1. Information Sciences Institute
Rapidly Integrating Services into the Linked
Data Cloud
Mohsen Taheriyan, Craig Knoblock,
Pedro Szekely, Jose Luis Ambite
11th International Semantic Web Conference (ISWC 2012)
Boston, USA
3. Not in dbpedia.org
Current temperature 73°F
Wind
Humidity
10 mph SW
51%
Live weather
Dew Point 54°
3
4. Not in dbpedia.org
Current temperature 73°F
Wind 10 mph SW
Humidity 51%
Dew Point 54°
Events Transparent Cities 5/1/2012 REDCAT
Events
Theater
Saving Our Sons : A Community
Conversatio…
…
4
5. Not in dbpedia.org
Current temperature 73°F
Wind 10 mph SW
Humidity 51%
Dew Point 54°
Events Transparent Cities 5/1/2012 REDCAT Theater
Saving Our Sons : A Community Conversatio…
…
Twitter Feed Los Angeles becomes the largest U.S. city to ban..
Plastic grocery bags will now be banned in … Live Twitter Feed
…
5
6. The information is
available in Web APIs
Current temperature 73°F
Wind 10 mph SW
Humidity 51%
Dew Point 54°
Events Transparent Cities 5/1/2012 REDCAT Theater
Saving Our Sons : A Community Conversatio…
…
Twitter Feed Los Angeles becomes the largest U.S. city to ban..
Plastic grocery bags will now be banned in …
…
6
7. Web APIs
7000 APIs: growth all times versus last year
API Growth, 08/23/2012
2011 2012
65 RDF
(Oct 2012)
JSON XML
API Protocols, 02/10/2012
API Data Formats, 03/08/2011
7
9. Motivation Example
For most of the Web APIs, only a textual description is available
neighbourhood?
RDF Input
<http://sws.geonames.org/5145067/>
a gn:Feature ;
wgs84:lat "40.78343" ;
wgs84:long "-73.96625" .
Invocation Example
9
10. Motivation Example
For most of the Web APIs, only a textual description is available
Most of the Web APIs do not consume or produce linked data (RDF)
<http://sws.geonames.org/5145067/>
RDF Input
<http://sws.geonames.org/5145067/>
Linked RDF
gn:neighbour [
a gn:Feature ;
a gn:Feature ; gn:name "Woodside";
wgs84:lat "40.78343" ;
gn:nearby [
wgs84:long "-73.96625" .
a gn:Feature ; gn:name “…-Queens";
gn:parentCountry [ …
Lowering
Lifting
Invocation Example
XML Response
10
11. Outline
• Rapidly Integrating APIs with the LD
– Building API Semantic Model
– Representing API Descriptions
– Building Linked APIs
• Evaluation
• Related Work
• Conclusion & Future Work
12. Outline
• Rapidly Integrating APIs with the LD
– Building API Semantic Model
– Representing API Descriptions
– Building Linked APIs
• Evaluation
• Related Work
• Conclusion & Future Work
13. The Semantic Model
wgs84 lat fcode nearb
geonames y
neighbour
long SpatialThing Feature
SubClass
Data Property parentFeature
Object Property alt countryCode name parentCountry
http://api.geonames.org/neighbourhood?
lat=40.78343&lng=-73.96625&username=demo
wgs84:lat wgs84:long
<geonames>
Feature Feature <neighbourhood>
gn:name
gn:neighbour <name>Central Park</name>
gn:nearby
gn:name
<city>New York City-Manhattan</city>
<countryCode>US</countryCode>
Feature
gn:countryCode <countryName>United States</countryName>
gn:parentCountry gn:name </neighbourhood>
</geonames>
Feature
14
14. The Semantic Model
wgs84 lat fcode nearb
geonames y
neighbour
long SpatialThing Feature
SubClass
Data Property parentFeature
Object Property alt countryCode name parentCountry
http://api.geonames.org/neighbourhood?
lat=40.78343&lng=-73.96625&username=demo
wgs84:lat wgs84:long
v2 <geonames>
Feature Feature <neighbourhood>
gn:name
gn:neighbour <name>Central Park</name>
v1 gn:nearby
gn:name
<city>New York City-Manhattan</city>
<countryCode>US</countryCode>
v3 Feature
gn:countryCode <countryName>United States</countryName>
gn:parentCountry gn:name </neighbourhood>
</geonames>
Feature
v4 15
15. Semi-Automatically Modeling APIs
Invoking
APIs
Examples of
Annotating
API Request
URLs
Karma Attributes
Previous
Modeling Work on
Modeling
Extracting Static
Domain Relationships Sources
Ontology
API
Semantic
Model
16
16. Invoking APIs
• User provides examples of the API request URLs
• Karma extracts the input values from the sample request URLs
• Karma invokes the API and extracts the output attributes from the
API response (XML/JSON)
Examples of API
Input Attributes Output Attributes
Invocation URLs
17
17. Annotating Inputs and Outputs
[Goel, Knoblock, Lerman, 2012]
• A CRF-based model to assign a Semantic Type to each
column from its data
• Semantic Type lat
long alt
– Ontology Class SpatialThing nearb
y
– Data Property + Domain name
neighbour
parentFeature
Feature
(wgs84:lat, gn:Feature) parentCountry
countryCode fcode
SubClass
Data Property
Object Property
wgs84
geonames
(wgs84:long,
(gn:name, gn:Feature)
gn:Feature)
(gn:countryCode, gn:Feature) 18
18. Extracting Relationships
[Knoblock et al., ESWC 2012]
• Construct a graph from semantic types and ontology graph
• Select minimal tree that connects all semantic types
– A customized Steiner tree algorithm
nearby
SpatialThing neighbour
parentFeature
parentCountry
wgs84:lat
gn:name
Feature Feature
wgs84:long
gn:countryCode
Feature Feature
gn:name gn:name
19. Extracting Relationships
[Knoblock et al., ESWC 2012]
• Construct a graph from semantic types and ontology graph
• Select minimal tree that connects all semantic types
– A customized Steiner tree algorithm
nearby
SpatialThing neighbour
parentFeature
parentCountry
wgs84:lat
neighbour
gn:name
Feature Feature
wgs84:long
nearby
gn:countryCode
Feature Feature
parentCountry
gn:name gn:name
21. Outline
• Rapidly Integrating APIs with the LD
– Building API Semantic Model
– Representing API Descriptions
– Building Linked APIs
• Evaluation
• Related Work
• Conclusion & Future Work
23. Example: Service Description
atom1 .../neighbourhood?lat={p1}&... GET neighbourhood
v1 hasMethod
hasAddress hasName
atom5
km:Service
http://<karma server>/services/ km:Output
atom2
atom3
v2
5C5CB6AB-1689-4A96-0B70- output
atom4
96C6A54F3D70#
hasModel hasAttribute
km:Input
input km:Model km:Attribute
outputModel out_name
hasAttribute hasModel name
hasAtom
arg2
lat
km:Attribute km:Model
inputModel swrl:PAtom property gn:name
p1 in_lat
atom4 arg1 swrl:Variable
hasAtom
arg2 v2
wgs84:lat arg1
swrl:CAtom
property
swrl:PAtom atom3 class gn:Feature
swrl:Variable arg1 atom2 arg2
v1
arg1 swrl:CAtom swrl:PAtom gn:neighbour
property
gn:Feature class atom1 atom5
links the output to the input
arg1 by neighbour relationship
24
24. Service Discovery
• Find services that return the neighbor feature
given the latitude and longitude
SELECT ?s WHERE {
?s km:hasInput [km:hasAttribute ?i1, ?i2].
?s km:hasOutput [km:hasAttribute ?o1].
?s km:hasInput [km:hasModel [km:hasAtom
[swrl:classPredicate gn:Feature; swrl:arg1 ?f1],
[swrl:propertyPredicate wgs84:lat; swrl:arg1 ?f1; swrl:arg2 ?i1],
[swrl:propertyPredicate wgs84:long; swrl:arg1 ?f1; swrl:arg2 ?i2]]].
?s km:hasOutput [km:hasModel [km:hasAtom
[swrl:classPredicate gn:Feature; swrl:arg1 ?f2],
[swrl:propertyPredicate gn:neighbour; swrl:arg1 ?f1; swrl:arg2 ?f2]]]}
27
25. Outline
• Rapidly Integrating APIs with the LD
– Building API Semantic Model
– Representing API Descriptions
– Building Linked APIs
• Evaluation
• Related Work
• Conclusion & Future Work
27. Lowering
:inputModel a km:Model; <http://sws.geonames.org/5145067/>
km:hasAtom a gn:Feature ;
[ a swrl:ClassAtom ; wgs84:lat "40.74538" ;
swrl:argument1 :v1 ; wgs84:long "-73.90541" .
swrl:classPredicate gn:Feature ] ;
km:hasAtom Input Data (RDF)
[ a swrl:IndividualPropertyAtom ;
swrl:argument1 :v1 ;
Attribute Value
swrl:argument2 :in_lat ;
swrl:propertyPredicate wgs84:lat ] ; in_lat 40.74538
... in_lng -73.90541
:in_lat a km:Attribute;
km:hasName "lat" ; Attribute Value GroundedIn
hrests:isGroundedIn "p1“
... in_lat 40.74538 p1
in_lng -73.90541 p2
...
hrests:hasAddress
“http://api.geonames.org/neighbourhood? http://api.geonames.org/neighbourhood?
lat={p1}&lng={p2}” lat40.74538&lng=-73.90541
Invocation URL
API Description (RDF)
31
28. Lifting
:out_countryCode a km:Attribute; <geonames>
API Response XML
km:hasName “countryCode" ; <neighbourhood>
.... <countryCode>US</countryCode>
<countryName>United States</countryName>
<city>New York City-Queens</city>
:outputModel a km:Model; <name>Woodside</name>
km:hasAtom ...
[ a swrl:IndividualPropertyAtom ; </neighbourhood>
swrl:argument1 :v1 ; </geonames>
swrl:argument2 :v2;
swrl:propertyPredicate Attribute Value URI
gn:neighbour ] ;
countryCode US :out_countryCode
km:hasAtom
[ a swrl:ClassAtom ; countryName United States :out_countryName
swrl:argument1 :v2 ; city ...-Queens :out_city
swrl:classPredicate gn:Feature ] ;
name Woodside :out_name
km:hasAtom
[ a swrl:IndividualPropertyAtom ;
<http://sws.geonames.org/5145067/>
Linked Output
swrl:argument1 :v2 ; gn:neighbour [
swrl:argument2 :out_name; a gn:Feature ; gn:name "Woodside";
swrl:propertyPredicate gn:name ] ; gn:nearby [
… a gn:Feature ; gn:name “…-Queens";
gn:parentCountry [ …
API Description (RDF)
33
29. Outline
• Rapidly Integrating APIs with the LD
– Building API Semantic Model
– Representing API Descriptions
– Building Linked APIs
• Evaluation
• Related Work
• Conclusion & Future Work
30. Evaluation
Geonames API #Examples #Columns Time (min)
neighbourhood 3 10 6
neighbours 2 9 5
children 2 10 3
sibling 1 9 3
ocean 2 3 1
findNearby 3 11 3
findNearbyPostalCodes 3 11 7
findNearbyPOIsOSM 3 7 3
findNearestAddress 3 14 6
findNearestIntersectionOSM 3 8 3
postalCodeCountryInfo 1 5 2
Total 26 97 42
Average 4 minutes to build a linked API
35
31. Related Work
• Linked Services [Pedrinaci & Domingue, 2010]
– Annotates inputs and outputs by concepts from
ontologies
– Publishes service descriptions into the LOD cloud using
Minimal Service Model (MSM)
– Cannot represent relationships between service
attributes
• Linked Open Services (LOS) [Krummenacher & Norton & Marte, 2010]
, Linked Data Services (LIDS) [Speiser & Harth, 2010]
– SPARQL graph patterns to describe inputs and outputs
– Service discovery is not straightforward
• RESTdesc [Verborgh et at, 2012]
– N3 logical rules to capture API functionality
36
32. Related Work
• Linked Services [Pedrinaci & Domingue, 2010]
– Annotates inputs and outputs by concepts from
ontologies
– Publishes service descriptions into the LOD cloud using
Minimal Service Model (MSM)
Karma semi-automatically builds service
– Cannot represent relationships between service
attributes
descriptions and the modeling process does not
• Linkedrequire expertise in SW technologies
Open Services (LOS) [Krummenacher & Norton & Marte, 2010]
, Linked Data Services (LIDS) [Speiser & Harth, 2010]
– SPARQL graph patterns to describe inputs and outputs
– Service discovery is not straightforward
• RESTdesc [Verborgh et at, 2012]
– N3 logical rules to capture API functionality
37
33. Discussion
• Rapidly build rich semantic models of services
• Publish service descriptions into the LD cloud
• Provide strong support for service discovery
and composition
• Build linked APIs that consume and produce
linked data
38
34. Future Work
• Apply our approach on REST-like URLs
– http://www.ex.com/weather/CA/Los Angeles
• Compose data and services in Karma
S1(address street, city, state, zipcode,) Composition
S2(city, state temperature, windspeed, …)
S3(zipcode, distance hotel, ranking)
39
35. More Information
• More information/papers/software/demos:
– http://www.isi.edu/integration/karma/
• Contact
– Mohsen Taheriyan: mohsen@isi.edu
– Craig Knoblock: knoblock@isi.edu
– Pedro Szekely: pszekely@isi.edu
– Jose Luis Ambite: ambite@isi.edu
40
Hinweis der Redaktion
http://blog.programmableweb.com/2012/08/23/7000-apis-twice-as-many-as-this-time-last-year/http://www.bogotobogo.com/WebTechnologies/OpenAPI_RESTful.phphttp://www.webmonkey.com/2011/03/thousand-of-apis-paint-a-bright-future-for-the-web/Only 69 APIs use RDF as data format (According to Programmable Web API Directory, Oct 20, 2012)Not all data sources will be published as fully materialized datasetsReasonsData is changing constantly (e.g., sensor data, stock quotes)Data is calculated based on infinitely many inputs (e.g., route between two geographical locations)Provider does not want arbitrary access (e.g., flight ticket prices, social networks)
Steiner minimal tree (SMT) G=(V,E) , S V, c: E (S: Steiner Nodes)Shortest network connecting vertices of SApproximation Alg. [Kou & Markowsky, 1981]O(|V|2|S|) , Approximation Ratio: less than 2Approximation ratio bounded by 2(1 − 1/l), where l is the number of leaves in the optimal Steiner tree.
Steiner minimal tree (SMT) G=(V,E) , S V, c: E (S: Steiner Nodes)Shortest network connecting vertices of SApproximation Alg. [Kou & Markowsky, 1981]O(|V|2|S|) , Approximation Ratio: less than 2Approximation ratio bounded by 2(1 − 1/l), where l is the number of leaves in the optimal Steiner tree.
A simple RDF vocabulary that represents both syntax and semantic of APIsKarma automatically generates service descriptions and stores them in a triple store called Linked API RepositoryService descriptions can be published into the Linked Data cloud
datasets of this paper:http://isi.edu/integration/karma/data/iswc2012
In the second step, instead of selecting MST ((v1, v4) – (v1, v2)- (v2-v3)), if we select another MST like ((v1, v4) – (v1, v2)- (v1-v3)), we would get another Steiner tree as result.MST = Minimum Spanning Tree