Showing posts with label Ontology. Show all posts
Showing posts with label Ontology. Show all posts

Sunday, April 11, 2021

Beyond Hypermedia - Information Models and Semantic Interoperability

State of the Art in IoT interoperability today

These articles, since 2012, have focused on a number of architecture and design topics for IoT systems including REST API design, M2M protocol integration, and hypermedia controls. The "how" part of the problem of interaction between application software and networked things has, since 2012, been explored and implemented in many, sometimes competing, systems and standards. 

Throughout, there has been an assumption that there is some underlying semantic database that informs the "what" part of the problem, the high level conceptual representation of the control affordances offered by connected things. Further, the association of these control affordances to real-world entities when a system is installed is often left to the individual IoT platforms to work out.

For example, an IoT system may provide lighting control. An application may have a control for changing the brightness of one or more light sources. The application knows "what" it wants to do, to affect the brightness of a light source. The devices that implement the light source have controls for changing brightness that conform to some data model and some protocol, which determine "how" to change the brightness of the light source. 

In addition, how do I tell the application about rooms in my house, such that it knows how to control the kitchen light?

So far, interoperability between applications and connected things has been achieved by enforcing a broad agreement between all applications and all devices, both how to identify "what" is to be done, e.g. brightness control, and "how" it is to be done, e.g. changing the 16 bit integer value at software register number 3100 to set the desired brightness on a scale from 0 to 65535 representing 0 to 100% of the light source's brightness range. And so on for hundreds and thousands of settings, quantities, actuation values, across myriad IoT devices. That is to say, the operational semantics and the protocol bindings are specified by a system or standards document and agreed on by all implementers.

There are at least two major problems with this approach. One is industry fragmentation. As industry competitors squared off around IoT business pursuit, they also backed competing standards initiatives. Think of it in terms of VHS vs. Betamax, only with several competing standards backed by several different consortia. This is useful to a point, for healthy competition and technology tailored to specific use cases, but customers ultimately pay the price of incompatibility across standards. Additionally, industry growth is limited due to the perception of risk backing one standard at the expense of others.

Another limiting factor is the technical debt and brittleness associated with a monolithic approach to system design that is imposed by a "full stack" specification that contains semantic definitions as well as protocol implementation. It is often difficult to evolve the entire stack as a single entity, so some separation is inevitable. One part or the other seems to be always catching up.

Not surprisingly, the semantic definitions for connected things are all very similar. Brightness control for a light source, in the abstract, is much the same regardless of the IoT protocol used to control it. But since each of these competing IoT standards bodies had their own local context to work in, each one now has a slightly different semantic representation of light source brightness, and of course a very different protocol mapping. The IoT landscape now contains multiple regions of self-consistent, and mostly cross-consistent, but mutually incompatible digital interfaces.

What is needed is a consistent Information Model that describes the "what" in a common form that can be used across various implementation standards with diverse data models and many different ways to carry out the "how".

Toward a common Information Model for IoT

An Information Model differs from a data model mostly in level of abstraction. An information model describes concepts and relationships, where a data model describes formats and encodings. To some extent, we have used the term "data model" when we also mean "information model" but the key difference is level of abstraction.

https://tools.ietf.org/html/rfc3444 is a good document for those that want to pursue the information model discussion further.

Some research work has been going on since around 2016 on the subject of IoT Semantic Interoperability, starting with the IAB Workshop on IoT Semantic Interoperability (IOTSI) where the question was broadly taken up across industry. Some of the outcome of that workshop was to start an industry work stream to converge IoT information models and develop a common information model. We also identified the need to include development of a high level Interaction Model in the work. 

We identified the concept of a meta-model for IoT information models, a small ontology derived from well-known concepts that can be used as a template for the diverse application-specific information and interaction models that diverse IoT devices require. How can we normalize the information models at the conceptual level, such that adapting to diverse operational protocols can be done in a declarative way? What is the common ground that would enable mechanical protocol translation?

In effect, we set out to create a second "narrow waist" in system design such that application software only needs to be aware of an abstract semantic interface, consisting of common semantics and interactions, and the system can take care of adapting to the various end protocols. We are creating a single interaction layer, similar to IP networking in systems, that can minimize the complexity associated with system protocols and evolving interfaces. We are in effect de-coupling the semantics from the operational protocols around this narrow waist.



Semantic Narrow Waist

Here, the application can spend its effort on "what" to do, the automation, orchestration, and behavioral aspect of the system, without regard for "how" the individual control operations are carried out. Applications can evolve separately from protocols, being decoupled by semantic APIs. 

Applications can focus on integration with physical ontologies that describe rooms in the building, or parts of an automobile, or components of a heating system, and not worry that these associations will need to be re-factored when the protocols change.

IoT meta-model convergence

