Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent...
Transcript of Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent...
![Page 1: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/1.jpg)
Semi-‐Automa+cally Modeling Web APIs to Create Linked APIs
Mohsen Taheriyan, Craig A. Knoblock, Pedro Szekely, and Jose Luis Ambite USC Information Sciences Institute
![Page 2: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/2.jpg)
Slide by Shubham Gupta
dbpedia.org!
![Page 3: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/3.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Live weather
Slide by Shubham Gupta
not! dbpedia.org!
![Page 4: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/4.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Events Transparent Ci+es 5/1/2012 REDCAT Theater Saving Our Sons : A Community Conversa+o… …
Events
Slide by Shubham Gupta
not! dbpedia.org!
![Page 5: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/5.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Events Transparent Ci+es 5/1/2012 REDCAT Theater Saving Our Sons : A Community Conversa+o… …
TwiUer Feed Los Angeles becomes the largest U.S. city to ban.. Plas+c grocery bags will now be banned in … …
Live Twitter Feed
Slide by Shubham Gupta
not! dbpedia.org!
![Page 6: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/6.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Events Transparent Ci+es 5/1/2012 REDCAT Theater Saving Our Sons : A Community Conversa+o… …
TwiUer Feed Los Angeles becomes the largest U.S. city to ban.. Plas+c grocery bags will now be banned in … …
Slide by Shubham Gupta
But, the Information is Available in Web APIs ….
![Page 7: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/7.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Events Transparent Ci+es 5/1/2012 REDCAT Theater Saving Our Sons : A Community Conversa+o… …
TwiUer Feed Los Angeles becomes the largest U.S. city to ban.. Plas+c grocery bags will now be banned in … …
Slide by Shubham Gupta
![Page 8: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/8.jpg)
The Problem
? ?
JSON/XML
RDF
RDF/SPARQL Query
Web-‐service Invocation request http://free.worldweatheronline.com/feed/…. format=csv
Slide by Shubham Gupta
![Page 9: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/9.jpg)
Modeling APIs
• Input – Examples of the request URLs – Ontology
• Output – A semantic model of the API built interactively
Slide by Mohsen Taheriyan
![Page 10: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/10.jpg)
Approach
API Invocation
Annotating Inputs and
Outputs
Extracting Relationships
Slide by Mohsen Taheriyan
![Page 11: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/11.jpg)
Service Invoca+on KARMA
Sample Request URLs
Invoking API
Inputs Outputs Slide by Mohsen Taheriyan
![Page 12: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/12.jpg)
Annota+ng Inputs and Outputs • Using Conditional Random Fields (CRF) to assign a semantic type to each column
• Semantic Types – Class – Data property and domain
• Example – OWL Class: State
• http://dbpedia.org/page/California – OWL Data Property, Domain class: State.name
• Califonia
Slide by Mohsen Taheriyan
![Page 13: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/13.jpg)
WeatherReport
WindEvent
TemperatureEvent
WeatherObesrvation
Station
hasObservation
hasStation
hasWindEvent
hasTemperatureEvent hasDate
windSpeed
windDirection
SpatialThing
State City
hasLocation
in
temperature
dewPoint
humidity
description
name
icao
name
Weather Ontology
Slide by Mohsen Taheriyan
![Page 14: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/14.jpg)
WeatherReport
WindEvent
TemperatureEvent
WeatherObesrvation
Station
hasObservation
hasStation
hasWindEvent
hasTemperatureEvent
hasDate
windSpeed
windDirection
SpatialThing
State City
hasLocation
in
temperature
dewPoint
humidity description
name
icao
name
City.name
State.name
WeatherReport.hasDate
TemperatureEvent.temperature
TemperatureEvent.tempeature
WindEvent.windSpeed
WeatherObserva<on.humidity
WeatherObserva<on.descrip<on Sta<on.ICAO
Wrong Label
Slide by Mohsen Taheriyan
![Page 15: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/15.jpg)
Extrac+ng the Rela+onships • Construct a graph from
– Assigned Semantic Types – Ontology Graph
• Select minimal tree that connects all semantic types – A customized Steiner tree algorithm
• Steiner minimal tree (SMT) – G=(V,E) , S ⊂ V, c: E →ℜ (S: Steiner Nodes) – Shortest network connecting vertices of T – Approximation Alg. [Kou & Markowsky, 1981]
• O(|V|2|S|) , Approximation Ratio: less than 2
Slide by Mohsen Taheriyan
![Page 16: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/16.jpg)
Construc+ng Graph
WeatherReport WindEvent TemperatureEvent
WeatherObesrvation Station
State City
name name
hasDate icao
temperature
temperature windSpeed humidity
description
• Graph Initialization – Add one node for each semantic type – For data property types, also add the domain (if not added before)
Slide by Mohsen Taheriyan
![Page 17: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/17.jpg)
Construc+ng Graph • Compute Nodes Closure – Object Property or hasSubClass relations
SpatialThing Spa<alThing – hasSubClass City
WeatherReport WindEvent TemperatureEvent
WeatherObesrvation Station
State City
name name
hasDate icao
temperature
temperature windSpeed humidity
description
Slide by Mohsen Taheriyan
![Page 18: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/18.jpg)
WeatherReport
WindEvent
TemperatureEvent
WeatherObesrvation
Station
SpatialThing State City
Construc+ng Graph
name name
hasDate
icao
temperature
temperature
windspeed
hmidity
description
1 1
1 1
1
1
1 1
1
• Adding the Links – Put a link with w=1 from the domains to data property nodes – For every pair of class nodes like A and B:
• Put a link with w=1 from A to B if there is a direct or inferred object property in the ontology
• If B is a direct or inferred subclass of A, put a link with w=1/ε from A to B
hasLocation
in
1
1
1 1
1 1
1
1
1
1/ε 1/ε
Slide by Mohsen Taheriyan
![Page 19: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/19.jpg)
WeatherReport
WindEvent
TemperatureEvent
WeatherObesrvation
Station
SpatialThing State City
Steiner Tree
name name
hasDate
icao
temperature
temperature
windSpeed
HUMIDITY
description
1 1
1 1
1
1
1 1
1 1
1
1 1
1
1
1
1
1
Steiner Nodes: Semantic Types (Blue Ovals)
1/ε 1/ε
1
1 hasLocation
in
Wrong Link
Slide by Mohsen Taheriyan
![Page 20: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/20.jpg)
Visualizing Model in Karma
Slide by Mohsen Taheriyan
![Page 21: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/21.jpg)
Refinement – Change Seman+c Types
Slide by Mohsen Taheriyan
![Page 22: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/22.jpg)
Refinement – Adjust the links
Click on State
Slide by Mohsen Taheriyan
![Page 23: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/23.jpg)
Final Model in Karma
Slide by Mohsen Taheriyan
![Page 24: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/24.jpg)
Status
JSON/XML
RDF
RDF/SPARQL Query
Web-‐service Invocation request http://free.worldweatheronline.com/feed/…. format=csv
Karma
Slide by Pedro Szekely
![Page 25: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/25.jpg)
Generate Other Models?
Karma Model
MSM Model
LOS Model
LIDS Model
Slide by Pedro Szekely
![Page 26: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/26.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Challenge 1: Live Weather in DBPedia (For Every City)
Slide by Pedro Szekely
![Page 27: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/27.jpg)
Current temperature 73°F Wind 10 mph SW Humidity 51% Dew Point 54°
Challenge 2: Scale-‐Up
Slide by Pedro Szekely
![Page 28: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent](https://reader033.fdocuments.us/reader033/viewer/2022060504/5f1dac7a35fe102939442a9e/html5/thumbnails/28.jpg)