The current stack of modeling languages for the web of data provide excellent mechanisms for capturing the static structure of data. SKOS can be used to describe concept hierarchies and vocabularies. RDF Schema and OWL can be used to define classes, properties and relationships between these conceptual entities. There is, however, a key set of application requirements these languages have not dealt with. Namely, the way to describe general computational behavior of objects.
These requirements are now addressed by an emerging standard that uses SPARQL to express rules for the Semantic Web. It is called SPARQL Inferencing Notation or SPIN. Because of its heavy use of SPARQL it is also known as SPARQL Rules. SPIN has recently been accepted by W3C as a member submission from TopQuadrant, OpenLink and RPI.
SPIN combines concepts from object oriented languages, query languages, and rule-based systems to describe object behavior on the web of data. Object oriented languages provide well-known mechanisms for defining object behavior by describing classes and associating methods with class members. Object oriented methods often formalize how the modification of one attribute implies changes to other attributes. Another common purpose of methods is to capture constraints to ensure that the state of the objects remains within the bounds that the class designer had intended. One of the basic ideas of SPIN is to link class definitions with SPARQL queries to capture constraints and rules that formalize the expected behavior of those classes.
SPIN delivers a number of key advantages including ability to:
- Express business rules and constraints in a standard way without having to learn yet another rules language.
- Run rules directly on RDF data without a need for a separate time consuming “materialization” step. SPARQL is supported by all major RDF APIs and databases
- Describe object behavior on the web of data by adding concepts from object oriented languages.
To facilitate storage and maintenance, SPARQL queries are represented in RDF triples. The SPIN Modeling Vocabulary defines a collection of properties and classes that can be used to link RDFS and OWL classes with SPARQL queries. For example, the class
ex:Rectangle can define a property
spin:rule that points to a SPARQL CONSTRUCT query that computes the value of
ex:area based on the values of
ex:height. Similarly, the property
spin:constraint may link the class
ex:Square with a SPARQL ASK query that verifies that the width and height values are equal. These properties follow existing SPARQL standards, and the execution of these constructs can be efficiently handled by any SPARQL processor. Since SPIN is entirely based on and represented in RDF, rules and constraints can be shared on the web together with the class definitions they are associated with.
SPIN also supports modular abstraction and re-use of SPARQL queries by providing a templating mechanism. Templates are SPARQL queries parameterized with pre-bound variables. Building on the idea of templates, SPIN makes it possible to define custom SPARQL functions. These functions can be shared on the web using their URIs, and SPARQL processors can dynamically look up function definitions on demand, such as in Web service calls. A good example of SPIN functions has been published in the context of ontology-based unit conversion.
To learn more about SPIN, follow the links below:
- Announcing the Winner of the Semantic Web.Com "Spotlight On Library Innovation"
- Big Data Is Big Focus At SemTechBiz (Part 2)
- MarkLogic 7 Vision: World-Class Triple Store and World-Beating Information Store
- Session Spotlight: A Host of Expert Panels at SemTechBiz SF