What is the basis for converging IoT information models? Starting with connected things, what is the common set of characteristics to which we can reduce all, or most, device models? Is there a common meta-model for IoT devices? What are the "atomic" elements of a generalized ioT information model?

These questions were taken up in follow-on activities to the IOTSI workshop of March 2016, specifically the W3C Web of Things Working Group (WoT), The Work on IoT Semantic and Hypermedia Interoperability (WISHI) in the Thing to Thing Research Group (T2TRG) of the IRTF, with iotschema.org, and most recently in the One Data Model Liaison group (OneDM) and SDF language.

Perhaps not surprisingly, the various IoT standardization and system designs do follow some consistent patterns in their information architecture. 

The designs are mostly modular at the function block level. That is, the information model defines basic functional components that are reusable and composable into larger, more complex, functions. For example, a light source usually has separate information model components for on/off control, brightness control, color control, energy monitoring, and other specialized functions. This allows the same building blocks to be used in a simple on/off light as in the more complex color-controlled light. 

For example, on/off control only reaches a certain level of complexity (more than many would imagine) and at some point becomes a universally applicable control to many situations. Applications only need to understand the parts they need, for example if there are timers provided they will be optional. Applications can use the same on/off control to switch lights, pumps, heaters, and so on.

Conducting a survey across a broad sweep of systems and standards reveals a common meta-model that can be extracted. The abstract information and interaction models are variously based on a small set of abstract classes that more or less align with software programming models.


Survey of Semantic Categories from various IoT Standards

Within modular functions like on/off control (e.g. software objects) there are classes that correspond to: 

  • State items that have retrievable and settable values
  • Control entry points, like RPCs, that have input and output arguments
  • Asynchronous signals that indicate something has happened.

One Data Model Liaison Group

The One Data Model liaison group was formed in late 2018, with the participants including the Zigbee Alliance, Open Connectivity Foundation (OCF), Open Mobile Alliance (OMA, LWM2M, IPSO), Bluetooth Mesh, and associated corporate representation. The initial goal was to select a set of common data models (information models) for IoT that could be shared across industry. 

The work throughout 2019 and early 2020 focused on a common meta-model and representation language, known as Semantic Description Format, or SDF. In late 2020, SDF was introduced in a new IETF working group to become an internet standard. The One Data Model liaison group will use SDF to adopt and publish a common set of information models for IoT, using the meta-model described above.

The meta-model we are converging on consists of modular function definitions, classified as "Objects" in OneDM/SDF, which contain *interaction affordances* classified as Properties, Actions, and Events, and which have associated semantic information types (Data Types) with physical quantities, engineering units, and data type constraints.


SDF (One Data Model)


SDF Feature Alignment Examples

There are currently over 200 model definitions in the OneDM "playground" for IoT device functionality, contributed mostly from OCF and OMA/IPSO Smart Object specifications. These models have been machine-converted from their native organization format. Contributed models are expected to form the basis of the OneDM published models. We are building a community process based on consensus to arrive at a set of adopted models that can be widely used in industry.

We have agreement from the contributing organizations to publish the models under the BSD 3-Clause Open Source license. This makes the models freely available for anyone to use and extend, while limiting the legal obligations of the contributors. It is expected that OneDM models will mix and match features from contributed models freely and publish models that embody the best elements and practices from all of the contributors.

OneDM will be a place where domain experts can build models specific to their applications, while taking advantage of the common and reusable tools, models, and expertise across all of the contributors. Implementers can then take these models and use them with any operational protocol they need to. The same OneDM lighting brightness model can be used with Zigbee protocols, or the OCF stack, or with OMA LWM2M protocol. 

The SDF language used in OneDM is designed to be mechanically translated to and from the native SDO model formats. LWM2M XML models, OCF models using OpenAPI (Swagger), and other source formats are translated bi-directionally to and from SDF. The API mappings are maintained separately from the abstract models, and can be applied orthogonally to any SDF model. This can be used to construct translating gateways between one IoT protocol and another, by using SDF and OneDM models as and intermediary translation step between the two endpoints, as a sort of Semantic Proxy.


Semantic Proxy

Practical Semantic Interoperability

Having a consistent set of abstract models provides a way to normalize the application interfaces to a variety of IoT protocols, but we need to build systems. We need to provide a consistent way to represent the semantic abstractions and the protocol bindings in a deployed system. 

It's not enough to specify JSON and HTTP, for example. There are still a lot of degrees of freedom to use the standard formats and protocols in specific ways. For example, POST might be used for many different purposes in HTTP. The topic structure for an MQTT deployment can be designed in many different ways. JSON can be structured in a nearly infinite number of variations to transmit the same information. 

We could rely on the written text of a standard to specify these things, but that would require bespoke implementation effort practically every time a new vendor wants to build a platform or employ a new protocol. It would be much better to have a standard, declarative, and descriptive way to specify the data formats and protocol options.

