31
KIT University of the State of Baden-Wuerttemberg and National Research Center of the Helmholtz Association Institute AIFB www.kit.edu Hypermedia APIs Semantic Web Services Done Right Andreas Harth STI Alumni Meeting 2015

ALUMNI 2015_Hypermedia APIs, Andreas Harth

Embed Size (px)

Citation preview

Page 1: ALUMNI 2015_Hypermedia APIs, Andreas Harth

KIT – University of the State of Baden-Wuerttemberg and

National Research Center of the Helmholtz Association

Institute AIFB

www.kit.edu

Hypermedia APIs – Semantic Web Services Done Right

Andreas Harth

STI Alumni Meeting 2015

Page 2: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 2 06.08.2015

Outline

Hyperlinks in Linked Data

Hyperlinks in Web APIs

Demo

Conclusion

Hypermedia APIs – Semantic Web Services Done Right

Page 3: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 3 06.08.2015

HYPERLINKS IN LINKED DATA

Hypermedia APIs – Semantic Web Services Done Right

Page 4: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 4 06.08.2015 Hypermedia APIs – Semantic Web Services Done Right

Ted Nelson,

Computer Lib/

Dream machines,

published 1974,

republished 1987

Page 5: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 5 06.08.2015

Conway‘s Law

“organizations which design systems ... are constrained to produce

designs which are copies of the communication structures of these

organizations”

-- Melvin Conway

Hypermedia APIs – Semantic Web Services Done Right Institute AIFB 5 06.08.2015

Page 6: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 6 06.08.2015

WSMX Architecture

Hypermedia APIs – Semantic Web Services Done Right

Page 7: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 7 06.08.2015

Doug Engelbart vs. Tim Berners-Lee

Daniel W. Connolly. An evaluation of the world wide web with respect

to Engelbart’s requirements. 2002. http://www.w3.org/Architecture/

NOTE-ioh-arch

Hypermedia APIs – Semantic Web Services Done Right

Page 8: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 8 06.08.2015 Hypermedia APIs – Semantic Web Services Done Right

The

Hyperdocument

„Back-Link

Capability“:

PASS

Page 9: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 9 06.08.2015 Hypermedia APIs – Semantic Web Services Done Right

The

Hyperdocument

„Library

System“:

PASS

Page 10: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 10 06.08.2015

Random Surfer Model

1. URI u_t0 := entry point

2. Lookup URI u_t

3. With probability d, u_t+1 := URI from document at random

4. With propability 1-d, get bored and u_t+1 := URI from the visited

pages

5. Goto 2

Lawrence Page, Sergey Brin, Rajeev Motwani, Terry Winograd,

The PageRank Citation Ranking: Bringing Order to the Web, TR

1999.

Hypermedia APIs – Semantic Web Services Done Right

Page 11: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 11 06.08.2015

Linked Data

HTTP URIs for things

Enable GET on URIs

Return links to other URIs

Hypermedia APIs – Semantic Web Services Done Right

Page 12: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 12 06.08.2015

Specifying Surfer Behaviour

1. URI u_t0 := entry point

2. HTTP GET on URI u_t

3. u_t+1 := Follow URI as specified in program

4. Goto 2

Hypermedia APIs – Semantic Web Services Done Right

Page 13: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 13 06.08.2015

Example

1. URI u_t0 := http://harth.org/andreas/foaf#ah

2. Lookup URI u_t

3. u_t+1 := Follow URI as specified in rules:

{ <http://harth.org/andreas/foaf#ah> foaf:knows ?x . } =>

GET (?x) .

4. Goto 2

Hypermedia APIs – Semantic Web Services Done Right

Page 14: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 14 06.08.2015

Rule-based Forward-chaining?

Distinction between source schema and mediated schema blurs

No source descriptions of Linked Data sources available

Syntactic restrictions are difficult to enforce in linked environments

OWL DL vs. OWL Full (Nicolas Matentzoglu and Bijan Parsia, The OWL

Full/DL gap in the field, OWLED 2014), rdfs:label cannot

Distinction between edb/idb predicates difficult with a single triple relation

Rewriting algorithms like magic sets rely on separation between edb and

idb predicates

Hypermedia APIs – Semantic Web Services Done Right

Page 15: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 15 06.08.2015

HYPERLINKS IN WEB APIS

Hypermedia APIs – Semantic Web Services Done Right

Page 16: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 16 06.08.2015

There is a Third Way…

Page 17: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 17 06.08.2015

Specifying Surfer Behaviour

1. URI u_t0 := entry point

2. Perform request on URI u_t

3. u_t+1 := User specifies next URI, including request method and

additional data to send

4. Goto 2

Page 18: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 18 06.08.2015

The HTML Web as Hypermedia System

order123/step-address

Servers provide a list of possible transitions (URI,

HTTP method, message format)

Page 19: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 19 06.08.2015

Transition Systems

Labelled Transition System is a pair (S, /\, ->)

Set S of states (RDF description of resources)

Set /\ of labels (unsafe requests - PUT, POST, DELETE - with optional

request message)

Set -> of state transitions (subset of S x S)

Servers provide /\ incrementally, so that clients can reach the next state

Clients cannot view farther than one step

Page 20: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 20 06.08.2015

State Transitions vs. Activities

RPC (Activities) could have a duration

RPC is problematic in networked enviroments where network

connection drops can happen

Instantanious state transitions (GET/PUT/POST/DELETE) on

resources identified via URIs fit with Web Architecture

Page 21: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 21 06.08.2015

Hypermedia Agents as State Machines

Start state: initial set of URIs U

End state: query/goal Q

Transitions: set of rules that describe the next relation (given current

state, what transition to carry out/what should hold in next state)

Page 22: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 22 06.08.2015

World State

World state is based on a set of resources identified via URIs

Transition systems describe how the state of the world can evolve over

time

We assume discrete time (digital signals)

„Stroboscopic“ world in which we poll the world state at defined

intervals (e.g., 60 Hertz, 16 2/3 ms)

Page 23: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 23 06.08.2015

Main Loop Intuition

while goal not reached:

• get the state of the world (including descriptions of possible next steps) via HTTP GET

• based on world state, decide on next step

• carry out next HTTP {PUT|POST|DELETE} request

Page 24: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 24 06.08.2015

Catalogue vs. Links

AI planning requires access to all activities

SWS: registry with service descriptions

Web: no central registry, but link-following

Google is a registry of sorts, but the Googlebot crawler follows links to

collect data

SWS Composition: given a set of descriptions D (with IOPE),

coordinator assembles process (sequence of activities/service calls)

Hypermedia: servers provide possible next steps based on current

state (describing I only)

Page 25: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 25 06.08.2015

DEMO

Page 26: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 26 06.08.2015

The Quintessential 3D Application

Tracking service

Application

logic

Sensor service

Request

Response

Ressource

Ressource

Ressource

Ressource

Ressource

Ressource

Ressource

Ressource

Ressource

Data source 2

Processes

Data source 1

3D Assets Simulation service

Ressource Ressource Ressource Ressource Ressource

Querverweise/

Links

Vocabularies

Request

Response

Re

qu

est

Re

spo

nse

Visualisation service

Output service

Vocabularies

Vocabula

ries

In ARVIDA, the focus is on execution, not planning

Page 27: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 27 06.08.2015

Simple Application Logic

Page 28: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 28 06.08.2015

Worker Processes

Page 29: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 29 06.08.2015

CONCLUSION

Page 30: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 30 06.08.2015

Conclusion

Hyperlinks + APIs + Rules

= Semantic Web Services done

right

Page 31: ALUMNI 2015_Hypermedia APIs, Andreas Harth

Institute AIFB 31 06.08.2015

Image Credits

Title page: http://matthewjamestaylor.com/blog/experimenting-with-visited-links

Linking Open Data cloud diagram 2014, by Max Schmachtenberg, Christian

Bizer, Anja Jentzsch and Richard Cyganiak. http://lod-cloud.net/

CERN LHC image via http://www.xatakaciencia.com/fisica/el-lhc-descubre-dos-

nuevas-particulas-que-nunca-se-habian-visto-antes

Hypermedia APIs – Semantic Web Services Done Right