semi%automacally/modeling/ web/apis/to/create/linked/apis// · weatherreport windevent...

28
SemiAutoma+cally Modeling Web APIs to Create Linked APIs Mohsen Taheriyan, Craig A. Knoblock, Pedro Szekely, and Jose Luis Ambite USC Information Sciences Institute

Upload: others

Post on 04-Jul-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Semi%Automacally/Modeling/ Web/APIs/to/Create/Linked/APIs// · WeatherReport WindEvent TemperatureEvent WeatherObesrvation Station hasObservation hasStation hasWindEvent hasTemperatureEvent

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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