Ideally, we could extend the concepts of hypermedia controls, links and forms, to include the additional protocol metadata necessary to implement protocol bindings.

W3C Web of Things and Instance Binding

The W3C Web of Things Working Group was chartered in 2015, and has standardized a hypermedia-like format for describing instances of IoT devices and services. Thing Description (TD) is an RDF based format, using JSON-LD, that incorporates the common meta-information model of Properties, Actions, and Events, along with an extensible system of operational protocol bindings, and security protocol bindings.

Thing Description specifies a template for expressing the abstract semantic affordances of a connected thing or service, and includes protocol-level metadata for the security and operational interactions necessary to operate the thing or service within the context of some particular system.

W3C Web of Things does not specify any of the application semantics per se, only the template for a common means of expression. The Thing Description Recommendation specifies the format and vocabulary for the generic abstract affordances of Properties, Actions, and Events but does not provide any application-specific definitions for things.

The intention is for Thing Descriptions to be constructed and annotated based on application semantics from external and domain-specific ontologies and vocabularies. For example, a W3C Thing Description for a particular light bulb can be constructed based on a set of One Data Model definitions for application semantics of lighting controls (on/off, brightness, color control, energy monitor), and contain the protocol binding metadata for the specific protocols used (e.g. OMA LWM2M) such that an application that understands the abstract semantics can use a software library to operate the light bulb controls. 

Further, a Semantic API can be employed such that a single application can operate any light bulb that conforms to the abstract semantics (e.g. of One Data Model) given access to the generic protocol library for the end device protocol (e.g. OMA LWM2M). The system can obtain the protocol operational instructions from the Thing Description of the device and perform operations invoked by the abstract application software. This is the mechanism that enables the Semantic Proxy described earlier.

W3C Thing Description also enables Semantic Discovery in the system, where an application is able to configure IoT things and services based on abstract specifications. For example, a lighting application may have a goal of illuminating a room with a green color. The application can search a set of Thing Descriptions to identify which light sources have color control, i.e. discovering which resources can be used to accomplish the goal. The database of Thing Descriptions would be hosted in a discovery service, using a protocol like DNS-SD or a directory lookup system like Resource Directory with a semantic search interface. W3C WoT Working Group are currently developing discovery services to meet these criteria, for publication in a follow-on Recommendation.

The W3C WoT project includes a Scripting API that provides a standard programmatic interface to devices and services exposed through WoT Thing Descriptions. There is an implementation of this scripting API and an extensible set of protocol bindings in the node-wot project on Eclipse. Node-wot is a quick way to deploy W3C WoT in a system and can implement both clients and servers, thus a WoT instance is known as a servient. Wot applications use Thing Descriptions to instantiate exposed thing instances from a node-wot server as well as consume thing instances from a node-wot client.

Another implementation of W3C WoT uses the Node-RED platform. In this implementation, Thing Descriptions are consumed by a Node Generator, which supplies a set of application-specific and instance-specific Node-RED Nodes to the developer to insert into Node-RED Flows that define the application. Additional nodes are generated that can convert values and scales and perform other adaptations. 

High Level Semantic Integration - iotschema.org 

Another offshoot from the 2016 IAB IoT Semantic Interoperability conference is iotschema.org. The original charter was to create extensions to schema.org for IoT devices and services. 

Similar to One Data Model, iotschema definitions encapsulate some element of composable functionality, and the definitions follow the same semantic meta-model as One Data Model and W3C Thing Description, of Properties, Actions, and Events.


iotschema Pattern

Definitions in iotschema.org can be easily imported and machine converted from One Data Model, which immediately makes all of the OneDM models available in RDF.

The advantage is that iotschema uses RDF and is based on RDF linking between the elements of a definition. Thus, the relationships between elements can be described using additional vocabulary, and additional relationships between individual elements and external resources can be described. 

This enables iotschema definitions to be used much more flexibly than OneDM definitions. An application can make use of the entire device control apparatus, as in the case of the light bulb example above, or might only process usage data from the device, in which case the RDF links can provide the context for the data without burdening the application with needing to know how to interact with the device using the full operational semantics.

Since iotschema uses RDF, it is trivial to extend the semantics of a definition when it is used in some system, by adding additional links to the physical system the device or service is part of. Initially, we provide a Feature of Interest (FoI) link property to deploy the FoI pattern from the Observation and Measurement ontology, also used in SSN and SAREF. FoI links are included to link the physical context of an IoT device or service, for example to indicate that a sensor measures air temperature in a HVAC return duct from the building atrium.

Likewise, iotschema definitions, in system context, can incorporate extended data semantics to describe engineering types, data provenance, quantities and units, and arbitrary classifiers, e.g. information from a MUD. 

