École d’Été Web Intelligence 2013 - Web des Objets September 4 th 2013, St. Germain au Mont d’Or Simon Mayer, ETH Zurich Service Integration in the Web of Things
Jan 19, 2015
Service Integration in the Web of Things 1|Simon Mayer
http://people.inf.ethz.ch/mayersi
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Service Integration in the Web of Things
Service Integration in the Web of Things 2|Simon Mayer
http://people.inf.ethz.ch/mayersi
MyselfSimon Mayer, PhD Student at ETH Zurich, WoT since 2009
www.cloud-think.com
Example: Sensor Platforms
Sensors: Temperature, Ambient Light, Accelerometer
Actuators: 8 LEDs, Analog Outputs (e.g., motor controller)
Example: Smart Cars
Sensors: Speed, GPS, Fuel Consumption, Total KM
Actuators: Unlock, Start, Accelerate, Brake
Service Integration in the Web of Things 11|Simon Mayer
http://people.inf.ethz.ch/mayersi
Services measure or actuate values in the real, physical
world. They are provided by smart things
Smart environments allow well-informed decisions
Umbrella lights up if the forecast shows rain
Smart environments can perform complex tasks
Example: Music stream that follows the user
Service Integration and the Web of Things
Service Integration in the Web of Things 12|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Things can already do powerful tasks by themselves…
Service Integration and the Web of Things
http://koubachi.ch
Open endpoints that are accessible by all authorized users
Modeling according to the REST principles
However, the full potential is realized by
integrating functionality across services
The “Social Web of Things” (Ericsson, 2010)
Note the explicit communication between David and his smart
home…
“Leaving work”, “Sophia comes”, “No dinner”, “Order the usual”
…and the hidden communication between smart things
Oven, carpet vacuuming, smart umbrella, HiFi downloading playlist
Our Menu for Today.
45min.30min.15min.
Introduction/Overview WS-* Web Services
REST Service Integration Features
Service Integration via Structured Metadata
(WoT in the Wild)Semantic Service Integration
vous êtes ici
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic MountainsUnexplored State of Usability
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic MountainsUnexplored State of Usability
Service Integration in the Web of Things 18|Simon Mayer
http://people.inf.ethz.ch/mayersi
Service Integration in the Web of Things
Overview: WoT Concepts and Challenges
Saint Germain au Mont d’Or, Francesaintgermainaumontdor.fr
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Service Integration in the Web of Things 19|Simon Mayer
http://people.inf.ethz.ch/mayersi
Definitions of the following concepts in a Web of Things
context
Major challenges for service integration
Overview
Web of Things Concepts and Challenges
Smart ThingsServices
Service
IntegrationService
Mashups
Arrive-and-
Operate
Mashup
Management
Automatic Service
Composition
Service Integration in the Web of Things 20|Simon Mayer
http://people.inf.ethz.ch/mayersi
Cyber-physical functionality
Sensing, Actuation (or both) of real, physical quantities
Structured according to the REST principles
Respect the HATEOAS property (application statelessness)
Interfaces are “open”, but secure
Fully described for people and machines
Interacting Smart Things: Smart Environments
Smart Things in the Web of Things (WoT)
Service Integration in the Web of Things 21|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Things in the Web of Things
Example: RESTful Sun SPOTs
http://vs3.inf.ethz.ch:8081/sunspots/Spot3
GET
<HTML>…
GET
json
Service Integration in the Web of Things 22|Simon Mayer
http://people.inf.ethz.ch/mayersi
Generally: Services are Sub-Resources of Smart Things
A Smart Thing itself (i.e., the top URL) can also be a service
Services in the Web of Things
M. Kovatsch, S. Mayer, and B. Ostermaier. Towards the Thin Server Architecture for the Internet of Things, 2012
Service Integration in the Web of Things 23|Simon Mayer
http://people.inf.ethz.ch/mayersi
Services in the Web of Things
Example: RESTful Sun SPOTs
Temperature Sensor:
http://vs3.inf.ethz.ch:8081/sunspots/Spot3/sensors/temperature
GET
28.5
Service Integration in the Web of Things 24|Simon Mayer
http://people.inf.ethz.ch/mayersi
Services in the Web of Things
Example: RESTful Sun SPOTs
PUT
‘on
’
OK
LED Switch: vs3.inf.ethz.ch:8081/sunspots/Spot3/actuators/leds/3/switch
Service Integration in the Web of Things 25|Simon Mayer
http://people.inf.ethz.ch/mayersi
Prevalent Types
Visual Data Rendering
Cartographic / Geographic
Data Converters, Aggregators (Feeds, News)
Examples: programmableweb.com/mashups
In the Web of Things, mashups also act on physical
quantities!
Service Mashups in the Web of Things
“A mashup (…) is a web application that
uses content from more than one source to
create a single new service.”
Service Integration in the Web of Things 26|Simon Mayer
http://people.inf.ethz.ch/mayersi
Mashups in the Web of Things
Example: Anti-Theft Mashup
Shop management system + RFID reader + Web Cam
All with Web servers on-board!
Goal: Take a picture if a theft is detected= if an item is read by the RFID reader but not marked as “sold”
Send the picture to a mobile phone
D. Guinard, C. Floerkemeier, S. Sarma. Cloud Computing, REST and Mashups to Simplify RFID Application Development and Deployment, 2011
Service Integration in the Web of Things 27|Simon Mayer
http://people.inf.ethz.ch/mayersi
Mashups in the Web of Things
Example: Room Configuration
Service Integration in the Web of Things 28|Simon Mayer
http://people.inf.ethz.ch/mayersi
Enabling people to talk to services
Enabling services to talk to each other and form mashups
Enabling people to talk to service mashups
Service Integration in the Web of Things
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic MountainsUnexplored State of Usability
Now, let’s talk about some
challenges in service
integration
Arrive-and-Operate: Service Discovery and Look-Up
Mashup Management: For Everyone
Automatic Service Composition
Now, let’s talk about some
challenges in service
integration
Arrive-and-Operate: Service Discovery and Look-Up
Mashup Management: For Everyone
Automatic Service Composition
Service Integration in the Web of Things 32|Simon Mayer
http://people.inf.ethz.ch/mayersi
Advertise services that are provided by devices within a
smart environment!
Arrive and Operate
Service Discovery
What’s the current
temperature?I know that!
It’s 23°C
Thank you :-)
Service Integration in the Web of Things 33|Simon Mayer
http://people.inf.ethz.ch/mayersi
Arrive and Operate
Service Look-Up
It’s not static text documents anymore!
Possible to use Google for this?
Which attributes? Keywords, Device Type, Reviews,..
Search Engines for the WoT, e.g., Dyser, InfraWoT
B. Ostermaier, K. Römer, F. Mattern, M. Fahrmair, and W. Kellerer. A Real-Time Search Engine for the Web of Things, 2010
S. Mayer, D. Guinard, and V. Trifa. Searching in a Web-based Infrastructure for Smart Things, 2012
Service Integration in the Web of Things 34|Simon Mayer
http://people.inf.ethz.ch/mayersi
Search for smart things that exhibit a given state at the
time of the query
“Empty rooms that have a temperature of 23°C”
Querying for real-time states is expensive!
Dyser: Create statistical models for sensors. First query
sensors that likely satisfy the parameters
Arrive and Operate
Service Look-Up: Dyser
Service Integration in the Web of Things 35|Simon Mayer
http://people.inf.ethz.ch/mayersi
Now, let’s talk about some
challenges in service
integration
Arrive-and-Operate: Service Discovery
Mashup Management: For Everyone
Automatic Service Composition
Service Integration in the Web of Things 36|Simon Mayer
http://people.inf.ethz.ch/mayersi
Non-PhD-Nabaztag idea: Dom Guinard
Mashups for Everyone
I don’t have a PhD in computer
science...
Enable tech-savvy users to develop applications that
leverage functionality from sensors and actuators
[“programming the real world”]
Service Integration in the Web of Things 37|Simon Mayer
http://people.inf.ethz.ch/mayersi
Mashups for Everyone
Graphical Editors for Physical Mashups
Facilitate the composition of RESTful services Clickscript (JavaScript-based visual programming language)
https://github.com/lnaef/ClickScript
Web of Things modules: Thermometer, fan, etc.
Service Integration in the Web of Things 38|Simon Mayer
http://people.inf.ethz.ch/mayersi
Mashups for Everyone
Graphical Editors for Physical Mashups
[Clickscript.ch]
D. Guinard, C. Floerkemeier, S. Sarma. Cloud Computing, REST and Mashups to Simplify RFID Application Development and Deployment, 2011
Service Integration in the Web of Things 40|Simon Mayer
http://people.inf.ethz.ch/mayersi
Now, let’s talk about some
challenges in service
integration
Arrive-and-Operate: Service Discovery
Mashup Management: For Everyone
Automatic Service Composition
Service Integration in the Web of Things 41|Simon Mayer
http://people.inf.ethz.ch/mayersi
Automatic Service Composition
Embed information about what smart things can do!
Syntactic level: Data type, units of measurement, etc.
Semantic level: “What is the meaning of this data?”
Is automatic mashup creation even possible? We’ll see… :-D
...and tell others!
Service Integration in the Web of Things 42|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
Service Integration in the Web of Things 43|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
Service Integration in the Web of Things 44|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
Service Integration in the Web of Things 45|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
Service Integration in the Web of Things 46|Simon Mayer
http://people.inf.ethz.ch/mayersi
Web of Things Concepts
Smart Things and Smart Environments
Services
Service Integration
Service Mashups
Web of Things Challenges
Arrive and Operate: Service Discovery and Look-Up
Mashups: Enable tech-savvy users to program the real world
Service Composition: Fully automatic?
Summary
Introductory Stroll
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic MountainsUnexplored State of Usability
WS-* Forest
Service Integration in the Web of Things 48|Simon Mayer
http://people.inf.ethz.ch/mayersi
Service Integration in the Web of Things
A History Primer: WS-* Web Services
Sonoma County, USAahmadladhani.wordpress.com
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Service Integration in the Web of Things 49|Simon Mayer
http://people.inf.ethz.ch/mayersi
Service Integration in the Web of Things
A History Primer: WS-* Web Services
Bliss, Microsoftahmadladhani.files.wordpress.com
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Introductory Stroll
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic MountainsUnexplored State of Usability
WS-* Forest
Service Integration in the Web of Things 51|Simon Mayer
http://people.inf.ethz.ch/mayersi
Here, endpoints are service calls, not resources
Resource: www.myserver.org/thermometer/temperature
Service: www.myserver.org/getTemperature
Main Technologies:
Service Access SOAP
Service Description WSDL
Service Discovery UDDI
The Service-Oriented Architecture
Service Integration in the Web of Things 52|Simon Mayer
http://people.inf.ethz.ch/mayersi
Challenge (1995):
How to make heterogeneous services on the
Internet discoverable and usable for clients?
Internet too heterogeneous for a single RPC technology
Goal: Language-independent standards for Web Services
The Service-Oriented Architecture
Main Technologies
Service Integration in the Web of Things 53|Simon Mayer
http://people.inf.ethz.ch/mayersi
SOAP: Service Access (1998)
“Simple Object Access Protocol”, today just “SOAP”
Dave Winder (also RSS!), together with MS engineers
Transport usually via HTTP, but also possible via, e.g., SMTP
The Service-Oriented Architecture
Main Technologies: SOAP
Service Integration in the Web of Things 54|Simon Mayer
http://people.inf.ethz.ch/mayersi
WSDL: Service Description (2000)
Web Services Description Language
IBM, MS, Ariba
UDDI: Service Discovery (2000)
Universal Description Discovery and Integration (part of WS-I)
MS, IBM, Ariba
SOAP, WSDL, and UDDI are part of the WS-* stack
The Service-Oriented Architecture
Main Technologies: WSDL and UDDI
Service Integration in the Web of Things 55|Simon Mayer
http://people.inf.ethz.ch/mayersi
The Service-Oriented Architecture
Main Technologies
XML Documens
Client Server
Registry-Service
UDDI
WSDLWSDL
SOAP
register
look up
request / reply
Material adapted from: F. Mattern, Distributed Systems Lecture, ETH Zurich, 2012
Service Integration in the Web of Things 56|Simon Mayer
http://people.inf.ethz.ch/mayersi
The Service-Oriented Architecture
Main Technologies
Client Server
Lookup-Service
UDDI
WSDLWSDL
SOAP
register
look up
request / reply
SOAP envelope
Header (optional)
Body
WSDL description
types, messages
portType
binding
service
Service Integration in the Web of Things 57|Simon Mayer
http://people.inf.ethz.ch/mayersi
The Service-Oriented Architecture
Main Technologies: SOAP
SOAP envelope
Header (optional)
Body
Envelope
SOAP Definition and Encoding Style
Optional Header
Transaction Context: Authentication and Billing
Body
Service Integration in the Web of Things 58|Simon Mayer
http://people.inf.ethz.ch/mayersi
Types: What does the exchanged data look like?WSDL description
types, messages
portType
binding
service
Messages: What are messages composed of?
PortType: What do the operations look like?
Binding: Which protocol to use?
Service: Structure/Bundling of operations
The Service-Oriented Architecture
Main Technologies: WSDL
Service Integration in the Web of Things 59|Simon Mayer
http://people.inf.ethz.ch/mayersi
Types: Define Serialization Objects
<xs:element name="myName" type="myObject"/>
<xs:complexType name="myObject"><xs:sequence><xs:element name="i" type="xs:int"/><xs:element name="j" type="xs:float"/>
</xs:sequence></xs:complexType>
“complexType”: Composite Objects!
WSDL description
types, messages
portType
binding
service
The Service-Oriented Architecture
Main Technologies: WSDL
Service Integration in the Web of Things 60|Simon Mayer
http://people.inf.ethz.ch/mayersi
Messages
<message name="myRequest"><part name="parameters"
element="tns:myName"/><part name="optionalParameters"
element="tns:myOpt"/></message>
<message name="myResponse"><part name="result" element="tns:myRet"/>
</message>
WSDL description
types, messages
portType
binding
service
The Service-Oriented Architecture
Main Technologies: WSDL
“tns”: target namespace
myObject
Service Integration in the Web of Things 61|Simon Mayer
http://people.inf.ethz.ch/mayersi
PortType: Define Operations
<portType name="groupOfServices"><operation name="myService"><input message="tns:myRequest"/><output message="tns:myResponse"/><fault message="tns:someFault"/>
</operation></portType>
WSDL description
types, messages
portType
binding
service
The Service-Oriented Architecture
Main Technologies: WSDL
There can also be multiple operations
Service Integration in the Web of Things 62|Simon Mayer
http://people.inf.ethz.ch/mayersi
Transport Binding
<binding name="myBinding“type="tns:allMyServices">
<soap:bindingtransport="http://schemas.xml-soap.org/soap/http"
style="document"/></binding>
WSDL description
types, messages
portType
binding
service
The Service-Oriented Architecture
Main Technologies: WSDL
Service Integration in the Web of Things 63|Simon Mayer
http://people.inf.ethz.ch/mayersi
Service: Packaging the Service
<service name="SimpleService"><port binding="tns:myBinding">
<soap:address location=“http://simpleService.org"/>
</port></service>
WSDL description
types, messages
portType
binding
service
The Service-Oriented Architecture
Main Technologies: WSDL
Service Integration in the Web of Things 64|Simon Mayer
http://people.inf.ethz.ch/mayersi
Stubs handle communication issues such as message packingand unpacking (“marshalling”)
Server stub is also responsible for publishing the WSDL file
The Service-Oriented Architecture
WS-* in Practice
Applic
ation-S
erv
er
Server Logic
Server Stub
Clie
nt
Client Stub
Client Logic
Service Integration in the Web of Things 65|Simon Mayer
http://people.inf.ethz.ch/mayersi
The “server stub” Handle SOAP marshalling
Publish WSDL
Two possibilities to create the server stub
1. Bottom-Up / Code-First: Stub from implementation
Example on next slide (JAX-WS)
2. Top-Down / Contract-First: Stub from Interface WSDL
The Service-Oriented Architecture
WS-* in Practice: WS-* Servers
Applic
ation-S
erv
er
Server Logic
Server Stub
Service Integration in the Web of Things 66|Simon Mayer
http://people.inf.ethz.ch/mayersi
The Service-Oriented Architecture
Java API for XML Web Services (JAX-WS)
Java Annotations to create Web Services from simple Java code
Service Integration in the Web of Things 67|Simon Mayer
http://people.inf.ethz.ch/mayersi
Stubs handle communication issues such as message packing and unpacking (“marshalling”)
Server stub is also responsible for publishing the WSDL file
The Service-Oriented Architecture
WS-* in Practice
Applic
ation-S
erv
er
Server Logic
Server Stub
Clie
nt
Client Stub
Client Logic
Service Integration in the Web of Things 68|Simon Mayer
http://people.inf.ethz.ch/mayersi
The “client stub” handles SOAP marshalling
Two options:
1. Bottom-Up / Code-First: Stub from implementation
2. Contract-First: Stubs from WSDL
Highly appealing for enterprises!
The Service-Oriented Architecture
WS-* in Practice: WS-* Clients
Clie
nt
Client Stub
Client Logic
Service Integration in the Web of Things 69|Simon Mayer
http://people.inf.ethz.ch/mayersi
The Service-Oriented Architecture
Discussion of WS-*
Immensely powerful and lots of available tools!
Huge complexity - hard to learn
WSDL: Enormous documents for simple functionality!
SOAP: Only POST (for http-binding)
Therefore no http-based caching possible!
UDDI: No role-based access, no service life-cycle
management, limited look-up capabilities (IBM, 2007)
Service Integration in the Web of Things 70|Simon Mayer
http://people.inf.ethz.ch/mayersi
It is that it has features that encourage the
compiling of clients against it, and that
such clients are not flexible enough to
adapt to changing interfaces
(creation of client stubs from WSDL)
One of the biggest problems of WSDL (and WADL, see later) isn’t technical…
Introductory Stroll
WS-* Forest
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
REST Beacon of Hope
Web-based Interaction with Smart Environments 72|Simon Mayer
http://people.inf.ethz.ch/mayersi
Service Integration in the Web of Things
(Back) to the Future: REST
CERN, Switzerland/Francehome.web.cern.ch
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Web-based Interaction with Smart Environments 73|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
LHC
Image: Compact Muon Solenoid Experiment
[one of the main particle detectors at CERN]
Introductory Stroll
WS-* Forest
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
REST Beacon of Hope
Web-based Interaction with Smart Environments 75|Simon Mayer
http://people.inf.ethz.ch/mayersi
Introduction to REST by Michaël and Lionel (yesterday)
Comparison of REST and WS-*
Google Trends
Performance of REST vs. WS-*
Ease of use of REST and WS-*
A different approach to understanding REST
The main REST feature for service integration: HATEOAS
Overview: REST, WS-*, and HATEOAS
Web-based Interaction with Smart Environments 76|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
SOAP
Makes no sense to look this up… ;-)
Web-based Interaction with Smart Environments 77|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
“SOAP Java”
Web-based Interaction with Smart Environments 78|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
WSDL
Web-based Interaction with Smart Environments 79|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
UDDI
Web-based Interaction with Smart Environments 80|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
REST
Makes little sense to look this up either… ;-)
Web-based Interaction with Smart Environments 81|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
RESTful
Web-based Interaction with Smart Environments 82|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
UDDIRESTful
“SOAP Java”
Web-based Interaction with Smart Environments 83|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST outperforms WS-*
Some data in a minute…
REST is a better fit to the “Do-It-Yourself” Web
Often frontend creation, i.e., quick data access
“Web Developers” vs. “Programmers”
WS-* suite is a complex standard, now
Makes it hard to use for novices
Some data in a minute…
REST and WS-*
The Downside of WS-* Web Services…
Web-based Interaction with Smart Environments 84|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and SOAP on devices with limited resources
REST and WS-*
Performance
Power Consumption [mW] Completion Time [s]
D. Yazar and A. Dunkels: Efficient Application Integration in IP-based Sensor Networks, 2009
Web-based Interaction with Smart Environments 85|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Better Fit for Do-It-Yourself Web
RESTful vs. “Big” Web Services
REST for tactical, ad hoc integration over the Web
(“Mashups”)
WS-* in professional enterprise application integration
scenarios with a longer lifespan and advanced QoS
requirements
Today, REST is being more and more adopted for this use case!
C. Pautasso, O. Zimmermann, and F. Leymann: RESTful Web Services vs. “Big” Web Services. Making the Right Architectural Decision, 2008
Web-based Interaction with Smart Environments 86|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Complexity & Approachability
Also consider the perceived ease of use as a key to the
adoption of an IT system
Increasing reliance on external developers to build
innovative services (App Store, Google Play, etc.)
F. D. Davis. Perceived Usefulness, Perceived Ease of Use, and User Acceptance of Information Technology, 1989
D. Gefen and M. Keil. The Impact of Developer Responsiveness on Perceptions of Usefulness and Ease of Use, 1998
An easy to learn and easy to use API is key
to foster a broad community of developers!
Web-based Interaction with Smart Environments 87|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective
Study to evaluate the developers’ experience when
learning and implementing Web Service applications
Perceived advantages & disadvantages of REST and WS-*
Ease and speed of learning
Perceived suitability of REST and WS-* for different scenarios
Participants
Computer science students (n = 69)
Third or fourth year of Bachelor studies
D. Guinard, I. Ion, S. Mayer: REST or WS-*? A Developers’ Perspective, 2011
Web-based Interaction with Smart Environments 88|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Study Setup
Data Sources (quantitative and qualitative feedback)
1. Implementation Task Teams (n = 25)
2. Structured Questionnaire Individual (n = 69)
3. Feedback Form Anonymous (n = 37)
Implementation Task: Mobile Phone Applications (n = 25)
Access temperature measurements on wireless sensor nodes
a. RESTful API
b. WS-* (WSDL + SOAP) API
Standard libraries: Apache HTTPClient for REST, kSoap2 for WS-*
All course material is available online: tinyurl.com/vs-material
Web-based Interaction with Smart Environments 89|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Study Setup
Web-based Interaction with Smart Environments 90|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Study Setup
2. Structured Questionnaire (n = 69)
Advantages and disadvantages of REST and WS-*
Suitability of WS-* and REST in different domains
Completed after finishing implementation
3. Anonymous Feedback Form (n = 37)
WS-* / REST ease and speed of learning
Suitability of WS-* / REST in different domains
Completed after finishing implementation
Web-based Interaction with Smart Environments 91|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Results
Perceived advantages of each technology
Ease and speed of learning
Perceived suitability for use cases
Embedded devices
Mobile phone client applications
Business applications
Web-based Interaction with Smart Environments 92|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Perceived Advantages
REST
Very easy to understand, learn, and implement (36 participants)
More lightweight (27)
More scalable (21)
WS-*
WSDL enables service contracts (31)
Better security features (19)
Better level of abstraction (11)
Qualitative Results, n = 69
Web-based Interaction with Smart Environments 93|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Ease of Learning
“Easy” or “Very easy” to learn
REST: 70%
WS-*: 11%
REST M = 3.85, SD = 1.09
WS-* M = 2.50, SD = 1.10
REST significantly easier to learn (p < 0.001, Wilcoxon signed rank test)
Not easy at all Not easy Average Easy Very easy
0
2
4
6
8
10
12
14
16
18
REST
WS-*
5 point Likert scale [1 = Not easy at all, ..., 5 = Very easy], n = 37
Web-based Interaction with Smart Environments 94|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Speed of Learning
“Fast” or “Very fast” to learn
REST: 65%
WS-*: 0%
REST: M = 3.43, SD = 1.09
WS-*: M = 2.21, SD = 0.80
REST significantly faster to learn (p < 0.009, Wilcoxon signed rank test)
Not fast at all Not fast Average Fast Very fast
0
2
4
6
8
10
12
14
REST
WS-*
5 point Likert scale [1 = Not fast at all, ..., 5 = Very fast], n = 37
Web-based Interaction with Smart Environments 95|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST easier to learn because RESTful Web Services are based on
familiar technologies such as HTTP (9)
REST made it easier to understand what services the sensor nodes
offer (25). This is because of the HTML interface (8)
WSDL and SOAP are more complex to use (8)
Good that WSDL is “standard” (7)
REST and WS-*
Developers’ Perspective: Summary
“REST is easy and WS-* is
just a complicated mess.”
“Everybody who is using a browser
already knows a little about [REST]”
Qualitative Results, n = 69
[http://www.innoq.com/soa/ws-standards/poster/innoQ%20WS-Standards%20Poster%202007-02.pdf]
WS-* Standards Overview
Web-based Interaction with Smart Environments 97|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Use Cases
Would you use REST or WS-* for…
… Embedded Devices?
… Mobile Phone Clients?
… Business Applications?
Web-based Interaction with Smart Environments 98|Simon Mayer
http://people.inf.ethz.ch/mayersi
5 point Likert scale [1 = WS-*, ..., 5 = REST], n = 37
REST and WS-*
Developers’ Perspective: Use Cases
Web-based Interaction with Smart Environments 99|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Use Cases
Embedded Devices
REST (66%), WS-* (8%)
Reasons: REST better in heterogeneous environments, more
lightweight
Smart Home Sensor Network (students’ private homes)
REST (89%), WS-* (7%)
Reasons: Simplicity of deployment and use (24)
(avg. footprint 17.46 kB for REST, 83.27 kB for WS-* application)
5 point Likert scale [1 = WS-*, ..., 5 = REST], n = 37 + qualitative data
Web-based Interaction with Smart Environments 100|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Use Cases
Mobile Phones
REST (53%), WS-* (16%), 32% undecided
Reasons: REST causes less traffic (7)
Undecided reasons: Mobile phones getting very powerful
5 point Likert scale [1 = WS-*, ..., 5 = REST], n = 37 + qualitative data
Web-based Interaction with Smart Environments 101|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Use Cases
Business Applications
WS-* (52%), REST (24%)
WS-* Reasons: Security needs (21), better service contracts (18)
REST Reasons: Simplicity (10), Scalability (10)
5 point Likert scale [1 = WS-*, ..., 5 = REST], n = 37 + qualitative data
Web-based Interaction with Smart Environments 102|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developers’ Perspective: Summary
REST: Intuitive, flexible, lightweight
WS-*: Advanced security, standardization, contracts
Learning Ease and Speed: REST Preference (significant)
Embedded and Mobile Apps: REST Preference (significant)
Business Applications: WS-* Preference (not significant)
Study done among novice developers
Web-based Interaction with Smart Environments 103|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
REST Advantages: Summary
Great for open, interoperable APIs Greatly facilitates creation of mashups
Web features for free Bookmark your devices and their functionality
Caching for scalability, security mechanisms
People are used to exploring the Web using a browser
Seems to facilitate application development
Web-based Interaction with Smart Environments 104|Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
REST Advantages: Summary
REST and SOAP on devices with limited resources
UDDI discontinued by IBM, Microsoft, SAP in 2006
Functionality removed from Windows Server in 2010
WS-* APIs discontinued by Google in 2011
Power Consumption [mW] Completion Time [s]
[derekskeba.com]
Try to avoid repeating the same mistakes for service
integration in the Web of Things
Do not create service descriptions
that encourage the compiling of
clients against them
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
Now for the cool stuff: HATEOAS[or, Hypermedia as the Engine of Application State]
[or, the server guides clients using hyperlinks]
Did you ever experience that the “back”
button broke a hypermedia application?e-banking, e-commerce, flights booking, etc.
Why is that?
“The Hypertext Transfer Protocol (HTTP)
is a networking protocol for distributed,
collaborative, hypermedia information
systems. HTTP is the foundation of data
communication for the World Wide Web.”“Prominent members
include the Hypertext
Transfer Protocol.”
http://en.wikipedia.org/wiki/HTTP
http://en.wikipedia.org/wiki/Networking_protocol
http://en.wikipedia.org/wiki/WWW
http://en.wikipedia.org/wiki/URI
http://en.wikipedia.org/wiki/Hyperlink
HATEOAS: Simple Example
Known URL!
Clients that click “back” break the HATEOAS “contract”!
The server didn’t want a “back” button to be available in the application. Else,
there would be a hypermedia control to enable the “back”-action
Web-based Interaction with Smart Environments 111|Simon Mayer
http://people.inf.ethz.ch/mayersi
All possible state transitions of an application are under
control of the server. To guide clients in applications, the
server provides hyperlinks that they may follow
Clients only follow provided hyperlinks! “follow your nose”
Take Care! What if a client wants to buy a book, but only
finds a link “Add to shopping cart”?
Representational State Transfer (REST)
HATEOAS [Hypermedia as the Engine of Application State]
No Problem!What about
me??
Web-based Interaction with Smart Environments 112|Simon Mayer
http://people.inf.ethz.ch/mayersi
Client context,
e.g.: Do I like
chocolate?
Page contents,
e.g.: ”Zurich”
advertisement
Representational State Transfer (REST)
HATEOAS for Human Clients
Web-based Interaction with Smart Environments 113|Simon Mayer
http://people.inf.ethz.ch/mayersi
Important part of REST! Especially for service integration…
Representational State Transfer (REST)
HATEOAS: Google Trends (2004-2013)
HATEOAS
http://bookstore.org/books/book1
HATEOAS: Book Store Example
Known URL!
“Recommended Books: Book1
Books in your cart: None.
Checkout not possible (no books).”“This is Book1. It’s great!
Add book to cart”
GET books/book1
http://bookstore.org/carts/simon http://bookstore.org/books/book1
http://bookstore.org/checkout?customerID=simon
HATEOAS: Book Store Example
Known URL!
“This is Book1. It’s great!
Add book to cart”
POST carts/simon?book=Book1
“Recommended Books: None
Books in your cart: Book1.
Go to checkout.”
“Select payment type:
Credit Card, Debit Card”
http://bookstore.org/carts/simon
Known URL!
http://bookstore.org/books/book1 http://bookstore.org/XYZ/book1
HATEOAS: Book Store Example
What if the bookstore renames the /books pages?
http://bookstore.org/XYZ/book1
Known URL!
“Recommended Books: Book1
Books in your cart: None.
Checkout not possible (no books).”“This is Book1. It’s great!
Add book to cart”
GET XYZ/book1
HATEOAS: Book Store Example
http://bookstore.org/carts/simonhttp://bookstore.org/XYZ/book1
http://bookstore.org/checkout?customerID=simon
Known URL!
“This is Book1. It’s great!
Add book to cart”
GET XYZ/book1
POST carts/simon?book=Book1
“Recommended Books: None
Books in your cart: Book1.
Go to checkout.”
“Select payment type:
Credit Card, Debit Card”
HATEOAS: Book Store Example
Web-based Interaction with Smart Environments 119|Simon Mayer
http://people.inf.ethz.ch/mayersi
HATEOAS is what adds flexibility to REST systems!
Links are discovered by clients at runtime
Clients will automatically adapt if links change!
This is why browsers are general-purpose tools and not
specialized applications
What if the book store API was described in WSDL?
Risk that clients are compiled from the WSDL
Not mandatory, but was common practice! Why?
WSDLs are more complex to parse and perceived as being static
Representational State Transfer (REST)
HATEOAS and Flexible Service Consumption
Web-based Interaction with Smart Environments 120|Simon Mayer
http://people.inf.ethz.ch/mayersi
We assume that a machine client can follow its nose
Can they, really? What is required to “follow your nose”?
How to combine services from different providers?
They don’t know about each other!
They cannot include links to each other!
HATEOAS cannot accomplish such service integration
tasks alone!
Representational State Transfer (REST)
HATEOAS for Machine Clients: Challenges
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
This is where HATEOAS breaks down for machine clients!
Options?
Create a new type of WSDL, for RESTful Web Services(top-down, standardization, look at WADL in the next slides)
Offer Web developers ways of annotating their resources(basically the same thing, but taking into account the developers’ perspective / bottom-up)
Web-based Interaction with Smart Environments 123|Simon Mayer
http://people.inf.ethz.ch/mayersi
Web Application Description Language
Initial draft (2005) by Marc Hadley
Sun Microsystems (today: Oracle)
Some words about WADL
WADL
Web-based Interaction with Smart Environments 124|Simon Mayer
http://people.inf.ethz.ch/mayersi
WADL: Repeating WS-* Mistakes?
WADL example to annotate a news search
Alternative Option: OpenSearch
WADL documents are verbose and
perceived as rather rigid
“the REST answer to WSDL”
Risk of compiling against WADL!
http://www.w3.org/Submission/wadl/
http://www.opensearch.org/Specifications/OpenSearch/1.1
Service Integration in the Web of Things 125|Simon Mayer
http://people.inf.ethz.ch/mayersi
Service Integration in the Web of Things
WoT Service Integration
Zurich, Switzerlandethz.ch
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Service Integration in the Web of Things 126|Simon Mayer
http://people.inf.ethz.ch/mayersi
Example Scenario
Service Integration in the Web of Things 127|Simon Mayer
http://people.inf.ethz.ch/mayersi
User enters personal preferences into smartphone (temperature, preferred song, etc.)
Smartphone negotiates with devices in the surroundings
to set these preferences
Constraints
Must be flexible: Should work in the user’s home, office, hotels, etc.
Interaction metadata must be discoverable on the fly!
Discourage compiling against service descriptions!
Example Scenario
Service Integration in the Web of Things 128|Simon Mayer
http://people.inf.ethz.ch/mayersi
Heterogeneous services from different providers should
be dynamically composable
Services don’t know anything about how to interact with
other services when they are created (i.e., no “standards”)
No HATEOAS: No hyperlinks between services!
Links are known only between “local” services where URLs have
been intentionally linked by the service provider
The big picture…
Service Integration in the Web of Things 129|Simon Mayer
http://people.inf.ethz.ch/mayersi
Make things smart enough to know what they can do…
First level: Syntax
“What type does a service’s output data have?”
REST offers a great mechanism to help with that: Content Negotiation
Second level: Semantics
“Does it make sense to link these two services?”
Service Integration: Self-aware Things!
...and tell others!
Service Integration in the Web of Things 130|Simon Mayer
http://people.inf.ethz.ch/mayersi
Make things smart enough to know what they can do…
First level: Syntax
“What type does a service’s output data have?”
REST offers a great mechanism to help with that: Content Negotiation
Second level: Semantics
“Does it make sense to link these two services?”
Service Integration: Self-aware Things!
...and tell others!
Service Integration in the Web of Things 131|Simon Mayer
http://people.inf.ethz.ch/mayersi
A smart thermostat takes inputs as XML:
The client’s desired temperature is in a JSON document:
Service Integration: “Self-aware” Things?
A Glimpse at Syntactic Service Integration
commonName:”clientX”,
desiredSong:”Yellow Submarine”,
desiredTemperature:”20”
Method: PUT
Endpoint: myserver.org/things/thermostat
Content: (…)<value>23.3</value>(…)
Service Integration in the Web of Things 132|Simon Mayer
http://people.inf.ethz.ch/mayersi
Describe the service’s API in an Internet Media Type!
Make this information public!
Client can now create/render the input and use the service
This is part of REST self-describing messages!
Service Integration: “Self-aware” Things?
A Glimpse at Syntactic Service Integration
Method: PUT
Endpoint: myserver.org/things/thermostat
Content: (…)<value>23.3</value>(…)
Content-Type: application/xml+simon-thermostat
Service Integration in the Web of Things 133|Simon Mayer
http://people.inf.ethz.ch/mayersi
Make things smart enough to know what they can do…
First level: Syntax
“What type does a service’s output data have?”
REST offers a great mechanism to help with that: Content Negotiation
Second level: Semantics
“Does it make sense to link these two services?”
Service Integration: Self-aware Things!
...and tell others!
How to infer that it’s about temperatures
and not about a GPS longitude?
Not possible! They look the same!
Yes, but their semantics are different.
?
True, the messages aren’t self-descriptive with respect to
this: “value” could be anything
Method: PUT
Endpoint: myserver.org/things/thermostat
Content: (…)<value>23.3</value>(…)
But we can fix that, by adding semantic metadata!
Not possible! They look the same!
Alright… from the beginning :-)
We’ll see four service integration techniques, an
example for each, and discuss their suitability for
our considered applications
Service Integration in the Web of Things 137|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple Hypermedia Crawling
Metadata: Microformats and Microdata
Crowd-sourced Service Integration
Web Linking: “Globalized” HATEOAS?
Semantics-based Service Integration
Web Linking + Metadata Embedding My current research…
Service Integration: “Self-aware” Things?
Techniques for Semantic Service Integration
more
fun
ctio
nality
……
more
co
mp
lexity
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
Service Integration in the Web of Things 139|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple Hypermedia Crawling
Metadata: Microformats and Microdata
Crowd-sourced Service Integration
Web Linking: “Globalized” HATEOAS?
Semantics-based Service Integration
Web Linking + Metadata Embedding My own current research…
Service Integration: “Self-aware” Things?
Techniques for Semantic Service Integration
Service Integration in the Web of Things 140|Simon Mayer
http://people.inf.ethz.ch/mayersi
Crawling of hypermedia structures sometimes is already
sufficient as enabler for integration Mainly relies on: GET Well-known, right?
HEAD Who knows this?
OPTIONS And this one?
Friends and Things: Sharing of physical and digital
artifacts via social networks
Techniques for Semantic Service Integration
Hypermedia Crawling
D. Guinard, M. Fischer, V. Trifa. Sharing Using Social Networks in a Composable Web of Things, 2010
Service Integration in the Web of Things 141|Simon Mayer
http://people.inf.ethz.ch/mayersi
@home Sharing your energy consumption
Encouraging energy savings…
@work Laboratory automation
“You may monitor my mass spectrometer”
@business Sharing the trace of tagged products
RESTful EPCIS
Hypermedia Crawling
The Friends and Things Project
Service Integration in the Web of Things 142|Simon Mayer
http://people.inf.ethz.ch/mayersi
Hypermedia Crawling
The Friends and Things Project
Service Integration in the Web of Things 143|Simon Mayer
http://people.inf.ethz.ch/mayersi
FaT must discover thing APIs to be shared first
Entirely done via hypermedia crawling, no semantics whatsoever
Then, things can be shared via the OpenSocial API
…and used by others
Hypermedia Crawling
The Friends and Things Project
Service Integration in the Web of Things 144|Simon Mayer
http://people.inf.ethz.ch/mayersi
Hypermedia Crawling
The Friends and Things Project
Service Integration in the Web of Things 145|Simon Mayer
http://people.inf.ethz.ch/mayersi
Only API discovery, nothing else!
No information about how APIs can be used: Only
specialized applications can use them
For crawling to work, links must already exist!(the “local” hyperlinks problem, again…)
Techniques for Semantic Service Integration
Hypermedia Crawling: Limitations
Service Integration in the Web of Things 146|Simon Mayer
http://people.inf.ethz.ch/mayersi
Hypermedia Crawling
Discussion
Rating Comments
Interface
DiscoveryPartial Requires APIs to be connected via hyperlinks
Automatic
Service UsageNo
Can be used to discover APIs that are then used
by tailored applications (like Friends and Things
does!)
Level of
Semantic
Integration
None No semantic integration whatsoever
Simplicity Very Easy No specific annotations required
Service Integration in the Web of Things 147|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple Hypermedia Crawling
Metadata: Microformats and Microdata
Crowd-sourced Service Integration
Web Linking: “Globalized” HATEOAS?
Semantics-based Service Integration
Web Linking + Metadata Embedding My own current research…
Service Integration: “Self-aware” Things?
Techniques for Semantic Service Integration
Service Integration in the Web of Things 148|Simon Mayer
http://people.inf.ethz.ch/mayersi
Easy: Find a common way of embedding “useful” metadata
Standardized “structured Data” can be successful… ;-)
vCard supporters:Android, Symbian, Apple Mac OS X, combit Relationship Manager, Egroupware, Kontact,
Lotus Notes, Lotus Organizer, Gmail, Microsoft Outlook, Mozilla Thunderbird, Novell
Evolution, Novell GroupWise, Roundcube, SOGo, Palm Desktop, The Bat, Trillian, Turba,
WebWeaver Suite, etc.
Techniques for Semantic Service Integration
Metadata Embedding
Anybody know the vCard format?
Service Integration in the Web of Things 149|Simon Mayer
http://people.inf.ethz.ch/mayersi
Easy: Find a common way of embedding “useful” metadata
Standardized “structured Data” can be successful… ;-)
Wikipedia “Infoboxes”
Wikidata
Techniques for Semantic Service Integration
Metadata Embedding
http://fr.wikipedia.org/wiki/Lyon
http://www.wikidata.org/wiki/Q456
Service Integration in the Web of Things 150|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
Specifically hRESTS for service integration
Standardized formats for describing contact info, products, etc.
Example application: Service lookup infrastructure
Microdata
Driven by the “big players”, often linked to ontologies
Example application: UI descriptions
Techniques for Semantic Service Integration
Metadata Embeddingboth: HTML!
Service Integration in the Web of Things 151|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
Specifically hRESTS for service integration
Standardized formats for describing contact info, products, etc.
Example application: Service lookup infrastructure
Microdata
Driven by the “big players”, often linked to ontologies
Example application: UI descriptions
Techniques for Semantic Service Integration
Metadata Embedding
Service Integration in the Web of Things 152|Simon Mayer
http://people.inf.ethz.ch/mayersi
Standardized HTML-embeddable structured data profiles
Metadata Embedding
Microformats
<div class="vcard">
<a class="url fn" href="http://tantek.com/">Tantek Çelik</a>
</div>
hCard format
For API descriptions! Next slide!
hRESTS format
Service Integration in the Web of Things 153|Simon Mayer
http://people.inf.ethz.ch/mayersi
Does this really help machine clients?
Microformats
The hRESTS Format for API Descriptions
<div class="service">
This <span class="label">thermostat</span> enables users to
<div class="operation”>
<span class="label">configure the current temperature</span>
. It is invoked using a
<span class="method">PUT</span>
request at
<span class="address">http://myserver.org/thermostat?t=temp</span>
with
<span class="input">the desired temperature</span>
replacing the
<code>temp</code>
parameter.
</div>
</div>Demonstration!
Service Integration in the Web of Things 154|Simon Mayer
http://people.inf.ethz.ch/mayersi
A management infrastructure for smart things
Enables searching for devices in smart environments
Parameters:
UUID, Name, Keywords
Type/Category of device
Location
Reviews
Type of REST API
Microformats
Embedded Microformats Example: InfraWoT
S. Mayer, D. Guinard, and V. Trifa. Searching in a Web-based Infrastructure for Smart Things, 2012
Find a Thermostat at the
location Living Room that
takes a temperature as input
Service Integration in the Web of Things 155|Simon Mayer
http://people.inf.ethz.ch/mayersi
Hierarchies of management nodes, nodes only aware of
direct neighbors
highly scalable! (tested with 100k devices…)
Microformats
The InfraWoT Project
Service Integration in the Web of Things 156|Simon Mayer
http://people.inf.ethz.ch/mayersi
Management infrastructure for smart things
Service Discovery and Look-up
Microformats
The InfraWoT Project
Trifa, V., Guinard, D., Mayer, S. Leveraging the Web for a Distributed Location-aware Infrastructure for the Real World, 2010
Things register
first…
Service Integration in the Web of Things 157|Simon Mayer
http://people.inf.ethz.ch/mayersi
Management infrastructure for smart things
Service Discovery and Look-up
Microformats
The InfraWoT Project
…and can be
found by clients!
Things register
first… Find a Thermostat at the
location Living Room that
takes a temperature as input
Service Integration in the Web of Things 158|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
The InfraWoT Project: Registration
Service Integration in the Web of Things 159|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
The InfraWoT Project: Metadata
Parameters Microformat
Identification Name, UUIDNone. Information
derived from URL
Product Info Device Type, Brand, Price, etc. hProduct
User Reviews Ratings, Description hReview
Context Location (GPS + Indoor Location)GEO for GPS, proprietary
format for indoor
API DescriptionLabel, URL Template, Input,
OutputhRESTS
Service Integration in the Web of Things 160|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
The InfraWoT Project: Service Look-Up
Find a Thermostat at the location
Living Room that takes a
temperature as input
www.myserver.org/things/thermostatMethod: HTTP PUT
Rating: 4.3 (0..5)
hProduct Category
GEO
hRESTS Input
Service Integration in the Web of Things 161|Simon Mayer
http://people.inf.ethz.ch/mayersi
Information is not machine-interpretable
hRESTS service label can only be “understood” by humans!
Only allows to annotate text/html representations
Clumsy embedding via HTML overloading of “class”
Declining interest…
Microformats
Discussion
Microformats
Service Integration in the Web of Things 162|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
Discussion
Rating Comments
Interface
DiscoveryNone Requires to fall back on crawling or indexing
Automatic
Service UsagePartial
hRESTS allows definition of API, but no format to
describe it for machine clients
Level of
Semantic
Integration
PartialMicroformats define the semantics of objects, but
are only partially linked to ontologies
Simplicity MediumCumbersome annotation of HTML
representations required
Service Integration in the Web of Things 163|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
Specifically hRESTS for service integration
Standardized formats for describing contact info, products, etc.
Example application: Service lookup infrastructure
Microdata
Driven by the “big players”, often linked to ontologies
Example application: UI descriptions
Techniques for Semantic Service Integration
Metadata Embedding
Service Integration in the Web of Things 164|Simon Mayer
http://people.inf.ethz.ch/mayersi
Also based on structured data and HTML embedding
New attributes instead of overloading
Part of HTML5
“More semantics”: Linking to ontologies possible via fixed
vocabularies like www.schema.org or data-vocabulary.org
Maintainers: Google, MS, etc.
schema.org
Metadata Embedding
Microdata
Service Integration in the Web of Things 165|Simon Mayer
http://people.inf.ethz.ch/mayersi
Smarter embedding via special HTML attributes<… itemprop=“propertyName”> to annotate specific items
<… itemscope itemprop=“scopeName”> for scoping
Usually added to <span> or <div> tags
Demonstration (navigate to colored LED)
Metadata Embedding
Microdata
<html>…<span itemscope itemprop=“vCard”>This page is
about <span itemprop=“firstName”>Maximilian</span>
<span itemprop=“lastName”>Muster</span> who lives in
<span itemprop=“locality”>Zurich</span></span>…</html>
Service Integration in the Web of Things 166|Simon Mayer
http://people.inf.ethz.ch/mayersi
Goal: Automatic UI generation for smart things
Intuitive interfaces for multiple modalities (GUI, speech, haptics, etc.)
Metadata should be easy to embed for developers
UI Information embedded as Microdata
Microdata
Embedded Microdata Example: InterWoTions
Service Integration in the Web of Things 167|Simon Mayer
http://people.inf.ethz.ch/mayersi
InterWoTions
Human- and machine-readable volume controller interaction markup.
Microdata
The InterWoTions Project
GUI / Touch Screen
Haptic / Gyro
Example: Interaction with a Web-enabled LED
Speech
Haptic / Accelerometer
Example: Interaction with a Web-enabled Power Plug
Haptic / Gyroscope
Example: Interaction with a Web-enabled Toy Robot
GUI / Gyroscope
Composite UIset intensity,
switch, get data,
goto, move
Example: Interaction with iTunesFaster than the iPhone-App!
Service Integration in the Web of Things 172|Simon Mayer
http://people.inf.ethz.ch/mayersi
Yields useful interfaces
Covers lots of use cases: Home automation, A/V, lecture
controls, car controls, etc.
Markup is easily producible for tech-savvy users
Microdata
Embedded Interaction Information: InterWoTions
Service Integration in the Web of Things 173|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microdata
Discussion
Rating Comments
Interface
DiscoveryNone Requires to fall back on crawling or indexing
Automatic
Service UsageNo No standard format to annotate Web APIs
Level of
Semantic
Integration
PartialAllows to define an object’s class/type, if
ontologies like schema.org are used
Simplicity EasyAnnotation of HTML representations required.
Better usability than Microformats
Service Integration in the Web of Things 174|Simon Mayer
http://people.inf.ethz.ch/mayersi
We never actually tried that! Rather, we moved on to explore “full”,
functional semantic integration…
Works only for HTML representations (like Microformats)
W3C working on Microdata-RDF Transformation
Microdata
Discussion
Allows to define an object’s class/type, if
ontologies like schema.org are used
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
Goal: Extract interesting information about a device
regardless of the annotation format
Approach: Discovery based on a runtime-dynamic set of
strategies (Microformats-Strategy, Microdata-Strategy, proprietary
strategies, etc.)
Brief Outtake! How to merge different embedded
Metadata Descriptions
S. Mayer, D. Guinard. An Extensible Discovery Service for Smart Things, 2011
Forecast: Rain
Temperature: 24˚C Please configure
forecast data source
Your fridge currently
consumes 45W
I’m located in Zurich!
Human-readable and understandable
Lots of smart things…
...and multiple semantic annotation formats...
“data”:[“weather-
forecast”:”Rain”],
“name”:”MyNabaztag”
…<div itemscope><div
itemprop=“tag=“>Illumination</div><div
itemprop=“value”>150</div></div>…
...
<div class="geo">GEO: <span
class="latitude">8.549902</span>,
<span class="longitude">-
47.378088</span></span></div>
“consumption”:”45”,
“unit”:”Watts”,
“appliance”:”fridge”
...and multiple semantic annotation formats...
“data”:[“weather-
forecast”:”Rain”],
“name”:”MyNabaztag”
…<div itemscope><div
itemprop=“tag=“>Illumination</div><div
itemprop=“value”>150</div></div>…
...
<div class="geo">GEO: <span
class="latitude">8.549902</span>,
<span class="longitude">-
47.378088</span></span></div>
Content type:
application/json
Content type: text/html
Annotations: Microdata
Content type: text/html
Annotations: Microformats
Machine-readable
“consumption”:”45”,
“unit”:”Watts”,
“appliance”:”fridge”
Content type:
application/json
Does every smart device have to be
capable of parsing every single
format...?
Service Integration in the Web of Things 181|Simon Mayer
http://people.inf.ethz.ch/mayersi
And it gets worse...
“data”:[“weather-forecast”:”Rain”],
“name”:”MyNabaztag”
Imagine we agreed on everybody using application/json...
Content type:
application/json
“data”:“weather-forecast”:”Rain”,
“name”:”MyNabaztag”
“data-item”:[“weather-forecast”:”Rain”],
“name”:”MyNabaztag”
Service Integration in the Web of Things 182|Simon Mayer
http://people.inf.ethz.ch/mayersi
A single, agreed upon,
standard format
Options for annotating smart things
Or multiple (but few!) formats
Syntax problem remains
Probably not feasible...
Service Integration in the Web of Things 183|Simon Mayer
http://people.inf.ethz.ch/mayersi
Different Syntax: OK!
A method to understand
multiple different formats
Options for annotating smart things
Future formats?
Service Integration in the Web of Things 184|Simon Mayer
http://people.inf.ethz.ch/mayersi
Different Syntax: OK!
An extensible method to
understand multiple
different formats
Options for annotating smart things
Future formats: OK!
Service Integration in the Web of Things 185|Simon Mayer
http://people.inf.ethz.ch/mayersi
Uses multiple strategies to extract metadata
More strategies can be loaded at runtime
Can handle protected resources and resources behind firewalls
Great help for decoupling service providers and consumers
The DiscoWoT Project
GET /analyze?http://thing.org
Information about thing.org
S. Mayer, D. Guinard. An Extensible Discovery Service for Smart Things, 2011
Computer vision techniques + Embedded UI Information
=
Intuitive Interfaces!
Outtake! Embedded Metadata to Interact
with Smart Things!
S. Mayer, M. Schalch, M. George, G. Sörös: Device Recognition for Intuitive Interaction with the Web of Things, 2013
Service Integration in the Web of Things 187|Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI Metadata
Object
Categorization
Object
Tracking Rendered UI
(InterWoTions)
Service Integration in the Web of Things 188|Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI MetadataExample: Web-enabled Toy Robot
GUI / Gyroscope
Service Integration in the Web of Things 189|Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI MetadataExample: Volume Controller
GUI / Gyroscope
Service Integration in the Web of Things 190|Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI MetadataSoon for cars?
Service Integration in the Web of Things 191|Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI MetadataSoon for cars?
Service Integration in the Web of Things 192|Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI MetadataCurrent status…
Service Integration in the Web of Things 193|Simon Mayer
http://people.inf.ethz.ch/mayersi
Microdata-based metadata is absolutely suitable for this!
Lots of potential, if data access is ensured!
Embedded UI information + Object RecognitionConclusion
S. Mayer, C. Beckel, B. Scheidegger, C. Barthels, G. Sörös: Uncovering Device Whispers in Smart Homes, 2012
S. Mayer, M. Schalch, M. George, G. Sörös: Device Recognition for Intuitive Interaction with the Web of Things, 2013
Service Integration in the Web of Things 194|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple crawling for interface discovery
Requires hyperlinks to be present!
Application: Access right management
Structured Data (Microformats and Microdata) for simple embedding of
metadata in resources
Application: Web of Things search engine
Application: Embedding of interaction information
Take-home Points
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
Service Integration in the Web of Things 196|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple Hypermedia Crawling
Metadata: Microformats and Microdata
Crowd-sourced Service Integration
Web Linking: “Globalized” HATEOAS?
Semantics-based Service Integration
Web Linking + Metadata Embedding My own current research…
Service Integration: “Self-aware” Things?
Techniques for Semantic Service Integration
However…
These are constrained to
operating within hypermedia
applications!
They require HATEOAS-style hypermedia controls to be already present!
[example coming right up…]
All possible state transitions of an application are under
control of the server. To guide clients in applications, the
server provides hyperlinks that they may follow
Clients only follow provided hyperlinks! “follow your nose”
Take Care! What if a client wants to buy a book, but
only finds a link “Add to shopping cart”?
Representational State Transfer (REST)
HATEOAS [Hypermedia as the Engine of Application State]
I can do
that! What about
me??
Still remember this?
http://bookstore.org/carts/simon http://bookstore.org/books/book1
http://bookstore.org/checkout?customerID=simon
Example from REST Introduction
Known URL!
“Recommended Books: Book1
Books in your cart: None.
Checkout not possible (no books).”“This is Book1. It’s great!
Add book to cart”
GET books/book1
POST carts/simon?book=Book1
“Select payment type:
Credit Card, Debit Card”
Example from REST Introduction
/book/cart
/checkout
What about multiple stores?
Not possible! No Link!
/book/cart
/checkout
/book/cart
/checkout
Store A
Store BI found this great book at store
A. It also exists in store B.
I’d like to buy it there!
I can
do that!…
Simon’s Office
- Contains 2 services
More seriously: Think about a smart environment…
I have a song title,
“Yellow Submarine”.
I’d like to play that song.
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Plays song
Not possible! No Link!
I can do
that, too! Will you stop
now !
It’s the “follow your nose”-Problem again!What if a client wants to “buy” a book, but only finds a link “Add to shopping cart”?
Hm, you
know. I can…YES! I got it.
Our goal is to enable it for this guy!
Service Integration in the Web of Things 204|Simon Mayer
http://people.inf.ethz.ch/mayersi
Special-purpose link lists that can be queried by users
Various implementations: Web Linking metadata
Link repositories
Multiple ways of constructing these
Crowd-sourced Linkbases
Semantics-based Linkbases
Globalization of HATEOAS: Linkbases
vs.
Service Integration in the Web of Things 205|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple Hypermedia Crawling
Metadata: Microformats and Microdata
Crowd-sourced Service Integration
Web Linking: “Globalized” HATEOAS?
Semantics-based Service Integration
Web Linking + Metadata Embedding My current research…
Service Integration: “Self-aware” Things?
Techniques for Semantic Service Integration
Service Integration in the Web of Things 206|Simon Mayer
http://people.inf.ethz.ch/mayersi
Rely on developers or users to publish links
Globalization of HATEOAS
Crowd-sourced Linkbases
Simon’s Office
- Contains 2 services
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
I know that you can
connect these services!
Let me show you!
Service Integration in the Web of Things 207|Simon Mayer
http://people.inf.ethz.ch/mayersi
S. Mayer, D. Karam. A Computational Marketplace for the Web of Things, 2012
Mashup developers find links manually, but publish their
mashups in a “WoT Marketplace”
Clients can ask the marketplace for linking information
These links make sense, because they are used in a mashup!
Clients only need to choose which link to follow
Yay! That sounds like we can use HATEOAS again!
Globalization of HATEOAS
Crowd-sourced Linkbases
Service Integration in the Web of Things 208|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases
Marketplace
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
Service Integration in the Web of Things 209|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases
Marketplace
Node A
Node B
Node C
Node D
Node F
Marketplace exposes linking metadata about nodes!
Node X: www.wot_marketplace.org/nodes/X
GET wot_marketplace.org/nodes/A
“service” : “www.songsearch.org”
“forward_paths” :
# None
Service Integration in the Web of Things 211|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases
Marketplace
Node A
Node B
Node C
Node D
Node F
I know that you can
connect the services at
A and F!
POST wot_marketplace.org/nodes/A?link=nodes/F&name=play_song
202 Created
Globalization of HATEOAS
Crowd-sourced Linkbases
Marketplace
Node A
Node B
Node C
Node D
Node F
Now, others can use
that information!
play_song
GET wot_marketplace.org/nodes/A
“service” : “www.songsearch.org”
“forward_paths” :
“play_song” : “nodes/F”
GET wot_marketplace.org/nodes/A
“service” : “www.songsearch.org”
“forward_paths” :
“play_song” : “nodes/F”
I can do that
now, too!
Service Integration in the Web of Things 216|Simon Mayer
http://people.inf.ethz.ch/mayersi
Clients need to be able to find services on the
marketplace and select appropriate services to achieve
their goal
The marketplace should provide meta-information about
services and thus help to optimize traversal
Mechanisms are required for security and billing
Globalization of HATEOAS
Crowd-sourced Linkbases
Service Integration in the Web of Things 217|Simon Mayer
http://people.inf.ethz.ch/mayersi
Clients need to be able to find services on the
marketplace and select appropriate services to achieve
their goal
The marketplace should provide meta-information about
services and thus help to optimize traversal
Mechanisms are required for security and billing
Globalization of HATEOAS
Crowd-sourced Linkbases
Service Integration in the Web of Things 218|Simon Mayer
http://people.inf.ethz.ch/mayersi
Marketplace API exposes paths
“Graph Crawler” keeps all paths up-to-date
Basically an ordinary search machine…
Globalization of HATEOAS
Crowd-sourced Linkbases: Interface Discovery
GET wot_marketplace.org/nodes/A
“service” : “www.songsearch.org”
“forward_paths” :
“play_song” : “nodes/F”
Service Integration in the Web of Things 219|Simon Mayer
http://people.inf.ethz.ch/mayersi
Clients need to be able to find services on the
marketplace and select appropriate services to achieve
their goal
The marketplace should provide meta-information about
services and thus help to optimize traversal
Mechanisms are required for security and billing
Globalization of HATEOAS
Crowd-sourced Linkbases
Service Integration in the Web of Things 220|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases: Service Traversal
The following use case is about
arrhythmia detection
We have a heartbeat feed and an
arrhythmia detector.
We want to decide whether to follow the
“ambulance” link
Service Integration in the Web of Things 221|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases: Service Traversal
Service Integration in the Web of Things 222|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases: Service Traversal
Yes, this is hard!But at least we have links again and can “outsource” the logic to
the client…
Here, clients are not “compiled” against the links anymore,
but against the link names!
This is a bit less bad…
Task: Implement a client such that it follows
the emergency link when the probability for
arrhythmia is higher than 50%
Service Integration in the Web of Things 224|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases: Service Traversal
Service Integration in the Web of Things 225|Simon Mayer
http://people.inf.ethz.ch/mayersi
Clients need to be able to find services on the
marketplace and select appropriate services to achieve
their goal
The marketplace should provide meta-information about
services and thus help to optimize traversal
Mechanisms are required for security and billing
Globalization of HATEOAS
Crowd-sourced Linkbases
Service Integration in the Web of Things 226|Simon Mayer
http://people.inf.ethz.ch/mayersi
GET wot_marketplace.org/nodes/A
“service” : “www.arrhythmia_detect.net”
“forward_paths” :
“play_song” :
“node” : “nodes/F”,
“cost”:”0.02$”,
“delay”:”1sec”
Service Integration in the Web of Things 227|Simon Mayer
http://people.inf.ethz.ch/mayersi
Optimize traversal according to application needs
Multi-dimensional cost metrics: time, money, quality,...
Marketplace offers this information, but does not decide
on routes → Generic path deciders
Globalization of HATEOAS
Crowd-sourced Linkbases: Path Optimization
Service Integration in the Web of Things 228|Simon Mayer
http://people.inf.ethz.ch/mayersi
Marketplace
Globalization of HATEOAS
Crowd-sourced Linkbases
Node A
Node D
Node B
Node C Node E
This is for arrhythmia
detection, again!
Node A: Heartbeat feed
Nodes B, C, D: Arrhythmia Detectors. The marketplace provides delay metadata
Node E: Emergency-Link, “Call Ambulance” Service
This is the actual thing! (we use gephi.org/ to create these)
S. Mayer, D. Karam. A Computational Marketplace for the Web of Things, 2012
Task: Implement a client that
always uses the arrhythmia
detector with the lowest delay
Service Integration in the Web of Things 231|Simon Mayer
http://people.inf.ethz.ch/mayersi
Generic service traversal (lowest time cost path)
Globalization of HATEOAS
Crowd-sourced Linkbases: Path Optimization
Result: Automatic load balancing!That’s why we call it “marketplace”
Service Integration in the Web of Things 233|Simon Mayer
http://people.inf.ethz.ch/mayersi
Clients need to be able to find services on the
marketplace and select appropriate services to achieve
their goal
The marketplace should provide meta-information about
services and thus help to optimize traversal
Mechanisms are required for security and billing
Globalization of HATEOAS
Crowd-sourced Linkbases
Service Integration in the Web of Things 234|Simon Mayer
http://people.inf.ethz.ch/mayersi
Authentication, authorization, and billing schemes to
restrict access to computational resources
Don’t create a centralized repository for login data
Trust problems, security problems, scaling problems...
Instead use third-party schemes (like OAuth 2.0) and
inline this functionality as a linked computational node!
Globalization of HATEOAS
Crowd-sourced Linkbases: Security and Billing
Service Integration in the Web of Things 235|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases
Marketplace
Node A
Node B
Node C
Node D
Node F
The OAuth node controls
access to the media player!
Service Integration in the Web of Things 236|Simon Mayer
http://people.inf.ethz.ch/mayersi
Crowd-sourced Linkbases
Discussion
Rating Comments
Interface
DiscoveryYes Requires developers or users to publish links
Automatic
Service UsagePartial Only on syntactic level (data types and formats)
Level of
Semantic
Integration
None No annotations
Simplicity TrickyRelies on enough participants! And on them
being reliable enough!
Again, this didn’t enable automatic service usage!
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic Mountains
Service Integration in the Web of Things 239|Simon Mayer
http://people.inf.ethz.ch/mayersi
Can we automate the publishing of links?
Globalization of HATEOAS
Crowd-sourced Linkbases
Simon’s Office
- Contains 2 services
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
Service Integration in the Web of Things 240|Simon Mayer
http://people.inf.ethz.ch/mayersi
Simple Hypermedia Crawling
Metadata: Microformats and Microdata
Crowd-sourced Service Integration
Web Linking: “Globalized” HATEOAS?
Semantics-based Service Integration
Web Linking + Metadata Embedding My current research…
Service Integration: “Self-aware” Things?
Techniques for Semantic Service Integration
Service Integration in the Web of Things 241|Simon Mayer
http://people.inf.ethz.ch/mayersi
Use semantic metadata to find potential links!
Globalization of HATEOAS
Semantics-based Linkbases
Simon’s Office
- Contains 2 services
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
R.Verborgh et al. RESTdesc - A Functionality-Centered Approach to Semantic Service Description and Composition, 2012
S. Mayer and G. Basler. Embedded Semantic Metadata to Support Device Interaction in Smart Environments, 2013
Service Integration in the Web of Things 242|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases
Simon’s Office
- Contains 2 services
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
Based on what I know
about these services, there
could be a link here!
Service Integration in the Web of Things 243|Simon Mayer
http://people.inf.ethz.ch/mayersi
We’ve already seen limited metadata embedding…
This time, we mean it!
Functional semantic service descriptions
Semantic reasoner to process these descriptions
Globalization of HATEOAS
Semantics-based Linkbases
How? Connect that information to its API
What?Describe what a service does
Service Integration in the Web of Things 244|Simon Mayer
http://people.inf.ethz.ch/mayersi
Usability as one major constraint
It should not be too hard to create service descriptions
It should be easy to create user goals
Pragmatism as another
Make use of previous research in semantic technologies
Use existing ontologies. Avoid creating new ones!
Format: Notation3 (user-friendly RDF with inference rules)
Globalization of HATEOAS
Semantics-based Linkbases
The title of the resource people.org/person1/, is “Person 1”, and it knows
another resource, people.org/person2/
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc=http://purl.org/dc/elements/1.1/ xmlns:foaf="http://xmlns.com/foaf/0.1/">
<rdf:Description rdf:about=“people.org/person1/">
<dc:title>Person 1</dc:title>
<foaf:knows>people.org/person2/</foaf:knows>
</rdf:Description>
</rdf:RDF>
Sta
nd
ard
RD
F/X
ML
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
<people.org/person1>
dc:title "Person 1";
foaf:knows "people.org/person2/".
No
tati
on
3Brief N3 Primer: Statements
Remember Catherine’s talk?
Turtle Syntax
Brief N3 Primer: Rules
𝑹𝒖𝒍𝒆: 𝑃𝑟𝑒𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 → 𝑃𝑜𝑠𝑡𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛
“people.org/person1/ knows people.org/person2/ ”
implies
“people.org/person2/ knows people.org/person1/ ”
If one person knows another person, this second person also knows the first. (“foaf:knows is symmetric”)
No
tati
on
3Brief N3 Primer: Rules
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
Precondition.
=>
Postcondition.
is shorthand for=> log:implies
If one person knows another person, this second person also knows the first. (“foaf:knows is symmetric”)
No
tati
on
3Brief N3 Primer: Rules
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix foaf: <http://xmlns.com/foaf/0.1/>.
?x a foaf:Person;
foaf:knows ?y.
=>
?y foaf:knows ?x.
If one person knows another person, this second person also knows the first. (“foaf:knows is symmetric”)
is shorthand for=> log:implies
Superb tutorial at n3.restdesc.org (by Ruben Verborgh)
Service Integration in the Web of Things 249|Simon Mayer
http://people.inf.ethz.ch/mayersi
Now: Semantic metadata for the Songs Search Machine
Simon’s Office
- Contains 2 services
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
Globalization of HATEOAS
Semantics-based Linkbases: Metadata
Service Integration in the Web of Things 250|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Metadata
Precondition: Facts that are required for a meaningful execution of the service
-> Knowledge of a Song Title
Postcondition: Additional facts that hold after an execution of the service?”
-> Knowledge of a URL of a song with that title
Songs Search
Machine
Method: GET
Input: Song Title
Output: MP3 URL
No
tati
on
3The Songs Search Machine
@prefix dc: <http://purl.org/dc/elements/1.1/>.
Precondition.
=>
Postcondition.
If we know a song title, we also know the URL of a song with that title.
If we know a song title, we also know the URL of a song with that title.
No
tati
on
3The Songs Search Machine
@prefix dc: <http://purl.org/dc/elements/1.1/>.
?songTitle a dc:title.
=>
?songURL a dc:Song;
myOnt:hasTitle ?songTitle.
Store this as ssm_rule.n3
Service Integration in the Web of Things 253|Simon Mayer
http://people.inf.ethz.ch/mayersi
Now, we only need to link that to the service!Multiple ways to do that…
We use HTTP OPTIONS for that
“This method allows the client to determine the options and/or requirements
associated with a resource, or the capabilities of a server, without implying a
resource action or initiating a resource retrieval.” (RFC 2616)
OPTIONS www.ssm.org
Link: <ssm_rule.n3>; rel=“describedBy“
We use the Link Header (RFC 5988) to return the description
Demonstration!
Songs Search
Machine
ssm_rule.n3
Who is not convinced?
Me!!
Why is that?
After reading ssm_rule.n3, I know
that I can get a song URL.
But I don’t know how!
How to include the request? Basically two options…
𝑹𝒖𝒍𝒆: 𝑃𝑟𝑒𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 ∧ 𝑅𝑒𝑞𝑢𝑒𝑠𝑡 → 𝑃𝑜𝑠𝑡𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛
𝑹𝒖𝒍𝒆: 𝑃𝑟𝑒𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 → 𝑃𝑜𝑠𝑡𝑐𝑜𝑛𝑑𝑖𝑡𝑖𝑜𝑛 ∧ 𝑅𝑒𝑞𝑢𝑒𝑠𝑡
This works, but is impractical (knowledge about all requests required from the start…)
It also messes up the quantification!
“Given the Preconditions, all GET requests give the Postcondition”
This works too, and it is sound!“Given the Preconditions, there exists a GET request that gives the Postcondition”
R.Verborgh et al. RESTdesc - A Functionality-Centered Approach to Semantic Service Description and Composition, 2012
The second option
sounds better to me!
No
tati
on
3The Songs Search Machine
@prefix dc: <http://purl.org/dc/elements/1.1/>.
?songTitle a dc:title.
=>
?songURL a dc:Song;
myOnt:hasTitle ?songTitle.
Request.
If we know a song title, we also know the URL of a song with that title. Plus, we
know about an HTTP request.
No
tati
on
3The Songs Search Machine
@prefix dc: <http://purl.org/dc/elements/1.1/>.
@prefix http: <http://www.w3.org/2011/http#>.
?songTitle a dc:title.
=>
?songURL a dc:Song;
myOnt:hasTitle ?songTitle.
_:request http:methodName “GET”;
http:requestURI (<www.ssm.org?title=>?songTitle);
http:resp [ http:body ?songURL ].
Store this as ssm_rule.n3 We’ll refer to it as a “RESTdesc” description
If we know a song title, we also know the URL of a song with that title. Plus, we
know about an HTTP request.
“Yellow Submarine” a dc:title.
“Yellow Submarine” a dc:Title.
?songURL a dc:Song;
myOnt:hasTitle “Yellow Submarine”.
_:request http:methodName “GET”;
http:requestURI (<www.ssm.org?title=>?songTitle);
http:resp [ http:body ?songURL ].
[+ proof]
ssm_rule.n3
But how do I say that
I want a song URL?
“Yellow Submarine” a dc:title.
Goal: ?song a dc:Song; hasTitle “Yellow Submarine”.
A proof that is parsed to an internal HTTP request description format
Send a GET request to www.ssm.org?title=songTitle and substitute “songTitle” with
“Yellow Submarine”. Then, unpack the response. Its body contains the song.
GET ?title=YellowSubmarine
www.songs.org/yellowsub.mp3
ssm_rule.n3
Songs Search
Machine
ssm_rule.n3
Why does this solve the
missing links Problem?
Service Integration in the Web of Things 263|Simon Mayer
http://people.inf.ethz.ch/mayersi
First: Add semantic metadata to the Media Player!
Globalization of HATEOAS
Semantics-based Linkbases: Metadata
Simon’s Office
- Contains 2 services
Songs Search
Machine
ssm_rule.n3
Media Player
Method: PUT
Input: MP3 URL
Output: Will play music
Service Integration in the Web of Things 264|Simon Mayer
http://people.inf.ethz.ch/mayersi
Parfait!
Globalization of HATEOAS
Semantics-based Linkbases: Metadata
Simon’s Office
- Contains 2 services
Songs Search
Machine
ssm_rule.n3
Media Player
mp_rule.n3
I want to play “Yellow
Submarine” now!!
Then formulate your goal.
But be precise!
?state a st:State;
log:includes
:SimonsOffice musicPlaying [ myOnt:hasTitle “Yellow Submarine” ]
I want Simon’s office to be in a state
where “Yellow Submarine” is playing.
“Yellow Submarine” a dc:title.
Client Goal
A proof that can be parsed to an internal HTTP request description format
Send a GET request to www.ssm.org?title=songTitle and substitute “songTitle”
with “Yellow Submarine”. Then, unpack the response. Its body contains the
songURL. Take this variable and send a PUT to www.mp.org?song=songURL
Execute the requests to play the song!
ssm_rule.n3
mp_rule.n3
Send a GET request to www.ssm.org?title=songTitle and substitute “songTitle” with
“Yellow Submarine”. Then, unpack the response. Its body contains the songURL. Take this
variable and send a PUT to www.mp.org?song=songURL
Media Player
mp_rule.n3
GET ?title=YellowSubmarine
www.songs.org/yellowsub.mp3
Songs Search
Machine
ssm_rule.n3
PUT ?song=www.songs.org/yellowsub.mp3
www.songs.org/yellowsub.mp3
Now, yellowsub.mp3 is playing in Simon’s office!
Sounds complicated. Could you
summarize what I have to do?
1. Formulate your goal
2. Search for a reasoner (e.g., using InfraWoT)
3. Ask the reasoner how to reach the goal
4. Parse the proof to extract the requests
5. Execute the requests
I don’t believe this!
Let’s see it!
http://192.168.8.102:8000/proof?q=http://people.inf.ethz.ch/
mayersi/n3goals/user-goal-
music.n3&r=http://people.inf.ethz.ch/mayersi/n3goals/user-
input.n3
+ reasoner has access to ssm_rule.n3, mp_rule.n3, and a states ontology.
Do Proof!(the two n3 files aren’t online anymore)
Oh, it actually works…
Isn’t it too hard to create the
goal, for a client like me?
That’s tricky. But we’re working on it!
One idea is to integrate the goal creation with Clickscript.
And you know how to use that, right?
Service Integration in the Web of Things 273|Simon Mayer
http://people.inf.ethz.ch/mayersi
A standard semantic reasoner
Lots of research done into this, optimized
Can handle lots of inference rules, will not be the
bottleneck, at least for home automation scenarios
Infer what a smart environment can do for us!
And how to trigger that functionality!
Globalization of HATEOAS
Semantics-based Linkbases: Discussion
Service Integration in the Web of Things 274|Simon Mayer
http://people.inf.ethz.ch/mayersi
Set favorite song on your mobile
phone to create a music stream
that follows you!
Indoor localization service
Stream server/transmitter
Stream players/receivers in all
rooms
Globalization of HATEOAS
Semantics-based Linkbases: Prototype
S. Mayer and G. Basler. Semantic Metadata to Support Device Interaction in Smart Environments, 2013
Service Integration in the Web of Things 275|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Prototype
A music stream that “follows” the user
Service Integration in the Web of Things 276|Simon Mayer
http://people.inf.ethz.ch/mayersi
Implementation (version 1)
Passive reasoner: Only active when queried by the client
Implementation (version 2)
Reasoner actively searching for services using the InfraWoT
discovery infrastructure
Globalization of HATEOAS
Semantics-based Linkbases: Prototype
Service Integration in the Web of Things 277|Simon Mayer
http://people.inf.ethz.ch/mayersi
Too many requests! 10s to change the song!
Globalization of HATEOAS
Semantics-based Linkbases: Prototype v1
Service Integration in the Web of Things 278|Simon Mayer
http://people.inf.ethz.ch/mayersi
Working on this… stay tuned!
Scalability testing looks good
InfraWoT strategy: Growing scopes
Globalization of HATEOAS
Semantics-based Linkbases: Prototype v2
Hm. So I should
just state my goals.
And I can find and
use services, too!
Crowd-sourced Linkbases
Discussion
Rating Comments
Interface
DiscoveryYes Only requires service entry endpoints
Automatic
Service UsageYes Contains API annotations for automatic usage
Level of
Semantic
Integration
Partial
Uses reasoner to deduce paths for reaching the
user’s goal. Does not make use of big ontologies
(but could/should…)
Simplicity ?
Requires annotation of devices and definition of
goals. Good progress, but not out of the
woods yet
Service Integration in the Web of Things 281|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Possibilities
Service Integration in the Web of Things 282|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Possibilities
Service Integration in the Web of Things 283|Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Possibilities
Semantic Service Integration Technologies: Overview
Crawling Microformats Microdata Crowd
Linkbases
Semantic
Linkbases
Interface
DiscoveryPartial None None Yes Yes
Automatic
Service UsageNo Partial No Partial Yes
Level of
Semantic
Integration
None Partial Partial None Partial
Simplicity Very Easy Medium Easy Tricky ?
Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS CliffsStructured
Data Lake
Crowded Village
Semantic MountainsUnexplored State of Usability
Service Integration in the Web of Things 286|Simon Mayer
http://people.inf.ethz.ch/mayersi
École d’Été Web Intelligence 2013 - Web des Objets
September 4th 2013, St. Germain au Mont d’Or
Simon Mayer, ETH Zurich
Service Integration in the Web of Things
Conclusion
Carinthia, Austriapresse.kaernten.at
Study techniques and technologies that
enable machines to discover smart
devices, to select appropriate services,
and to use them automatically!
Goal
Expose services as REST resources. Make
them discoverable via repositories or search
machines. Annotate them to expose their APIs
and make them automatically usable!
Approach
However, REST by itself is not enough for
automatic service usage
REST offers very interesting features for smart
environments and allows to embed API
descriptions and other metadata
We’ve seen multiple approaches to
facilitate the creation of mashups, and the
usage by machine clients
Embedding functional semantic service
descriptions could be a viable alternative to
“top-down” standardization
Service Integration in the Web of Things 291|Simon Mayer
http://people.inf.ethz.ch/mayersi
Beginnings in Europe, now intercontinental!
Web of Things Workshop Series: webofthings.org/wot
WoT 2010 @ PerCom, Mannheim
WoT 2011 @ Pervasive, San Francisco
WoT 2012 @ Pervasive, Newcastle
WoT 2013 @ UbiComp, Zurich
Community blog: webofthings.org
The Web of Things Community
Service Integration in the Web of Things 292|Simon Mayer
http://people.inf.ethz.ch/mayersi
Ruben Verborgh, David Karam
Nadine Inhelder, Gianin Basler
Markus Schalch, Andreas Tschofen
Dominique Guinard, Vlad Trifa
Matthias Kovatsch, Leyna Sadamori, Gábor Sörös
Erik Wilhelm, Josh Siegel, Sanjay Sarma
Special Thanks to Ruben, Nadine, and David for your input on these slides!
Credits
THANK YOU for this invitation !
Jean-Paul Jamont
Cécile Favre
Lionel Médini
Michaël Mrissa
Tous les participants de l’école d’été Web Intelligence 2013!
http://andrewbleakley.com
http://www.webmarchand.com
http://www.patentspostgrant.com/
http://www.orkin.com
http://sweetclipart.com
http://la-matrice.org
http://learn.randolph.k12.ma.us
http://theparisreview.org
http://bestclipartblog.com
http://freepik.com
http://http://www.rugdots.com
http://www.productdose.com
http://westwoodblinds.co.uk
http://www.ambientdevices.com
http://www.pats.ua.ac.be
http://www.vesternet.com
http://www.rovingnetworks.com
http://www.qualitymechanicalservices.com
http://chantalteakettle.org
http://blog.eeye.com
http://cartographersguild.com
http://haverford.edu
http://clker.com
http://stickers-addict.fr
http://en.wikipedia.org
Image Sources