0
Winter School on Knowledge Technologies for Complex Business Environments Linked Data and APIs Session 2: Linked APIs Stef...
Attribution <ul><li>Some Slides from </li></ul><ul><ul><li>Andreas Harth,  Barry Norton,  Sebastian Speiser, Cedric Mesnag...
Agenda <ul><li>Motivation </li></ul><ul><li>Preliminaries </li></ul><ul><ul><li>Hyper Text Transfer Protocol </li></ul></u...
Motivation <ul><li>Why do we care? </li></ul>12/02/11 Linked APIs
Motivation: Linked Open Data 12/02/11 Linked APIs
Motivation: Dynamic Data <ul><li>The Web today is not only about serving static data </li></ul><ul><ul><li>Data is often d...
Motivation: Triggering Functionalities <ul><li>The Web today offers functionalities that go beyond data and information: <...
Motivation: Triggering Functionalities <ul><li>The Web today offers functionalities that go beyond data and information: <...
Motivation <ul><li>Increased value comes from combinations of functionalities and APIs </li></ul><ul><ul><li>6300 Mashups ...
HTTP and REST <ul><li>Preliminaries </li></ul>12/02/11 Linked APIs
HTTP Overview <ul><li>HTTP, by which all documents on the WWW are served, is a client server protocol </li></ul><ul><ul><l...
HTTP Overview <ul><li>HTTP, by which all documents on the WWW are served, is a client server protocol </li></ul><ul><ul><l...
HTTP conneg and Linked Data URI Lookup <ul><li>A foundational issue in Linked Data was the distinction of URIs for real-wo...
HTTP conneg and Linked Data URI Lookup <ul><li>A foundational issue in Linked Data was the distinction of URIs for real-wo...
REST <ul><li>HTTP, maintained by IETF not W3C, is just one (primary) implementation of an architectural style called: </li...
Design guidelines <ul><li>LAPIS </li></ul>12/02/11 Linked APIs
Linked APIs (LAPIS) <ul><li>RESTful Web architecture </li></ul><ul><ul><li>resource-oriented </li></ul></ul><ul><ul><li>ma...
Linked APIs Guidelines <ul><li>Linked APIs come with a set of guiding principles: </li></ul><ul><ul><li>Describe APIs as L...
API Descriptions <ul><li>LAPIS </li></ul>12/02/11 1 Describe API input and output as  SPARQL graph patterns Linked APIs
Linked API Description <ul><li>LAPIS are (URI identified) Web functionalities, that </li></ul><ul><ul><li>Consume RDF data...
Linked API resource URI <ul><ul><li>This API is identified with the URI: </li></ul></ul>12/02/11 http://linkedapi.org/sn/g...
Linked API I/O Description <ul><ul><li>This API is identified with the URI: </li></ul></ul><ul><ul><li>Input and output de...
Linked API Description <ul><ul><li>This lapis is identified with the URI: </li></ul></ul><ul><ul><li>Input and output desc...
Linked API Description <ul><ul><li>This API is identified with the URI: </li></ul></ul><ul><ul><li>Accessible under e.g. <...
API Interaction <ul><li>LAPIS </li></ul>12/02/11 2 Communicate RDF  by RESTful content negotiation Linked APIs
Linked API interaction ?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y. ?y foaf:age ?age ?pic foaf:depicts ?y <ul><li>API...
Linked API Interaction 12/02/11 <ul><li>API is executed for every  “ pattern hit ”  in the input graph: </li></ul>ex:Steff...
Linked API Interaction 12/02/11 <ul><li>API is executed for every  “ pattern hit ”  in the input graph: </li></ul>ex:Steff...
Linked API Interaction 12/02/11 <ul><li>The patterns are constraining, but not defining the input and output: </li></ul>ex...
Linked API Interaction <ul><ul><li>✔ </li></ul></ul>12/02/11 <ul><li>The patterns are constraining, but not defining the i...
Linked API Interaction ex:Steffen foaf:knows ex:Günter.   ex:Günter foaf:age  “ 29 ” . <http://...> foaf:depicts ex:Günter...
Interlinking Data Sets with dynamic LAPIS data <ul><li>Use Cases: </li></ul><ul><li>Processing of static data set, using n...
Example: enriching CRM information  12/02/11 Linked APIs CRM Application    Customers #34 John Doe Address  #35 Steffen St...
LAPIS URIs to identify an API call 12/02/11 http://linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset...
LAPIS URIs to identify an API call 12/02/11 http://linkedapi.org/sn/getFriends http://linkedapi.org/sn/getFriends?x= “ ex:...
LAPIS URIs to identify an API call 12/02/11 http://linkedapi.org/sn/getFriends http://linkedapi.org/sn/getFriends?x= “ ex:...
LAPIS URIs to identify an API call <ul><li>Observation: For data-delivering APIs we can often identify a  “ central entity...
LAPIS URIs to identify an API call http://linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset we need ...
LAPIS URIs to identify an API call http:/linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset we need a...
Example: enriching CRM information  static data ex:Steffen a foaf:Person. ex:Steffen  sn:id  “ abcde ” . ex:Steffen owl:sa...
LAPIS URIs to identify an API call 12/02/11 ?x foaf:knows ?y. ?y foaf:age ?age. <ul><li>Include this API call URI in the L...
Semantics <ul><li>LAPIS </li></ul>12/02/11 3 The  output  should make  explicit  its  relation  with the  input . Linked A...
Looking at semantics <ul><li>Approaches to Semantic Web Services (e.g., SAWSDL 1 ) focused on a class based annotations of...
Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and ...
Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and ...
Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and ...
Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and ...
Leveraging the cloud to understand the API <ul><li>The graph patterns are not to be seen isolated, but in the context of t...
Wrapping techniques  <ul><li>LAPIS </li></ul>12/02/11 4 Make the  lifting/mapping open  as SPARQL CONSTRUCT  queries Linke...
Wrapping legacy APIs <ul><li>It is not reasonable to abandon all the Web APIs that already exist. </li></ul><ul><ul><li>In...
Wrapping legacy APIs <ul><li>LAPIS specifically address the problem of leveraging existing functionalities and exposing th...
Calling a LAPIS wrapper <ul><li>A LAPIS that wrapps an existing Web API acts as a semantic intermediary offering the origi...
Calling a LAPIS wrapper <ul><li>A LAPIS that wrapps an existing Web API acts as a semantic intermediary offering the origi...
Building the response <ul><li>Web APIs deliver structured (non semantic) data </li></ul><ul><ul><li>Most use JSON 1  or pr...
Building the response <ul><li>Web APIs deliver structured (non semantic) data </li></ul><ul><ul><li>Most use JSON 1  or pr...
Building the response <ul><li>First we change the syntax </li></ul><ul><ul><li>keys are properties </li></ul></ul><ul><ul>...
Building the response <ul><li>The so created RDF still misses any kind of semantic meaning </li></ul><ul><li>To transform ...
Building the response <ul><li>CONSTRUCTing real Linked Data out of the API reply tree: </li></ul>_:root temp:Person _:a. _...
Building the response <ul><li>CONSTRUCTing real Linked Data out of the API reply tree: </li></ul>_:root temp:Person _:a. _...
Building the response <ul><li>CONSTRUCTing real Linked Data out of the API reply tree: </li></ul>_:root temp:Person _:a. _...
Publish Lowering and Lifting Information <ul><li>The lowering SELECT and the lifting CONSTRUCT query represent the intuiti...
Publish Lowering and Lifting Information <ul><li>The lowering SELECT and the lifting CONSTRUCT query represent the intuiti...
Publish Lowering and Lifting Information <ul><li>The lowering SELECT and the lifting CONSTRUCT query represent the intuiti...
Real World Examples <ul><li>LAPIS </li></ul>12/02/11 Linked APIs
Real World Examples <ul><li>Linked Open Movies  </li></ul><ul><ul><li>http://linkedopenmovies.appspot.com  </li></ul></ul>...
Bing2RDF Web Form <ul><li>POST RDF Data via Web Form </li></ul>12/02/11 Linked APIs
Bing2RDF HTML Result <ul><li>Remember conneg: </li></ul><ul><li>Web Browser always asks for HTML </li></ul>12/02/11 Linked...
Use of another client <ul><li>>curl -X POST  </li></ul><ul><li>http://bing2rdf.appspot.com/Bing/getPictures  -T data.rdf -...
12/02/11 Linked APIs
12/02/11
Related Work <ul><ul><li>OWL-S: Ontology to describe Web Services </li></ul></ul><ul><ul><ul><li>Message parts are mapped ...
Summary <ul><li>The Web today is not only about static data: </li></ul><ul><ul><li>Data is created as a result of some cal...
<ul><li>Thank you </li></ul>12/02/11 Linked APIs
References <ul><ul><li>C. Pedrinaci, Dong Liu, Maria Maleshkova, Dave Lambert, Jacek Kopecky, and John Domingue. iServe:  ...
Discovery of LAPIS <ul><li>Appendix </li></ul>12/02/11 Linked APIs
The Idea: Linked APIs in the Cloud <ul><li>API Descriptions are in the LOD cloud interlinked with other data </li></ul><ul...
Discovery of Linked APIs <ul><li>Agents looking for APIs can use API templates as formalizations of user requirements and ...
Discovery as Graph Pattern Containment <ul><li>We define a number of metrics to provide for a continuum of matches and thu...
Discovery as Graph Pattern Containment Template: API Description: 12/02/11 Linked APIs { ?me a foaf:Person ; sn:id ?uid . ...
What about scalability? <ul><li>Hadoop is the open source implementation of Google MapReduce </li></ul><ul><ul><li>Allows ...
Evaluation <ul><li>To evaluate the scalability of the system for thousands of API descriptions and/or templates we generat...
Evaluation <ul><li>To evaluate the scalability of the system for thousands of API descriptions and/or templates we generat...
Evaluation seconds nodes 12/02/11 Linked APIs Nodes   sec mean (sec) standard deviation standard error 1 1. run 394 394.5 ...
Evaluation <ul><li>9 MapTasks can be executed </li></ul><ul><li>Between 1 and 5 worknodes: </li></ul><ul><ul><li>More MapT...
Evaluation <ul><li>This effect can be avoided by allowing for more MapTasks (i.e., smaller block size or more input data)....
Upcoming SlideShare
Loading in...5
×

Tutorial Linked APIs

1,378

Published on

Tutorial for the Winter School on Knowledge Technologies for Complex Business Environments ; Ljubljana, SLO, 1st December 2011

Published in: Technology, Education
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,378
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
35
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Calculation is not necessarily to be understood in a mathematical sense. Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • 2xx: ok 3xx:somewhere else 4xx: client error 5xx: server error Prof. Dr. Max Mustermann | Musterfakultät
  • Implicit knowledge – if you call a service with input ‚Vienna ‘ and get output ‚20C ‘ , the implicit knowledge is that 20C is the temperature at the last report in Vienna (+ provenenance = ‚ according to ... ‘ ) Prof. Dr. Max Mustermann | Musterfakultät
  • Also content negotiation: text/html -&gt; sn site Prof. Dr. Max Mustermann | Musterfakultät
  • NOTE hashtag!!! Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • HashTag! Because we need a non-information URI to identify the entity Prof. Dr. Max Mustermann | Musterfakultät
  • Remember pattern only constraining! Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Prof. Dr. Max Mustermann | Musterfakultät
  • Self explenation also leverages schemas from the LOD cloud Prof. Dr. Max Mustermann | Musterfakultät
  • Don ‘t confuse SELECT query with input pattern (subset relationship) Prof. Dr. Max Mustermann | Musterfakultät
  • Explain: worknode – namenode! Additionally: probabilities, that variables are used in certain positions Size of local and global resource and predicate pools to draw from Prof. Dr. Max Mustermann | Musterfakultät
  • 1-5: scales well. 5-8: no further decrease 10 worknodes: further, though diminishing decrease in time One maptask is very small Prof. Dr. Max Mustermann | Musterfakultät
  • Aiming at several mio Prof. Dr. Max Mustermann | Musterfakultät
  • Transcript of "Tutorial Linked APIs"

    1. 1. Winter School on Knowledge Technologies for Complex Business Environments Linked Data and APIs Session 2: Linked APIs Steffen Stadtmüller, AIFB, KSRI, Karlsruhe Institute of Technology, DE Ljubljana, SLO, December 1 st , 2011
    2. 2. Attribution <ul><li>Some Slides from </li></ul><ul><ul><li>Andreas Harth, Barry Norton, Sebastian Speiser, Cedric Mesnage; ESWC 2011 Linked Services Tutorial [Linked Data Services – LIDS] ; Crete, GR; May 30, 2011 </li></ul></ul><ul><ul><li>Barry Norton, Denny Vrandecic; IEEE SSSC 2011 Linked Data and Services; Berkeley, US; August 8, 2011 </li></ul></ul><ul><ul><li>Thank you! </li></ul></ul>12/02/11 Linked APIs
    3. 3. Agenda <ul><li>Motivation </li></ul><ul><li>Preliminaries </li></ul><ul><ul><li>Hyper Text Transfer Protocol </li></ul></ul><ul><ul><li>Representational State Transfer </li></ul></ul><ul><li>Linked APIs </li></ul><ul><ul><li>Design Guidelines </li></ul></ul><ul><ul><li>API Descriptions </li></ul></ul><ul><ul><li>API Interaction </li></ul></ul><ul><ul><li>Linked APIs Semantics </li></ul></ul><ul><ul><li>Wrapping Techniques </li></ul></ul><ul><ul><li>Real World Example </li></ul></ul><ul><li>Questions </li></ul>12/02/11 Linked APIs
    4. 4. Motivation <ul><li>Why do we care? </li></ul>12/02/11 Linked APIs
    5. 5. Motivation: Linked Open Data 12/02/11 Linked APIs
    6. 6. Motivation: Dynamic Data <ul><li>The Web today is not only about serving static data </li></ul><ul><ul><li>Data is often dynamically created as a result of some calculation carried out over input data </li></ul></ul><ul><li>Not all data sources will be published as fully materialized data sets: </li></ul><ul><ul><li>Data is changing constantly (e.g., sensor data or stock quotes) </li></ul></ul><ul><ul><li>Data is calculated based on infinitely many inputs (e.g. route between two geographical locations) </li></ul></ul><ul><ul><li>Provider does not want arbitrary access (e.g., flight ticket prices, social networks) </li></ul></ul>12/02/11 Linked APIs
    7. 7. Motivation: Triggering Functionalities <ul><li>The Web today offers functionalities that go beyond data and information: </li></ul><ul><ul><li>Service endpoints, forms and APIs are used to trigger functionalities in the web and the real world as well (e.g., ordering a pizza or solving a re-captcha) </li></ul></ul><ul><ul><li>Programmableweb.com lists ~4300 APIs 1 </li></ul></ul>1 http://programmableweb.com 12/02/11 Linked APIs
    8. 8. Motivation: Triggering Functionalities <ul><li>The Web today offers functionalities that go beyond data and information: </li></ul><ul><ul><li>Service endpoints, forms and APIs are used to trigger functionalities in the web and the real world as well (e.g., ordering a pizza or solving a re-captcha) </li></ul></ul><ul><ul><li>Programmableweb.com lists ~4300 APIs 1 </li></ul></ul><ul><li>But: they use heterogenous formats, mostly only textually described </li></ul><ul><li>Developers have to gain a deep understanding of every API and write individually tailored code to consume services in applications </li></ul>1 http://programmableweb.com 12/02/11 Linked APIs
    9. 9. Motivation <ul><li>Increased value comes from combinations of functionalities and APIs </li></ul><ul><ul><li>6300 Mashups on programmableweb.com </li></ul></ul><ul><ul><li>But a lot of manual effort is required for this compositions (glue code) </li></ul></ul><ul><ul><li>Structured API descriptions ease the composition process considerably </li></ul></ul><ul><ul><li>Semantic descriptions allow to execute several tasks automatically (e.g., data matching, discovery, repair) </li></ul></ul>Manually drafted glue code 12/02/11 Linked APIs Structured Semantic description Structured Semantic description Structured Semantic description
    10. 10. HTTP and REST <ul><li>Preliminaries </li></ul>12/02/11 Linked APIs
    11. 11. HTTP Overview <ul><li>HTTP, by which all documents on the WWW are served, is a client server protocol </li></ul><ul><ul><li>Every interaction is based on: </li></ul></ul><ul><ul><li>Request </li></ul></ul><ul><ul><ul><li>Method </li></ul></ul></ul><ul><ul><ul><ul><li>GET (retrieve entity identified by URI) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>PUT (store entity in body under the given URI) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>POST (submit the information in the body as a new subordinate of the resource URI) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>DELETE (delete entity identified by URI) </li></ul></ul></ul></ul><ul><ul><ul><li>URI </li></ul></ul></ul><ul><ul><ul><li>Header </li></ul></ul></ul><ul><ul><ul><li>[optional] Body (with POST, PUT) </li></ul></ul></ul>12/02/11 Linked APIs
    12. 12. HTTP Overview <ul><li>HTTP, by which all documents on the WWW are served, is a client server protocol </li></ul><ul><ul><li>Every interaction is based on: </li></ul></ul><ul><ul><li>Request </li></ul></ul><ul><ul><ul><li>Method </li></ul></ul></ul><ul><ul><ul><ul><li>GET </li></ul></ul></ul></ul><ul><ul><ul><ul><li>PUT </li></ul></ul></ul></ul><ul><ul><ul><ul><li>POST </li></ul></ul></ul></ul><ul><ul><ul><ul><li>DELETE </li></ul></ul></ul></ul><ul><ul><ul><li>URI </li></ul></ul></ul><ul><ul><ul><li>Header </li></ul></ul></ul><ul><ul><ul><li>[optional] Body (with POST, PUT) </li></ul></ul></ul>12/02/11 <ul><ul><li>Response </li></ul></ul><ul><ul><ul><li>Response Code (Integer) </li></ul></ul></ul><ul><ul><ul><li>Header </li></ul></ul></ul><ul><ul><ul><li>[optional] Body </li></ul></ul></ul>Linked APIs
    13. 13. HTTP conneg and Linked Data URI Lookup <ul><li>A foundational issue in Linked Data was the distinction of URIs for real-world objects versus documents (e.g., RDF) that might describe them </li></ul><ul><li>This can be handled in the HTTP Header together with content negotiation: </li></ul>HTTP GET http://dbpedia.org/resource/India Accept: text/N3 Client Web Server 303 (see other) http://dbpedia.org/data/india.n3 12/02/11 Linked APIs
    14. 14. HTTP conneg and Linked Data URI Lookup <ul><li>A foundational issue in Linked Data was the distinction of URIs for real-world objects versus documents (e.g., RDF) that might describe them </li></ul><ul><li>This can be handled in the HTTP Header together with content negotiation: </li></ul>HTTP GET http://dbpedia.org/resource/India Accept: text/html Client Web Server 303 (see other) http://dbpedia.org/page/india 12/02/11 Linked APIs
    15. 15. REST <ul><li>HTTP, maintained by IETF not W3C, is just one (primary) implementation of an architectural style called: </li></ul><ul><ul><li>REST = REpresentational State Transfe </li></ul></ul><ul><li>REST Principles: </li></ul><ul><ul><li>Application state and functionality is divided into resources </li></ul></ul><ul><ul><li>Every resource is uniquely addressable </li></ul></ul><ul><ul><li>All resources share a uniform interface: </li></ul></ul><ul><ul><ul><li>A constrained set of well-defined operations </li></ul></ul></ul><ul><ul><ul><li>A constrained set of content types </li></ul></ul></ul>12/02/11 Linked APIs
    16. 16. Design guidelines <ul><li>LAPIS </li></ul>12/02/11 Linked APIs
    17. 17. Linked APIs (LAPIS) <ul><li>RESTful Web architecture </li></ul><ul><ul><li>resource-oriented </li></ul></ul><ul><ul><li>manipulated with HTTP verbs </li></ul></ul><ul><ul><ul><li>GET, PUT, POST, DELETE </li></ul></ul></ul><ul><ul><li>Negotiate representations </li></ul></ul><ul><li>Linked data </li></ul><ul><ul><li>Uniform use of URIs </li></ul></ul><ul><ul><li>Use of RDF and SPARQL </li></ul></ul>… aim to promote a scalable and efficient style of APIs, by bringing together: 12/02/11 Linked APIs
    18. 18. Linked APIs Guidelines <ul><li>Linked APIs come with a set of guiding principles: </li></ul><ul><ul><li>Describe APIs as LOD prosumers with input and output descriptions as SPARQL graph patterns </li></ul></ul><ul><ul><li>Communicate RDF by RESTful content negotiation </li></ul></ul><ul><ul><li>The output should make explicit its relation with the input </li></ul></ul><ul><li>Associated with the last principle is an optional fourth: </li></ul><ul><ul><li>When wrapping non-Linked APIs, make the lifting/mapping open as SPARQL CONSTRUCT queries and make implicit knowledge explicit. </li></ul></ul>1 2 3 4 12/02/11 Linked APIs
    19. 19. API Descriptions <ul><li>LAPIS </li></ul>12/02/11 1 Describe API input and output as SPARQL graph patterns Linked APIs
    20. 20. Linked API Description <ul><li>LAPIS are (URI identified) Web functionalities, that </li></ul><ul><ul><li>Consume RDF data (input) </li></ul></ul><ul><ul><li>Carry out their function according to the input (e.g., retrieving dynamic data, trigger a real world effect…) </li></ul></ul><ul><ul><li>Produce RDF data (output) </li></ul></ul><ul><li>To describe the RDF data a LAPI expects as input and produces as output, we use the graph pattern formalism provided by the SPARQL query language </li></ul>12/02/11 Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    21. 21. Linked API resource URI <ul><ul><li>This API is identified with the URI: </li></ul></ul>12/02/11 http://linkedapi.org/sn/getFriends <ul><li>As an example consider a API that serves the friends of a person in a social network: </li></ul>Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    22. 22. Linked API I/O Description <ul><ul><li>This API is identified with the URI: </li></ul></ul><ul><ul><li>Input and output description: </li></ul></ul>12/02/11 http://linkedapi.org/sn/getFriends ?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y. ?y foaf:age ?age ?pic foaf:depicts ?y. <ul><li>As an example consider a API that serves the friends of a person in a social network: </li></ul>In: Out: Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    23. 23. Linked API Description <ul><ul><li>This lapis is identified with the URI: </li></ul></ul><ul><ul><li>Input and output description: </li></ul></ul>12/02/11 http://linkedapi.org/sn/getFriends ?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y. ?y foaf:age ?age. ?pic foaf:depicts ?y. <ul><li>Graph pattern can be included in RDF as (typed) literals. </li></ul>In: Out: sn:getFriends rdf:type msm:Service; sawsdl:modelReference [a msm:Precondition; rdf:value ” {?x a foaf:Person … } ” ], [a msm:Postcondition; rdf:value ” { ?x foaf:knows ?y … } ” ]. Embedded in RDF description Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    24. 24. Linked API Description <ul><ul><li>This API is identified with the URI: </li></ul></ul><ul><ul><li>Accessible under e.g. </li></ul></ul>12/02/11 <ul><li>RDF can be published, with the API resource URI referring to it </li></ul>http://linkedapi.org/sn/getFriends/description HTTP GET Accept: text/N3 200 (ok) HTTP GET Accept: text/N3 303* (see other) * optional http://linkedapi.org/sn/getFriends sn:getFriends rdf:type msm:Service; sawsdl:modelReference [a msm:Precondition; rdf:value ” {?x a foaf:Person … } ” ], [a msm:Postcondition; rdf:value ” { ?x foaf:knows ?y … } ” ]. Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    25. 25. API Interaction <ul><li>LAPIS </li></ul>12/02/11 2 Communicate RDF by RESTful content negotiation Linked APIs
    26. 26. Linked API interaction ?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y. ?y foaf:age ?age ?pic foaf:depicts ?y <ul><li>API Execution via HTTP POST: </li></ul><ul><ul><li>POST RDF data that matches the input pattern to the API resource </li></ul></ul><ul><ul><li>The API responds according to output pattern </li></ul></ul>In: Out: ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen foaf:knows ex:Günter. ex:Günter foaf:age “ 29 ” . <http://...> foaf:depicts ex:Günter. http://linkedapi.org/sn/getFriends HTTP POST Response match match 12/02/11 Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    27. 27. Linked API Interaction 12/02/11 <ul><li>API is executed for every “ pattern hit ” in the input graph: </li></ul>ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen sn:id “ 12345 ” . ex:Marko a foaf:Person. ex:Marko sn:id “ xyz ” . http://linkedapi.org/sn/getFriends HTTP POST ?x a foaf:Person. ?x sn:id ?id. In: match Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    28. 28. Linked API Interaction 12/02/11 <ul><li>API is executed for every “ pattern hit ” in the input graph: </li></ul>ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen sn:id “ 12345 ” . ex:Marko a foaf:Person. ex:Marko sn:id “ xyz ” . ex:Steffen foaf:knows ex:Günter. ex:Günter foaf:age “ 29 ” . <http://...> foaf:depicts ex:Günter. ex:Steffen foaf:knows ex:Roland. ex:Roland foaf:age “ 27 ” . <http://...> foaf:depicts ex:Roland. ex:Marko foaf:knows ex:Steffen. ... http://linkedapi.org/sn/getFriends HTTP POST Response ?x a foaf:Person. ?x sn:id ?id. In: Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    29. 29. Linked API Interaction 12/02/11 <ul><li>The patterns are constraining, but not defining the input and output: </li></ul>ex:Steffen a foaf:Person. http://linkedapi.org/sn/getFriends HTTP POST ?x a foaf:Person. ?x sn:id ?id. In: no hit Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    30. 30. Linked API Interaction <ul><ul><li>✔ </li></ul></ul>12/02/11 <ul><li>The patterns are constraining, but not defining the input and output: </li></ul>ex:Steffen a foaf:Person. ex:Steffen foaf:age “ 27 ” . ex:Steffen sn:id “ 12345 ” . http://linkedapi.org/sn/getFriends HTTP POST ?x a foaf:Person. ?x sn:id ?id. In: Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    31. 31. Linked API Interaction ex:Steffen foaf:knows ex:Günter. ex:Günter foaf:age “ 29 ” . <http://...> foaf:depicts ex:Günter. ex:Steffen foaf:knows ex:Roland. ex:Roland foaf:age “ 27 ” . <http://...> foaf:depicts ex:Roland. ex:Roland foaf:based_near “ Karlsruhe ” . http://linkedapi.org/sn/getFriends Response <ul><li>The pattern are constraining, but not defining the input and output </li></ul><ul><li>but they should be as precise as possible: </li></ul>?x foaf:knows ?y. ?y foaf:age ?age ?pic foaf:depicts ?y OPTIONAL (?y foaf:based_near ?loc) Out: 12/02/11 Linked APIs Linked APi Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    32. 32. Interlinking Data Sets with dynamic LAPIS data <ul><li>Use Cases: </li></ul><ul><li>Processing of static data set, using new interlinked set for further applications </li></ul><ul><li>Linked Data endpoint, enriching data before returning to client (server-side) </li></ul><ul><li>Linked Data browser, enriching data after retrieving it from server (client-side) </li></ul>12/02/11 Linked APIs
    33. 33. Example: enriching CRM information 12/02/11 Linked APIs CRM Application Customers #34 John Doe Address #35 Steffen Stadtmüller Address #36 Jane Doe Address #37 …. Roland Stühmer #12 Günter Ladwig - known relations: static data dynamic data ?
    34. 34. LAPIS URIs to identify an API call 12/02/11 http://linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset we need a GETable URI to identify it. </li></ul><ul><li>We extend the API URI with key/value pairs, where where every key represents a variable in the input graph pattern </li></ul>?x a foaf:Person. ?x sn:id ?id. In: Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    35. 35. LAPIS URIs to identify an API call 12/02/11 http://linkedapi.org/sn/getFriends http://linkedapi.org/sn/getFriends?x= “ ex:Steffen ” &id=abcde <ul><li>To link to a dynamic output dataset we need a GETable URI to identify it. </li></ul>HTTP GET ?x a foaf:Person. ?x sn:id ?id. In: When the URI is called (via HTTP GET), the values are bound to the corresponding variables in the pattern, and valid input is created. extend with k/v Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    36. 36. LAPIS URIs to identify an API call 12/02/11 http://linkedapi.org/sn/getFriends http://linkedapi.org/sn/getFriends?x= “ ex:Steffen ” &id=abcde <ul><li>To link to a dynamic output dataset we need a GETable URI to identify it. </li></ul>HTTP GET ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . extend with k/v ?x a foaf:Person. ?x sn:id ?id. In: Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    37. 37. LAPIS URIs to identify an API call <ul><li>Observation: For data-delivering APIs we can often identify a “ central entity ” , that is handled and described. </li></ul><ul><li>In such cases we can use the API call URI (+hashtag) itself to identify this entity </li></ul>12/02/11 http://linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset we need a GETable URI to identify it. </li></ul>ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen foaf:knows ex:Günter. ex:Günter foaf:age “ 29 ” . <http://...> foaf:depicts ex:Günter. Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    38. 38. LAPIS URIs to identify an API call http://linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset we need a GETable URI to identify it. </li></ul>http://linkedapi.org/sn/getFriends?id=abcde HTTP GET extend with k/v ?x a foaf:Person. ?x sn:id ?id . In: 12/02/11 Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    39. 39. LAPIS URIs to identify an API call http:/linkedapi.org/sn/getFriends <ul><li>To link to a dynamic output dataset we need a GETable URI to identify it. </li></ul>http://linkedapi.org/sn/getFriends?id=abcde HTTP GET extend with k/v <http://linkedapi.org/sn/getFriends?id=abcde#person> foaf:knows ex:Günter. ex:Günter foaf:age “ 29 ” . <http://...> foaf:depicts ex:Günter. Response 12/02/11 Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    40. 40. Example: enriching CRM information static data ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen owl:sameAs < http://linkedapi.org/sn/getFriends?id=abcde#person> . HTTP GET 12/02/11 Linked APIs CRM Application Customers #34 John Doe Address #35 Steffen Stadtmüller Address #36 Jane Doe Address #37 …. Roland Stühmer #12 Günter Ladwig - known relations: dynamic data
    41. 41. LAPIS URIs to identify an API call 12/02/11 ?x foaf:knows ?y. ?y foaf:age ?age. <ul><li>Include this API call URI in the LAPIS output, when appropriate and an another entity is used </li></ul><ul><ul><li>owl:sameAs, rdfs:seeAlso </li></ul></ul>Out: ex:Steffen foaf:knows ex:Günter. ex:Günter foaf:age “ 29 ” . ex:Steffen owl:sameAs < http://linkedapi.org/sn/getFriends?id=abcde#person> . http://linkedapi.org/sn/getFriends HTTP POST Response match Linked APIs Linked API Pattern Pattern Description (RDF+SPARQL) RDF in RDF out match match
    42. 42. Semantics <ul><li>LAPIS </li></ul>12/02/11 3 The output should make explicit its relation with the input . Linked APIs
    43. 43. Looking at semantics <ul><li>Approaches to Semantic Web Services (e.g., SAWSDL 1 ) focused on a class based annotations of service descriptions </li></ul><ul><li>But what does the service do? </li></ul><ul><ul><li>How Is the age in the output related to person from the input? </li></ul></ul><ul><ul><li>Does the output talk about the same person than the input? </li></ul></ul>1 http://www.w3.org/2002/ws/sawsdl/ Service Description Input: String Output: String, Integer 12/02/11 Linked APIs know Person Name Age ... Ontology has
    44. 44. Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and output: </li></ul><ul><ul><li>Explain the semantics of the calculation carried out over the input. </li></ul></ul><ul><ul><li>With what information is the input going to be enriched (data delivering API)? </li></ul></ul><ul><ul><li>What functionality was triggered by invoking the API? </li></ul></ul><ul><ul><li>How does the input influence the output (functionality or data)? </li></ul></ul><ul><li>Linked APIs achieve this by implying the relation over the variables in the graph patterns: </li></ul><ul><ul><li>Safe Variables </li></ul></ul><ul><ul><li>Unsafe Variables </li></ul></ul>?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y. ?y foaf:age ?age ?pic foaf:depicts ?y In: Out: 12/02/11 Linked APIs
    45. 45. Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and output: </li></ul><ul><ul><li>Explain the semantics of the calculation carried out over the input. </li></ul></ul><ul><ul><li>With what information is the input going to be enriched (data delivering API)? </li></ul></ul><ul><ul><li>What functionality was triggered by invoking the API? </li></ul></ul><ul><ul><li>How does the input influence the output (functionality or data)? </li></ul></ul><ul><li>Linked APIs achieve this by implying the relation over the variables in the graph patterns: </li></ul>?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y. ?y foaf:age ?age ?pic foaf:depicts ?y In: Out: „ The API will provide age and picture of someone X knows “ 12/02/11 Linked APIs
    46. 46. Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and output: </li></ul><ul><ul><li>Explain the semantics of the calculation carried out over the input. </li></ul></ul><ul><ul><li>With what information is the input going to be enriched (data delivering API)? </li></ul></ul><ul><ul><li>What functionality was triggered by invoking the API? </li></ul></ul><ul><ul><li>How does the input influence the output (functionality or data)? </li></ul></ul><ul><li>Linked APIs achieve this by implying the relation over the variables in the graph patterns: </li></ul>?x a foaf:Person. ?x sn:id ?id. ?y foaf:knows ?x . ?y foaf:age ?age ?pic foaf:depicts ?y In: Out: „ The API will provide age and picture of someone who knows X “ 12/02/11 Linked APIs
    47. 47. Looking at semantics <ul><li>To really understand the functionallity we need to understand the relation between input and output: </li></ul><ul><ul><li>Explain the semantics of the calculation carried out over the input. </li></ul></ul><ul><ul><li>With what information is the input going to be enriched (data delivering API)? </li></ul></ul><ul><ul><li>What functionality was triggered by invoking the API? </li></ul></ul><ul><ul><li>How does the input influence the output (functionality or data)? </li></ul></ul><ul><li>Linked APIs achieve this by implying the relation over the variables in the graph patterns: </li></ul>?x a foaf:Person. ?x sn:id ?id. ?x foaf:knows ?y . ?x foaf:age ?age ?pic foaf:depicts ?x In: Out: „ The API will provide age and picture of X and someone he knows “ 12/02/11 Linked APIs
    48. 48. Leveraging the cloud to understand the API <ul><li>The graph patterns are not to be seen isolated, but in the context of the LOD cloud </li></ul><ul><li>An agent (human and machine alike) can gain an undestanding of the API descriptions by resolving URIs in the pattern. </li></ul><ul><li>Additional knowledge (i.e., schema information) can be retrieved </li></ul>API A Output: ?x movie:actor ?y . API B Input: ?q a foaf:Person . HTTP GET movie:actor rdfs:range foaf:Person. 12/02/11 Linked APIs
    49. 49. Wrapping techniques <ul><li>LAPIS </li></ul>12/02/11 4 Make the lifting/mapping open as SPARQL CONSTRUCT queries Linked APIs
    50. 50. Wrapping legacy APIs <ul><li>It is not reasonable to abandon all the Web APIs that already exist. </li></ul><ul><ul><li>Introduction of semantics for Web APIs is based on a “ network effect ” : </li></ul></ul><ul><ul><li>The more LAPIS are publicly available, the more value can a provider gain from following the same standards </li></ul></ul><ul><li>When a developer wants to combine LAPIS with legacy services and APIs </li></ul><ul><ul><li>Instead of writing glue code he can wrap the non-LAPI and use it for other combinations </li></ul></ul><ul><ul><li>If the API is free, he can offer its functionality as a third-party to other developers </li></ul></ul>12/02/11 Linked APIs
    51. 51. Wrapping legacy APIs <ul><li>LAPIS specifically address the problem of leveraging existing functionalities and exposing them as LAPIS by recommending to </li></ul><ul><ul><li>publish how the functionality is semantically interpreted, </li></ul></ul><ul><ul><li>using LOD technologies </li></ul></ul>12/02/11 http://linkedapi.org/sn/getFriends HTTP GET / POST Response lowering lifting Linked APIs
    52. 52. Calling a LAPIS wrapper <ul><li>A LAPIS that wrapps an existing Web API acts as a semantic intermediary offering the original functions: </li></ul><ul><ul><li>The RDF submitted to the LAPIS is used to trigger the legacy API </li></ul></ul><ul><ul><li>The extraction of parameters to call the API happens with a SPARQL SELECT </li></ul></ul><ul><ul><li>The process of constructing non semantic data for API calls is referred to as „ Lowering “ </li></ul></ul><ul><ul><li>We leverage, that all APIs and REST services follow a fixed structure: </li></ul></ul><ul><ul><li>Example: </li></ul></ul>12/02/11 http://legacy.org/API/getFriends/Karlsruhe/abcde/ fixed endpoint variable part Linked APIs
    53. 53. Calling a LAPIS wrapper <ul><li>A LAPIS that wrapps an existing Web API acts as a semantic intermediary offering the original functions: </li></ul><ul><ul><li>The RDF submitted to the LAPIS is used to trigger the legacy API </li></ul></ul><ul><ul><li>The extraction of parameters to call the API happens with a SPARQL SELECT </li></ul></ul>12/02/11 ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen foaf:based_near “ Karlsruhe ” . SELECT ?loc ?user WHERE { ?so sn:id ?user ?so foaf:based_near ?loc } API Endpoint URI Karlsruhe, abcde http://legacy.org/API/getFriends/Karlsruhe/abcde/ HTTP POST Linked APIs
    54. 54. Building the response <ul><li>Web APIs deliver structured (non semantic) data </li></ul><ul><ul><li>Most use JSON 1 or proprietary XML </li></ul></ul><ul><ul><li>Both are serializations of a tree structure </li></ul></ul>12/02/11 1 Javascript Object Notation: http://json.org { „ Person “: { „ firstName “ : „Günter“, „ lastName “ : „Ladwig“, „ Age : 29, „ lives “: „Karlsruhe“ } „ Person “: { „ firstName “ : „Roland“, „ lastName “ : „Stühmer“, „ Age : 27, „ lives “: „Karlsruhe“ } } <xml> <Person> <firstName>Günter</firstName> <lastName>Ladwig</lastName> <Age>29</Age> <lives>Karlsruhe</lives> </Person> <Person> <firstName>Roland</firstName> <lastName>Stühmer</lastName> <Age>27</Age> <lives>Karlsruhe</lives> </Person> </xml> Linked APIs
    55. 55. Building the response <ul><li>Web APIs deliver structured (non semantic) data </li></ul><ul><ul><li>Most use JSON 1 or proprietary XML </li></ul></ul><ul><ul><li>Both are serializations of a tree structure </li></ul></ul>JSON/XML Person Person Karlsuhe Günter Ladwig 29 Roland ... A tree is also a graph! 12/02/11 Linked APIs
    56. 56. Building the response <ul><li>First we change the syntax </li></ul><ul><ul><li>keys are properties </li></ul></ul><ul><ul><li>values are objects (literals) </li></ul></ul>{ „ Person “: { „ firstName “ : „Günter“, „ lastName “ : „Ladwig“, „ Age : 29, „ lives “: „Karlsruhe“ } „ Person “: { „ firstName “ : „Roland“, „ lastName “ : „Stühmer“, „ Age : 27, „ lives “: „Karlsruhe“ } } @prefix temp: <http://linkedapi.org/dummy#>. _:root temp:Person _:a. _:a temp:firstName „Günter “. _:a temp:lastName „Ladwig “. _:a temp:Age „29 “. _:a temp:lives „Karlsruhe “. _:root temp:Person _:b. _:b temp:firstName „Roland “. _:b temp:lastName „Stühmer “. _:b temp:Age „27 “. _:b temp:lives „Karlsruhe “. json2rdf 12/02/11 Linked APIs
    57. 57. Building the response <ul><li>The so created RDF still misses any kind of semantic meaning </li></ul><ul><li>To transform it to real Linked Data a SPARQL CONSTRUCT query is used </li></ul><ul><li>The process of constructing semantic data out of a non semantic API or service response is referred to as „ Lifting “ </li></ul><ul><li>To make the implicit knowledge (i.e., the relation between input and output) of the API/service explicit, we combine it with the LAPIS input </li></ul>12/02/11 Linked APIs
    58. 58. Building the response <ul><li>CONSTRUCTing real Linked Data out of the API reply tree: </li></ul>_:root temp:Person _:a. _:a temp:firstName „Günter “. _:a temp:lastName „Ladwig “. _:a temp:Age „29 “. _:a temp:lives „Karlsruhe “. _:root temp:Person _:b. _:b temp:firstName „Roland “. _:b temp:lastName „Stühmer “. _:b temp:Age „27 “. _:b temp:lives „Karlsruhe “. ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen foaf:based_near “ Karlsruhe ” . <ul><li>All JSON values are literals, but sometimes we need to build a URI </li></ul><ul><li>SPARQL 1.1 offerns functions to transform strings, convert them in to a URI and bind it to a URI: </li></ul>CONSTRUCT { ?x foaf:knows ?q. ?q foaf:givenName ?gn. ?q foaf:familyName ?fn. ?q foaf:age ?age. ?q foaf:based_near ?loc. } WHERE { ?x a foaf:Person. ?x sn:id ?id. ?r temp:Person ?y. ?y temp:firstName ?gn. ?y temp:lastName ?fn. ?y temp:Age ?age. ?y temp:lives ?loc. BIND( URI( CONCAT(„http://... “, ?gn)) AS ?q) } 12/02/11 Linked APIs
    59. 59. Building the response <ul><li>CONSTRUCTing real Linked Data out of the API reply tree: </li></ul>_:root temp:Person _:a. _:a temp:firstName „Günter “. _:a temp:lastName „Ladwig “. _:a temp:Age „28 “. _:a temp:lives „Karlsruhe “. _:root temp:Person _:b. _:b temp:firstName „Roland “. _:b temp:lastName „Stühmer “. _:b temp:Age „27 “. _:b temp:lives „Karlsruhe “. ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen foaf:based_near “ Karlsruhe ” . CONSTRUCT { ?x foaf:knows ?q. ?q foaf:givenName ?gn. ?q foaf:familyName ?fn. ?q foaf:age ?age. ?q foaf:based_near ?loc. } WHERE { ?x a foaf:Person. ?x sn:id ?id. ?r temp:Person ?y. ?y temp:firstName ?gn. ?y temp:lastName ?fn. ?y temp:Age ?age. ?y temp:lives ?loc. BIND( URI( CONCAT(„http://... “, ?gn)) AS ?q) } <ul><li>All JSON values are literals, but sometimes we need to build a URI </li></ul><ul><li>SPARQL 1.1 offerns functions to transform strings, convert them in to a URI and bind it to a URI: </li></ul>BIND(URI(CONCAT(„http://example.org/people# “, ?gn)) AS ?q) BIND(URI( „http://example.org/people#Roland “) AS ?q) BIND( <http://example.org/people#Roland> AS ?q) „ Roland “ 12/02/11 Linked APIs
    60. 60. Building the response <ul><li>CONSTRUCTing real Linked Data out of the API reply tree: </li></ul>_:root temp:Person _:a. _:a temp:firstName „Günter “. _:a temp:lastName „Ladwig “. _:a temp:Age „28 “. _:a temp:lives „Karlsruhe “. _:root temp:Person _:b. _:b temp:firstName „Roland “. _:b temp:lastName „Stühmer “. _:b temp:Age „27 “. _:b temp:lives „Karlsruhe “. ex:Steffen a foaf:Person. ex:Steffen sn:id “ abcde ” . ex:Steffen foaf:based_near “ Karlsruhe ” . CONSTRUCT { ?x foaf:knows ?q. ?q foaf:givenName ?gn. ?q foaf:familyName ?fn. ?q foaf:age ?age. ?q foaf:based_near ?loc. } WHERE { ?x a foaf:Person. ?x sn:id ?id. ?r temp:Person ?y. ?y temp:firstName ?gn. ?y temp:lastName ?fn. ?y temp:Age ?age. ?y temp:lives ?loc. BIND( URI( CONCAT(„http://... “, ?gn)) AS ?q) } ex:Steffen foaf:knows ex:Günter. ex:Steffen foaf:knows ex:Roland. ex:Günter foaf:givenName „Günter “. ex:Günter foaf:familyName „Ladwig “. ex:Günter foaf:age „29 “. ex:Günter foaf:based_near „Karlsruhe “. ex:Roland foaf:givenName „Roland “. ex:Roland foaf:familyName „Stühmer “. ex:Roland foaf:age „27 “. ex:Roland foaf:based_near „Karlsruhe “. 12/02/11 Linked APIs
    61. 61. Publish Lowering and Lifting Information <ul><li>The lowering SELECT and the lifting CONSTRUCT query represent the intuition behind the semantic interpretation of the wrapped API/service </li></ul><ul><li>Therefore they should be published and a link included in the API description </li></ul>12/02/11 Linked API Web service function ‘ Lifting ’ ‘ Lowering ’ RDF in RDF out What is the semantic behind the parameters that have to be used to call the service/API? What is the semantic behind the data the service/API replies to a request? Linked APIs
    62. 62. Publish Lowering and Lifting Information <ul><li>The lowering SELECT and the lifting CONSTRUCT query represent the intuition behind the semantic interpretation of the wrapped API/service </li></ul><ul><li>Therefore they should be published and a link included in the API description </li></ul>12/02/11 sn:getFriends a msm:Service; sn:getFriends sawsdl:modelReference _:pre. _:pre a msm:Precondition. _:pre rdf:value ” {?x a foaf:Person … } ” . sn:getFriends sawsdl:modelReference _:post. _:post a msm:Postcondition; _:post rdf:value ” { ?x foaf:knows ?y ... } ” . sn:getFriends sawsdl:loweringSchemaMapping <http://linkedapi.org/sn/getFriends/lowerig.sparql>. sn:getFriends sawsdl:liftingSchemaMapping <http://linkedapi.org/sn/getFriends/lifting.sparql>. Linked APIs
    63. 63. Publish Lowering and Lifting Information <ul><li>The lowering SELECT and the lifting CONSTRUCT query represent the intuition behind the semantic interpretation of the wrapped API/service </li></ul><ul><li>Therefore they should be published and a link included in the API description </li></ul>sn:getFriends a msm:Service; sn:getFriends sawsdl:modelReference _:pre. _:pre a msm:Precondition. _:pre rdf:value ” {?x a foaf:Person … } ” . sn:getFriends sawsdl:modelReference _:post. _:post a msm:Postcondition; _:post rdf:value ” { ?x foaf:knows ?y ... } ” . sn:getFriends sawsdl:loweringSchemaMapping <http://linkedapi.org/sn/getFriends/lowerig.sparql>. sn:getFriends sawsdl:liftingSchemaMapping <http://linkedapi.org/sn/getFriends/lifting.sparql>. 12/02/11 CONSTRUCT { ?x foaf:knows ?q. ?q foaf:givenName ?gn. ?q foaf:familyName ?fn. ?q foaf:age ?age. ?q foaf:based_near ?loc. } WHERE { ?x a foaf:Person ... } SELECT ?loc ?user WHERE { ?so sn:id ?user ?so foaf:based_near ?loc } HTTP GET HTTP GET Linked APIs
    64. 64. Real World Examples <ul><li>LAPIS </li></ul>12/02/11 Linked APIs
    65. 65. Real World Examples <ul><li>Linked Open Movies </li></ul><ul><ul><li>http://linkedopenmovies.appspot.com </li></ul></ul><ul><ul><li>Search for movies via keyword string; provides rich information on the identified movies </li></ul></ul><ul><ul><li>Wraps API functionalities from themoviedb.org </li></ul></ul><ul><li>vocab.cc </li></ul><ul><ul><li>http://vocab.cc </li></ul></ul><ul><ul><li>RDF vocabulary search via keyword string; provides usage information of the identied classes and properties </li></ul></ul><ul><ul><li>Made from scratch </li></ul></ul><ul><li>bing2RDF </li></ul><ul><ul><li>http://bing2rdf.appspot.com </li></ul></ul><ul><ul><li>Picture search and meta information about the pictures </li></ul></ul><ul><ul><li>Wraps the Microsoft bing search API </li></ul></ul>12/02/11 Linked APIs
    66. 66. Bing2RDF Web Form <ul><li>POST RDF Data via Web Form </li></ul>12/02/11 Linked APIs
    67. 67. Bing2RDF HTML Result <ul><li>Remember conneg: </li></ul><ul><li>Web Browser always asks for HTML </li></ul>12/02/11 Linked APIs
    68. 68. Use of another client <ul><li>>curl -X POST </li></ul><ul><li>http://bing2rdf.appspot.com/Bing/getPictures -T data.rdf -H “Accept: text/N3” </li></ul>Linked APIs 12/02/11
    69. 69. 12/02/11 Linked APIs
    70. 70. 12/02/11
    71. 71. Related Work <ul><ul><li>OWL-S: Ontology to describe Web Services </li></ul></ul><ul><ul><ul><li>Message parts are mapped onto ontological concepts </li></ul></ul></ul><ul><ul><ul><li>Rules for decision points in processes </li></ul></ul></ul><ul><ul><li>Web Service Modeling Ontology (WSMO) [Roman et al.] </li></ul></ul><ul><ul><ul><li>similar to OWL-S, but broader scoped </li></ul></ul></ul><ul><ul><li>Minimal Service Model (MSM), iServe [Pedrinaci et. al] </li></ul></ul><ul><ul><ul><li>MSM a lightweight description with homogeneous view over WSDL and Web APIs </li></ul></ul></ul><ul><ul><ul><li>iServe: Centralized service repository </li></ul></ul></ul><ul><ul><li>RESTdesc: functional descriptions of REST APIs [Verborgh et.al </li></ul></ul><ul><ul><ul><li>Description in N3 (superset of RDF) </li></ul></ul></ul><ul><ul><ul><li>Also graph pattern based </li></ul></ul></ul><ul><ul><li>hRESTs and SA-REST [Kopecky] </li></ul></ul><ul><ul><ul><li>Class based annotation of HTML pages as REST API description </li></ul></ul></ul>Linked APIs 12/02/11
    72. 72. Summary <ul><li>The Web today is not only about static data: </li></ul><ul><ul><li>Data is created as a result of some calculation carried out over input data </li></ul></ul><ul><ul><li>Functionallities are offered that go beyond data and information </li></ul></ul><ul><li>To overcome problems arising out of heterogeneous formats Linked APIs as structured semantic descriptions offer a promising solution </li></ul><ul><ul><li>Based on successful Linked Data Technologies </li></ul></ul><ul><ul><li>Leveraging lightweight RESTful architecture </li></ul></ul><ul><li>Concretely LAPIS come with a set of guiding principles: </li></ul><ul><ul><li>Describe APIs as LOD prosumers with input and output descriptions as SPARQL graph patterns </li></ul></ul><ul><ul><li>Communicate RDF by RESTful content negotiation </li></ul></ul><ul><ul><li>The output should make explicit its relation with the input </li></ul></ul><ul><ul><li>When wrapping non-Linked APIs, make the lifting/mapping open as SPARQL CONSTRUCT queries and make implicit knowledge explicit. </li></ul></ul>Linked APIs 12/02/11
    73. 73. <ul><li>Thank you </li></ul>12/02/11 Linked APIs
    74. 74. References <ul><ul><li>C. Pedrinaci, Dong Liu, Maria Maleshkova, Dave Lambert, Jacek Kopecky, and John Domingue. iServe: a Linked Services Publishing Platform. In Proceedings of 1 st International Workshop on Ontology Repositories and Editors for the Semantic Web, ORES 2010, colocated with 7 Th ESWC, 2010. </li></ul></ul><ul><ul><li>J. Kopecky, K. Gomadam, and T. Vitvar. hRESTS: an HTML Microformat for Describing RESTful Web Services. In Proceedings of the 2008 IEEE/WIC/ACM International Conference on Web Intelligence (WI-08), Sydney, Australia, December 2008. </li></ul></ul><ul><li>S. Speiser and A. Harth. Integrating linked data and services with linked data services. In Proceedings of 8th Extended Semantic Web Conference, ESWC 2011, pages 170-184, 2011. </li></ul><ul><li>C. Pedrinaci, J. Domingue, and R. Krummenacher. Services and the Web of Data: An Unexploited Symbiosis. In AAAI Spring Symposium, March 2010. </li></ul><ul><li>D. Roman, U., Keller, H. Lausen, J. de Bruijn, R. Lara, M. Stollberg, A. Polleres, A., C. Feier, C. Bussler, D. Fensel, :Web Service Modeling Ontology. Applied Ontology 1(1), 77–106 (2005) </li></ul><ul><li>Barry Norton, Reto Krummenacher, Adrian Marte, and Dieter Fensel. Dynamic linked data via linked open services. Workshop on Linked Data in the Future Internet at the Future Internet Assembly , pages 1–10, 2010. </li></ul><ul><li>Barry Norton and Steffen Stadtmüller. Scalable discovery of linked services. In Proceedings of the Fourth International Workshop on REsource Discovery, volume 737, Heraklion, Greece, Mai 2011. REDWorkshop, CEUR-WS. </li></ul><ul><li>R. Verborgh, T. Steiner, D. Van Deursen, R. Van de Walle, J. Gabarr Valls, Efficient Runtime Service Discovery and Consumption with Hyperlinked RESTdesc ” ,, The 7th International Conference on Next Generation Web Services Practices (NWeSP 2011). </li></ul><ul><li>D. Fensel, H. Lausen, A. Polleres, J. de Bruijn, M. Stollberg, D. Roman, and J. Domingue. Enabling Semantic Web Services. Springer, 2006. </li></ul><ul><li>S. Speiser, A. Harth. Towards linked data services. In 9 th International Semantic Web Conference (ISWC2010) , November 2010. </li></ul><ul><li>S. Speiser, A. Harth. Taking the lids off data silos. In Proceedings of the 6th International Conference on Semantic Systems (iSemantics) . ACM International Conference Proceeding Series, 2010. </li></ul>12/02/11 Linked APIs
    75. 75. Discovery of LAPIS <ul><li>Appendix </li></ul>12/02/11 Linked APIs
    76. 76. The Idea: Linked APIs in the Cloud <ul><li>API Descriptions are in the LOD cloud interlinked with other data </li></ul><ul><ul><li>Descriptions of Linked APIs contain SPARQL Graph patterns to describe their functionality </li></ul></ul><ul><li>But how to match this functionality with user requirements and needs? </li></ul>{?me a foaf:Person} {?me foaf:knows ?x} 12/02/11 Linked APIs Input: Output:
    77. 77. Discovery of Linked APIs <ul><li>Agents looking for APIs can use API templates as formalizations of user requirements and constraints </li></ul><ul><ul><li>Syntactically equivalent to API descriptions (SPARQL graph patterns) </li></ul></ul><ul><ul><li>What input can they provide for invocation? (input pattern) </li></ul></ul><ul><ul><li>What do they expect as output? (output pattern) </li></ul></ul>Templates 12/02/11 Linked APIs Input Output
    78. 78. Discovery as Graph Pattern Containment <ul><li>We define a number of metrics to provide for a continuum of matches and thus for ranking of APIS: </li></ul><ul><ul><li>Predicate subset ratio (psr) </li></ul></ul><ul><ul><ul><li>To what degree are the used predicates in one pattern part of another? </li></ul></ul></ul><ul><ul><li>Resource subset ratio (rsr) </li></ul></ul><ul><ul><ul><li>To what degree are the named resources in subject or object position used in one pattern part of another? </li></ul></ul></ul><ul><ul><li>Direct Pattern Containment (dpc) </li></ul></ul><ul><ul><ul><li>One pattern is ASKed against a skolemized version of another. </li></ul></ul></ul><ul><ul><ul><li>This results in a binary matching decision. </li></ul></ul></ul>12/02/11 Linked APIs
    79. 79. Discovery as Graph Pattern Containment Template: API Description: 12/02/11 Linked APIs { ?me a foaf:Person ; sn:id ?uid . } { ?me foaf:knows [a foaf:person; foaf:name ?name; foaf:age ?age; foaf:openid ?oid] . } Input : Output : psr rsr dpc Input 0.5 1.0 NO Output 1.0 1.0 YES {?me a foaf:Person.} {?me foaf:knows [a foaf:Person; foaf:name ?name; foaf:age ?age] . } Input: Output:
    80. 80. What about scalability? <ul><li>Hadoop is the open source implementation of Google MapReduce </li></ul><ul><ul><li>Allows for parallel computation of the metrics on different nodes in a cluster (map), </li></ul></ul><ul><ul><li>combination of the metrics and ranking of the APIs (reduce) </li></ul></ul><ul><ul><li>on a distributed file system (HDFS). </li></ul></ul><ul><li>The metrics have to be calculated for every combination of subscribed templates and API descriptions in the cloud </li></ul>1 https://hadoop.apache.org 12/02/11 Linked APIs
    81. 81. Evaluation <ul><li>To evaluate the scalability of the system for thousands of API descriptions and/or templates we generate random graph patterns </li></ul>12/02/11 Linked APIs
    82. 82. Evaluation <ul><li>To evaluate the scalability of the system for thousands of API descriptions and/or templates we generate random graph patterns </li></ul><ul><li>Settings: </li></ul><ul><ul><li>One template matched over 10 000 API descriptions, </li></ul></ul><ul><ul><li>between 5 and 50 triple patterns per graph pattern, </li></ul></ul><ul><ul><li>on one, two, five, eight and ten (work)nodes </li></ul></ul><ul><ul><li>(additionally on every setup one machine as Namenode) </li></ul></ul><ul><ul><li>with a blocksize of 1MB </li></ul></ul><ul><ul><li>and a replication factor 3. </li></ul></ul><ul><ul><li>two runs (to account for fluctuations in network traffic) </li></ul></ul><ul><ul><li>3 x 8.19MB of data on 3 x 9 blocks </li></ul></ul><ul><ul><ul><li>9 map tasks are triggered </li></ul></ul></ul>12/02/11 Linked APIs
    83. 83. Evaluation seconds nodes 12/02/11 Linked APIs Nodes   sec mean (sec) standard deviation standard error 1 1. run 394 394.5 1.0 0.7 2. run 395 2 1. run 223 221 3.0 2.1 2. run 219 5 1. run 120 122 2.4 1.7 2. run 124 8 1. run 121 119 3.2 2.2 2. run 117 10 1. run 81 81.5 0.5 0.4 2. run 82
    84. 84. Evaluation <ul><li>9 MapTasks can be executed </li></ul><ul><li>Between 1 and 5 worknodes: </li></ul><ul><ul><li>More MapTasks can be executed simultaneously by adding more nodes. </li></ul></ul><ul><ul><li>Almost every worknode has to execute at least two MapTasks. </li></ul></ul><ul><li>5 and 8 worknodes: </li></ul><ul><ul><li>Namenode loses the possibility for load balancing to some extend. </li></ul></ul><ul><ul><li>Load balancing takes into account that the worknodes contain non-disjunctive subsets of the overall input data (locality is prefered), </li></ul></ul><ul><ul><li>but Hadoop prefers parallel computation over load locality. </li></ul></ul><ul><li>10 worknodes: </li></ul><ul><ul><li>The system can (and must) decide to disregard the least useful worknode </li></ul></ul>12/02/11 Linked APIs
    85. 85. Evaluation <ul><li>This effect can be avoided by allowing for more MapTasks (i.e., smaller block size or more input data). </li></ul><ul><li>But the observation shows, that the improvement in terms of execution speed can not only be attributed to the increase of computation resources (i.e., adding additional CPUs and memory with every worknode), but also to the strategic distribution and execution of matching sub-tasks. </li></ul>12/02/11 Linked APIs
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.

    ×