Extension semantics use existing and emerging ontologies. For example, there are existing IoT ontologies like SAREF and SOSA that can be cross-linked with iotschema. In W3C there are domain specific ontologies, for example VSSschema for automotive, and BRICKschema for connected and intelligent buildings. There is ongoing work to incorporate geospatial information models, to integrate location and position information.

While we are not at this time proposing any specific extensions for schema.org proper, we are advancing co-operation with the W3C Web of Things Interest Group (WoT IG) and actively participating in W3C WoT Plugfests by providing application models and application-specific vocabularies for common IoT functions.

Summary

We have developed IoT Semantic Interoperability in a number of separate fora, converging around common emergent features of industry semantic meta-models. 

  • IAB IOTSI - initial conference in 2016 to map out the problem space and establish a baseline from existing work
  • IRTF WISHI - ongoing activity to develop practical semantic interoperability through specification and implementation
  • W3C WoT - ongoing W3C standards track for a "web language" for standardized interactions with connected things
  • iotschema.org - Application-specific models in RDF that conform to a standardized meta-model with shape constraints, well-known integration point with other ontologies
  • One Data Model Liaison Group - Liaison of SDOs and industry experts to create a unified set of application-specific models for IoT devices and services
  • IETF ASDF Working Group - Specification of a standardized and developer-friendly "language" for application-specific semantic models for IoT devices and services

The basis for semantic interoperability is a common semantic meta-model, with associated application-specific and vertical extensions, that all applications can use as a semantic template for high level abstract interactions with a wide variety of real-world devices.

In practice, semantic interoperability requires a system of Protocol Binding that enables the abstract models and definitions to be associated with a particular implementation of the abstract model. This can be thought of like an extended hypermedia control. The processing of these can be at system build time or at runtime, depending on the need for dynamic adaptation.

Practical semantic interoperability for IoT also requires semantic connections to the real world, to enable the affordances offered by devices, for example, light source brightness, to be associated with real world features, such as rooms in a house or areas in a public space.

A Semantic API enables application developers to limit their concerns to the high level abstract functions being performed, and avoid issues with protocol conversions and adaptation. Common meta-models and shared application models  enable truly portable applications for IoT to be developed.

Much of the underlying software to accomplish this exists, including model translators from SDF to and from SDO data models like OCF and LWM2M, Runtime systems like node-wot and WoT for Node-RED, and tools developed in One Data Model and iotschema.org to provide developer-friendly infrastructure. We have been testing the integration patterns in W3C WoT Plugfests since 2016.

Next steps

Going forward, we plan to continue to integrate and develop the common meta-model across more of industry and more deeply across the core stack technologies.

We are calling for participation by SDOs and vertical industry groups in One Data Model, to develop industry-specific models and harmonize around the common meta-model and tools. One Data Model will begin publishing "adopted models" that are guaranteed to be stable and maintained through the community.

In iotschema.org, we will work with W3C Web of Things and other domain-specific groups on semantic integration. 

W3C Web of Things development is focused on discovery and protocol binding development, and consolidating architecture and use cases. WoT Profile is an emerging standard for simple interoperability between devices and applications.

The IETF ASDF Working Group expect to publish an RFC for the SDF language later this year, and will continue to develop SDF to address more use cases.

About the Author


Michael J Koster is a system architect and engineer with over 30 years experience designing large scale, complex, and embedded systems. He has chaired and co-chaired various IoT standards activities relating to IoT Data Models and Semantic Interoperability, including IPSO Smart Objects, OCF Data Models, iotschema.org, and most recently the One Data Model Liaison Group. His background includes computer architecture, performance modeling, hardware design, energy systems, process control systems, and analog electronics. He is currently active in IETF and W3C WoT groups.

Resources

IAB IOTSI Workshop

WISHI

One Data Model Liaison Group

IETF ASDF Working Group

W3C Web of Things

iotschema.org

node-wot

Node-RED

Domain and Other Ontologies


Sunday, September 9, 2012

Data Models for the Internet of Things #5, The Smart Object API in the IoT Infrastructure



Data Models for the Internet of Things #5, The Smart Object API in the IoT Infrastructure

9/9/2012
Michael J Koster

The goal is to create a web ecosystem of sensing, reasoning, and action around the Internet of Things.

The Smart Object API is a Semantic Web application for the Internet of Things. A RESTful web object encapsulation of semantic elements and real-time data properties, the Smart Object API provides pluggable live linked-data interaction between application software agents and IoT endpoints, sensors and user devices.

In the previous posts, I introduced the concept of a common data model for the Internet of Things based on emerging WWW technology and design patterns. I propose a Smart Object API as the basis of one such data model.

In this post I want to discuss how the Smart Object API would fit into the larger IoT infrastructure. There are a number of perspectives to consider, among them supporting service infrastructure, deployment patterns, integration with other stacks and standards, and specific build-out of the Smart Object pattern itself. 

