Talk about service integration technologies in REST systems held at the "Web Intelligence 2013 - Le Web des Objets" Summer School on the 4th of September 2013 in Lyon, France. The slides give an overview of the Web of Things and current efforts to integrate services offered by Web-enabled devices.
2. Service Integration in the Web of Things 2|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Myself
Simon Mayer, PhD Student at ETH Zurich, WoT since 2009
11. 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
12. 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
13. ï§ 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
14. 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
15. 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
16. Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS Cliffs
Structured
Data Lake
Crowded Village
Semantic Mountains
Unexplored State of Usability
17. Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS Cliffs
Structured
Data Lake
Crowded Village
Semantic Mountains
Unexplored State of Usability
19. 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 Things
Services
Service
Integration
Service
Mashups
Arrive-and-
Operate
Mashup
Management
Automatic Service
Composition
20. 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)
21. 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}
22. 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
23. 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
24. 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
25. 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.â
26. 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
27. 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
28. 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
29. Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS Cliffs
Structured
Data Lake
Crowded Village
Semantic Mountains
Unexplored State of Usability
30. 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
31. 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
32. 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 :-)
33. 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
34. 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
35. 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
36. 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â]
37. 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.
38. 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
39.
40. 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
41. 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!
42. Service Integration in the Web of Things 42|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
43. Service Integration in the Web of Things 43|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
44. Service Integration in the Web of Things 44|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
45. Service Integration in the Web of Things 45|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Smart Service Composition
Possibilities
46. 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
47. Introductory Stroll
REST Beacon of Hope
HATEOAS Cliffs
Structured
Data Lake
Crowded Village
Semantic Mountains
Unexplored State of Usability
WS-* Forest
50. Introductory Stroll
REST Beacon of Hope
HATEOAS Cliffs
Structured
Data Lake
Crowded Village
Semantic Mountains
Unexplored State of Usability
WS-* Forest
51. 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
52. 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
53. 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
54. 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
55. 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
56. 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
57. 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
58. 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
59. 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
60. 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
61. 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
62. 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:binding
transport="http://schemas.xml-
soap.org/soap/http"
style="document"/>
</binding>
WSDL description
types, messages
portType
binding
service
The Service-Oriented Architecture
Main Technologies: WSDL
63. 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
64. Service Integration in the Web of Things 64|
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
Application-Server
Server Logic
Server Stub
Client
Client Stub
Client Logic
65. 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
Application-Server
Server Logic
Server Stub
66. 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
67. 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
Application-Server
Server Logic
Server Stub
Client
Client Stub
Client Logic
68. 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
Client
Client Stub
Client Logic
69. 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)
70. 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âŠ
73. 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]
75. 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
76. 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⊠;-)
77. Web-based Interaction with Smart Environments 77|
Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
âSOAP Javaâ
78. Web-based Interaction with Smart Environments 78|
Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
WSDL
79. Web-based Interaction with Smart Environments 79|
Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
UDDI
80. 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⊠;-)
81. Web-based Interaction with Smart Environments 81|
Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
RESTful
82. Web-based Interaction with Smart Environments 82|
Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Google Trends, 2004-2013
UDDI
RESTful
âSOAP Javaâ
83. 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âŠ
84. 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
85. 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
86. 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!
87. 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
88. 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
89. Web-based Interaction with Smart Environments 89|
Simon Mayer
http://people.inf.ethz.ch/mayersi
REST and WS-*
Developersâ Perspective: Study Setup
90. 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
91. 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
92. 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
93. 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
94. 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
95. 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
97. 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?
98. 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
99. 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
100. 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
101. 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
102. 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
103. 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
104. 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]
105. 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
107. Now for the cool stuff: HATEOAS
[or, Hypermedia as the Engine of Application State]
[or, the server guides clients using hyperlinks]
108. Did you ever experience that the âbackâ
button broke a hypermedia application?
e-banking, e-commerce, flights booking, etc.
Why is that?
109. â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!
110. 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
111. 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??
112. 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
113. 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
114. 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
119. 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
120. 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
122. 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)
123. 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
124. 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
126. Service Integration in the Web of Things 126|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Example Scenario
127. 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
128. 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âŠ
129. 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!
130. 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!
131. 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>(âŠ)
132. 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
133. 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!
134. 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.
?
135. 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!
136. Alright⊠from the beginning :-)
Weâll see four service integration techniques, an
example for each, and discuss their suitability for
our considered applications
137. 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
morefunctionalityâŠâŠmorecomplexity
139. 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
140. 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
141. 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
142. Service Integration in the Web of Things 142|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Hypermedia Crawling
The Friends and Things Project
143. 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
144. Service Integration in the Web of Things 144|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Hypermedia Crawling
The Friends and Things Project
145. 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
146. Service Integration in the Web of Things 146|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Hypermedia Crawling
Discussion
Rating Comments
Interface
Discovery
Partial Requires APIs to be connected via hyperlinks
Automatic
Service Usage
No
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
147. 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
148. 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?
149. 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
150. 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 Embedding
both: HTML!
151. 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
152. 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
153. 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!
154. 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
155. 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
156. 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âŠ
157. 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
158. Service Integration in the Web of Things 158|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
The InfraWoT Project: Registration
159. 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, UUID
None. 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 Description
Label, URL Template, Input,
Output
hRESTS
160. 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/thermostat
Method: HTTP PUT
Rating: 4.3 (0..5)
hProduct Category
GEO
hRESTS Input
161. 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
162. Service Integration in the Web of Things 162|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Microformats
Discussion
Rating Comments
Interface
Discovery
None Requires to fall back on crawling or indexing
Automatic
Service Usage
Partial
hRESTS allows definition of API, but no format to
describe it for machine clients
Level of
Semantic
Integration
Partial
Microformats define the semantics of objects, but
are only partially linked to ontologies
Simplicity Medium
Cumbersome annotation of HTML
representations required
163. 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
164. 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
165. 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>
166. 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
167. 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
168. GUI / Touch Screen
Haptic / Gyro
Example: Interaction with a Web-enabled LED
171. GUI / Gyroscope
Composite UI
set intensity,
switch, get data,
goto, move
Example: Interaction with iTunes
Faster than the iPhone-App!
172. 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
173. Service Integration in the Web of Things 173|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Microdata
Discussion
Rating Comments
Interface
Discovery
None Requires to fall back on crawling or indexing
Automatic
Service Usage
No No standard format to annotate Web APIs
Level of
Semantic
Integration
Partial
Allows to define an objectâs class/type, if
ontologies like schema.org are used
Simplicity Easy
Annotation of HTML representations required.
Better usability than Microformats
174. 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
176. ï§ 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
177. 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âŠ
180. Does every smart device have to be
capable of parsing every single
format...?
181. 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â}
182. 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...
183. 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?
184. 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!
185. 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
186. 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
187. 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)
188. Service Integration in the Web of Things 188|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI Metadata
Example: Web-enabled Toy Robot
GUI / Gyroscope
189. Service Integration in the Web of Things 189|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI Metadata
Example: Volume Controller
GUI / Gyroscope
190. Service Integration in the Web of Things 190|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI Metadata
Soon for cars?
191. Service Integration in the Web of Things 191|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI Metadata
Soon for cars?
192. Service Integration in the Web of Things 192|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Object Recognition + Embedded UI Metadata
Current statusâŠ
193. 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 Recognition
Conclusion
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
194. 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
196. 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
197. HoweverâŠ
These are constrained to
operating within hypermedia
applications!
They require HATEOAS-style hypermedia controls to be already present!
[example coming right upâŠ]
198. ï§ 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?
201. 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!
âŠ
202. 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 !
203. 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!
204. 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.
205. 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
206. 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!
207. 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
208. 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
209. 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
211. 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!
216. 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
217. 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
218. 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â
}
}
219. 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
220. 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
221. Service Integration in the Web of Things 221|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases: Service Traversal
222. 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âŠ
223. Task: Implement a client such that it follows
the emergency link when the probability for
arrhythmia is higher than 50%
224. Service Integration in the Web of Things 224|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Crowd-sourced Linkbases: Service Traversal
225. 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
226. 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â
}
}
}
227. 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
228. 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
229. 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
230. Task: Implement a client that
always uses the arrhythmia
detector with the lowest delay
231. 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
233. 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
234. 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
235. 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!
236. Service Integration in the Web of Things 236|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Crowd-sourced Linkbases
Discussion
Rating Comments
Interface
Discovery
Yes Requires developers or users to publish links
Automatic
Service Usage
Partial Only on syntactic level (data types and formats)
Level of
Semantic
Integration
None No annotations
Simplicity Tricky
Relies on enough participants! And on them
being reliable enough!
239. 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
240. 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
241. 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
242. 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!
243. 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
244. 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
245. 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>
StandardRDF/XML
@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/".
Notation3
Brief N3 Primer: Statements
Remember Catherineâs talk?
Turtle Syntax
246. 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â)
247. Notation3
Brief 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â)
248. Notation3
Brief 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)
249. 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
250. 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
251. Notation3
The 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.
252. If we know a song title, we also know the URL of a song with that title.
Notation3
The 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
253. 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
255. Why is that?
After reading ssm_rule.n3, I know
that I can get a song URL.
But I donât know how!
256. 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!
257. Notation3
The 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.
258. Notation3
The 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.
259. â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
261. â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
263. 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
264. 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
265. 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.
266. â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
267. 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!
268. 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
272. 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?
273. 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
274. 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
275. 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
276. 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
277. 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
278. 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
279. Hm. So I should
just state my goals.
And I can find and
use services, too!
280. Crowd-sourced Linkbases
Discussion
Rating Comments
Interface
Discovery
Yes Only requires service entry endpoints
Automatic
Service Usage
Yes 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
281. Service Integration in the Web of Things 281|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Possibilities
282. Service Integration in the Web of Things 282|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Possibilities
283. Service Integration in the Web of Things 283|
Simon Mayer
http://people.inf.ethz.ch/mayersi
Globalization of HATEOAS
Semantics-based Linkbases: Possibilities
284. Semantic Service Integration Technologies: Overview
Crawling Microformats Microdata Crowd
Linkbases
Semantic
Linkbases
Interface
Discovery
Partial None None Yes Yes
Automatic
Service Usage
No Partial No Partial Yes
Level of
Semantic
Integration
None Partial Partial None Partial
Simplicity Very Easy Medium Easy Tricky ?
285. Introductory Stroll
WS-* Forest
REST Beacon of Hope
HATEOAS Cliffs
Structured
Data Lake
Crowded Village
Semantic Mountains
Unexplored State of Usability
287. Study techniques and technologies that
enable machines to discover smart
devices, to select appropriate services,
and to use them automatically!
Goal
288. 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
289. 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
290. 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
291. 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
292. 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