For a reference model of the Internet of Things, I refer to the EU IoT Architecture Project's (newly revised) Architecture Reference Model, which is a broadly inclusive description of IoT architectures.

High-Level Infrastructure

For a view of the overall IoT infrastructure, and how the Smart Object API fits in, a good summary is in the IoT-Architecture document, D1.3 Architecture Reference Model, Figure 15, Functional View:


The Smart Object API defines a Virtual Entity, Application Interface, and IoT Service interface. The Smart Object framework will additionally define some common application agent patterns and a general service framework. 

The IoT Information model, figure 13 of the same document, further defines the Virtual Entity and it's component relationships. The Smart Object API has analogous relationships corresponding to it's SmartObject, Description, ObservableProperty, and the PropertyOfInterest classes.

The SmartObject class defines a VirtualEntity, ObservableProperty is an Attribute, PropertyOfInterest is a ValueContainer, Value is Instance of a Type, Descriptions are Metadata making up Service, Resource, and Device Descriptions.

 Deployment Patterns

The current deployment pattern for the IoT can be approximately characterized by the channel model described in figure 23 of the IoT ARM document:


The Smart Object API supports the concept of a Smart Gateway, which acts as a Smart Object proxy for devices on the Constrained Network, adding semantic descriptors and providing a service interface for the device representation on the Web.

Other Smart Object IoT endpoints include smart sensors, which have enough resources to interact using the service interface, and user client devices such as smartphones, which also have sufficient resources to interact using http and REST interfaces.  Smartphones can also act as ad-hoc gateways to connect to sensors over Bluetooth, USB, etc. in order to update Smart Object representations on the web. 

The CoAP protocol is a good example of a constrained protocol that is easy to integrate using the Smart Object API. CoAP defines a RESTful interface and structured resources using URIs. A Smart Object instance can be created on the gateway to act as a proxy for the CoAP resources, and a simple CoAP agent can interact with sensors on the constrained network to update the Smart Object properties and it's web app subscriptions.

There are some fixed-function constrained network gateways that support simple web interfaces. These can be easily extended using a service proxy running on a small computer like a $60 Android stick or $35 Raspberry Pi. The service proxy can interact with the gateway's fixed web interface and provide Smart Object wrappers for the attached sensors. It can provide a local service environment for application agents and direct user device interaction.

Finally, there are smart sensors with e.g. Wi-Fi interfaces that can interact directly on the Internet. These might also be though of as sensors with integrated Smart Gateways. An Arduino based sensor with a serial Wi-Fi module has enough resources to interact using a proper subset of the Smart Object API, enough to interact directly with a Smart Object proxy on a web service or another gateway. 

Integration with other Stacks and Standards

The Smart Object API is semantically identical both internally (program API) and externally (web API). This allows the API to be used as a library for web access to Smart Object instances, or by creating a local Smart Object instance that the application agent can synchronize sensor data to using subscriptions and data push.

The Agent can be used as a set of methods and handlers in a monolithic application program, or be deployed inside a service as an autonomous software entity that evaluates rules or algorithms in a data flow graph, synchronized by data updates from sensors, etc. 

Standard web formats will be used for the web interface documents. HTML, XML, JSON, and RDF are the underlying types with PropertyOfInterest data type being negotiated semantically.

The data model should be interoperable with the Semantic Web linked data formats. GET on Smart Object level URIs should by default point to the RDF describing the Smart Object to enable further interaction. 

The data model is fundamentally interoperable with CoAP, and allows simple transparent caching proxy implementation between CoAP and Smart Object API, using a CoAP Agent to manage the caching, subscription updates, etc. An instance of a Smart Object API can be created on a CoAP node if resources permit, by routing resources using URI-Path as per the CoAP Feature Analysis document.

Smart Object Service Framework

Some additional functions are needed to create a build-out infrastructure for a prototype Smart Object Service. 

The Smart Object itself can have some common patterns built in:

Methods for self-assembling Smart Objects from Descriptions. Structural RDF elements describe ObservableProperty instances and Agent Instances. These instances should be created from the RDF itself, allowing Smart Objects to create and replicate themselves from sensor and composite object descriptions.

A semantic discovery and linkage engine is needed to allow application agents to connect to ObservableProperty instances of other Smart Objects. Facilitates examining RDF descriptions and constructing URIs to interact with and create subscriptions to properties of interest.

Reference agents for common patterns, e.g. timer, PID controller. Usable as templates for more sophisticated agents. Pluggable agents.

Services need a few additional features for managing collections of Smart Objects:

RDF crawler, database, indexing and discovery engine with SPARQL interface. A service can crawl the RDF and build search indices for first order discovery. Services can be built for large-scale discovery and linkage by crawling other services and aggregating results using MapReduce.

API capability-by-method key management framework. Key generator API using user secret. Key lifetime management. 

URI router for path based routing to Smart Objects on service. Threaded web server interface. Facilitates scale-up of service to web volumes.

Summary

The Smart Object API is a Semantic Web Linked Data application for the Internet of Things (IoT). It consists of a URI-Object encapsulation of semantic and real-time data properties associated with features of interest. 

The Smart Object architecture roughly conforms to the Virtual Entity, the Information Model, and the Channel Model set out in the IoT-A Architecture Reference Model (IoT-A ARM).

Supports direct interaction between smart sensors, smart gateways, cloud/internet services, and user devices. Interaction uses standard web protocols and formats and is semantically a superset of the CoAP protocol.

Service framework is to include object creation from semantic metadata, semantic database, discovery, and linkage, API capability keys, and threaded server.

Bibliography

SPITFIRE: Towards a Semantic Web of Things

Pfisterer, Roemer, et. al. 

A Resource Oriented Architecture for the Web of Things
Guinard, Trifa, Wilde
http://www.sciweavers.org/publications/resource-oriented-architecture-web-things

Building Blocks of the Internet of Things: State of the Art and Beyond
Serbanati, Medaglia, Ceipidor

Linked Data - Design Issues
Tim Berners-Lee

The Scale-free nature of the Web
Tim Berners-Lee

CoAP Feature Analysis
draft-shelby-6lowapp-coap-00
Shelby, et. al. 

Constrained Application Protocol (CoAP) 
draft-ietf-core-coap-11
Shelby, et. al.

Architectural Reference Model for the IoT (updated)
Updated reference model for IoT v1.5, Internet-of-Things Architecture EC Project
Bassi, Giacomin reviewers
D1 3_Architectural_Reference_Model_updated.pdf




Thursday, August 30, 2012

Architecture for a Semantic Web of Smart Objects, part 2, Constraints and API

Data Models for the Internet of Things Part 4, Smart Object API and Architecture

8/30/2012
Michael J Koster

The goal is to create a web ecosystem of sensing, reasoning, and action around the Internet of Things.

In the first post I talked about the current Internet of Things architecture as consisting of sensor nets connected to web services in a mostly vertical fashion. That is, there are systems consisting of sensors, a gateway, and a cloud service where the gateway interacts with the cloud service in a specific or even proprietary fashion. Likewise the API for adding applications to the service is either private to that service or at least a service-specific API. There is a different API for each service.

Yet the interactions between gateway and service, and the affordances the service provides to applications are mostly the same. These gateways interact with the cloud service using web capable RESTful interfaces. There are common patterns emerging for these interfaces and APIs

There are many new sensors, from personal fitness trackers to buddy lamps that turn on and off together halfway around the world. To bring each new idea to market requires a lot of plumbing to be reinvented, mostly from standard parts and patterns. When they're done, they don't talk to each other. There's practically no way to second source a service or to create an application that can arbitrarily mash up data streams. A connector is needed for each service and the only access is to the stored datastream. Cosm, Nimbits, Sen.se, ThingWorx have different APIs that all do the same things. There is no standard way for gateways to interact directly with each other or with user devices like smartphones.

The opportunity is for a simple, open set of constraints and conventions around the existing pattern using sensor nets, gateways, and web services. A standard web API and M2M protocol will allow gateways, smart sensors, services, and user devices to interact with each other at the granular, scale-less level of "things". 

The Smart Object is a Semantic Web application for the Internet of Things

In the earlier posts, I describe a Smart Object as a self-describing internet representation of a thing of interest. It's a generalization of the concept of a sensor that can interact directly with services. 

The Semantic Web is a set of tools that enable semantic discovery and linkage of web objects pointed to by URLs. These tools can be used to enable content-based discovery and linkage, which is necessary to support interaction at a granular scale within a large system.

In the context of this discussion, a Smart Object is an entity, pointed to by a URL, that encapsulates some Observable Properties along with their Semantic Web descriptions, and application software agents with a RESTful API. An Observable Property can be anything from a sensor reading to an arbitrary document.

It's all about the API

The Smart Object API enables semantic discovery and linkage, access to Observable Properties, and control of application agents. 

Observable Properties from one Smart Object to another are linked by a subscribe/notify method that optionally generates callbacks to application handlers. 

The API uses named and described elements inside the object to interact with the Smart Object using a simple RESTful interface. In this way an agent or service proxy wishing to interact with an object's Observable Properties can discover enough information to connect Observable Properties to algorithms and actuators. 

The Smart Object API looks the same to an agent inside the object as it does on the RESTful web interface. M2M interactions between an agent at one node and an object on another over http consist of simply generating, exchanging, and scanning document fragments. Agent software can in this way be plugged into data streams based on semantic compatibility and linkage criteria.

Architected Constraints for a base Smart Object Semantic Model

This is a description of a semantic reference model for a Smart Object, and a list of API methods based on that reference model. This defines the API and reference architecture of a Smart Object.

The model is object oriented and extensible. The elements define their own methods and interfaces. The elements are chosen to allow simple idempotent operations with storage semantics, i.e. a CRUD style interface using REST principles.


I'm using a form of declarative constraints to define the model where the basic form is a graph showing linked entity-relationship triples to define patterns. Here's an example:



An object "Has" a element (one or more) which "Is" a Pattern is more precisely "An object has contained within it a top level named element, which is an instance of class "Pattern"

A shorthand is Object has Pattern meaning one or more instances of a Pattern.

Smart Object Pattern

Here is the current proposed Smart Object Pattern:

This shows the constrained relationships between the SmartObject's top level elements. The Smart Object is pointed to by a URL and a path to each method is exposed e.g. :

URL = Object.Description.ADDTRIPLES(triples);

The Observable Properties are the representations of individual things at any granular scale level, from say a temperature reading to an entire document. They are also self-describing objects.

The Description contains RDF triples describing the Object's top level elements; The Observable Properties and Agents, and overall description of the Object itself.

The Agent pattern shows how Application Agents and the Web API agent (web proxy) see the same underlying methods, thus have the same API, local or remote. An Agent can be either the Web API proxy for Web clients, plus any number of separate Application Agents that can be created within the scope of the Smart Object. 

Agents have a Web client they use for interacting with Smart Objects on other services, gateways, user devices, etc. using a RESTful M2M protocol over http. The client and proxy exchange document fragments representing the remote API method invocations and responses.

Observable Properties and Agents can be dynamically created and deleted after the base instance of a Smart Object is created.

The Observable Property is itself a self-describing Object with the following structural constraints:
The Observable Property has the same Description pattern as the top level object. 

The Property of Interest is the container for the actual data or data stream, and allows custom implementations and methods to be defined by each Property of Interest. There is exactly one instance of Property Of Interest for each Observable Property, but it can be of any type including compound types or documents.

The Subscription is how data push on change or other asynchronous notification is performed. SUBSCRIBE adds a URL to a set of handlers to call back on updates to the Property of Interest. The handlers can be to the local agent, or to a URL pointing to an Observable Property on some other Smart Object to push data or notification to.

API Summary


Mapping to CRUD methods

Since each element has a unique path to it, e.g. 

Object.ObservablePropertyX.GET()
Object.Description.DESCRIBE()

A form of the GET verb can be used for both without confusion:

Object.ObservablePropertyX.GET()
Object.Description.GET()


ADDTRIPLES and REMOVETRIPLES can map to CREATE and DELETE respectively.

Likewise, SUBSCRIBE can be though of as the CREATE of a subscription, and UNSUBSCRIBE is a DELETE.

Each method in the Smart Object API can be mapped to one of the four CRUD methods relative to it's element. 


Summary

The Smart Object is a prototype Semantic Web API and application framework for the Internet of Things. 

It is a common data model and API for Internet Gateways, Web Services, and User Devices to use for interacting with each other spontaneously at the granular scale of connected Things.

Semantic discovery and linkage is enabled by an interface that attaches semantic tags dynamically to named resources within the object.

Every element instance is self-describing. The "data" element resolves to a self-describing instance of a type, allowing complete flexibility in data representation. 

An instance of a Smart Object is pointed to by a URL and includes the object's Observable Properties, it's Description, and it's Application Agents. 

Observable properties of a Smart Object can be Subscribed to by other other Smart Objects for Notify-On-Change or Data Push operation.

The Smart Object API looks the same to a local Agent as to a Web-connected Agent, allowing transparency of location. Only the URLs are differently routed.

Web services can be second-sourced, or mashed up with other services at the data algorithm level. 

Gateways and Smart Sensors can interact directly with actuators and user devices when it makes sense, using the same agents and APIs. Smart Objects and their services can be migrated and replicated easily for total system ruggedness. 

Next up

As I build a prototype Smart Object and deploy a test service, I'll be looking at the high level ecosystem again. A general tools framework is needed around Smart Objects to make plumbing a new web service as easy as making an instance of a class. 

I also will be looking at prototyping Arduino sensors, super-structed gateways, user informing devices, and smartphone/tablet controls. 

Tuesday, August 21, 2012

Architecture Features for a Semantic Web of Smart Objects

Architecture Features for a Semantic Web of Smart Objects

Michael J. Koster
August 21st, 2012

In this post I'd like to take a brief architectural look at the Semantic Web of Smart Objects I described in the first 2 posts. This provides a framework from which to understand the choices and direction.

Architecture as a set of constraints

Here I am looking at the notion of architecture as broadly consisting of a set of constraints imposed in order to achieve a particular goal.

The goal is to enable the creation of a web ecosystem of sensing, reasoning, and action around the internet of things. 

The mechanism is broad interoperability across sensors, services, and devices.

I propose to do this by creating a semantic web template (set of constraints) for the internet of things, and a set of common practices that can also be semantically defined.


In particular, the architecture of a semantic web of smart objects is a set of constraints imposed on the use of http/REST and semantic web standards in order to achieve broad interoperability at a granular scale of things and collections of things. (These constraints can themselves be semantically defined, making this a sort of "declarative architecture").

Seven Layer Model

The first organizing principle I'd like to invoke is the well-known seven layer model for networked applications. Given the predefined set of constraints (http/REST and semantic web) the session state management layer is well established by the RESTful interface.

Thus we need to define the constraints necessary to make interoperable the layers for data presentation and the interface to the application layer. This architecture therefore constrains the data presentation layer and API. 

Constraints will be applied to the RESTful interface to enable an interoperable service laver which provides data presentation services and a harmonized application API to enable data sources and applications to interact seamlessly and semantically with each other. In other words, data sources may be plugged into applications and applications may provide pluggable data sources using a uniform set of mechanisms.

Smart Objects


The next organizing principe I'd like to invoke is object encapsulation. The definition of an object also becomes the de facto definition for the representation of a thing or set of things on the Semantic Web and on the Internet.

The basic object encapsulation is an important architectural choice, as this constraint becomes a constraint on the way applications interact with data and metadata.

I propose to encapsulate observable property data and metadata together under a RESTful interface model that can be semantically shared between the web interface to an object and the API to application software executing within the context of the object.

Object state, object metadata, software agents, and software agent metadata share a RESTful API, with a single instance of each object pointed to by a URL. The entity this URL points to is referred to as a Smart Object for the purpose of this discussion.

Semantic discovery and linkage

The constraints needed to define the architecture here are related to semantic web operations. Some well defined method for getting the semantic metadata from an object to provide for indexing and discovery is needed. Fortunately the metadata are unstructured RDF triples and a simple list-all mechanism is sufficient. All that is needed is the URL to point to the object and a well known type to retrieve the triples. The triples can then be indexed for semantic linkage.

Semantic linkage can be accommodated by adding methods to return the URLs of resources in the object whose metadata properties satisfy semantic queries. A type for semantic queries and a semantically defined subset of SPARQL is indicated. An additional mtype for embedded semantic linkage is also possible and may prove useful to improve efficiency.

Additional constraints and use cases

It's important for several use cases to provide a mechanism to conditionally push linked data from one Smart Object to another. This should not impact architectural constraints, since the push operation can be semantically defined, as can the application agent call back handler linkage. There may be a need to push metadata describing the push operation itself. Also of note is that metadata triples may also be conditionally pushed.

The use case for Smart Objects includes bridging to constrained network endpoints. In this case, the bridge may create a Smart Object proxy for resources on the constrained network, and record associations of resource metadata with resource addresses on the constrained network, functioning as a semantic reverse proxy router. The bridge can also function as metadata repository and agent execution environment.

A simple bridge endpoint can also function as a standalone smart sensor and interact directly with other Smart Objects on the Internet. The sensing/actuating process is performed by an agent with well defined properties.

The other endpoint is at a user device. Rather than generate HTML for a web page or XML for AJAX controls, a Smart Object proxy can run directly on the user interface device and provide the Smart Object agent API directly to a user information/control app. A Smart Object proxy also allows the easy connection of a broad range of user interface devices, including the use of simple devices on constrained networks.

Standards 

The architectural constraints apply to a set of existing web and internet standards. No new methods or protocols need to be invented. The standards drawn from include:

http(s)
REST
HTML
XML
JSON
Xpointer/Xlink
RDF/Turtle
SPARQL
SSN ontology
DUL ontology
OAuth

In addition it is expected to use and interoperate with:

6LoWPAN
CoRE
CoAP
Arduino
Processing
Python/RESTlite

Summary

The goal is to enable the creation of a web ecosystem of sensing, reasoning, and action around the internet of things. 

The above describes what may be a minimum set of constraints and models needed to enable broad interoperability. It also defines an architectural approach to achieving a Semantic Web of Things. 

The architecture described above defines a data presentation layer and API which use a common RESTful interface model.

A Smart Object abstraction encapsulates an instance of observable data properties, semantic metadata, application agent processing, and agent process metadata under a URL.

Smart Objects can be semantically linked together through a metadata query interface or dynamic  semantic linkage language.

Endpoints of constrained sensor nets, Smart Sensors, and diverse user interface devices are enabled through Smart Object proxies.

No new methods or protocols need be invented. The architecture consists mostly of declarative constraints.

Additional constraints may be found as the investigation proceeds toward a prototype Smart Object framework.