SPIN is a W3C Member Submission that has become the de-facto industry standard to represent SPARQL rules and constraints on Semantic Web models. SPIN also provides meta-modeling capabilities that allow users to define their own SPARQL functions and query templates. Finally, SPIN includes a ready to use library of common functions.
For more information see SPIN Architecture and the SPIN Overview W3C Page.
Update (July 2017): Before you explore SPIN further, you may want to read From SPIN to SHACL.
SPIN is a way to represent a wide range of business rules.
You will not need to learn another proprietary rules language to do so. With SPIN, rules are expressed in SPARQL. In fact, SPIN is also referred to as SPARQL Rules. SPARQL is a well-established W3C standard implemented by many industrial-strength RDF APIs and all databases. This means that rules can run directly on RDF data without a need for materialization. SPIN provides a framework that helps users to leverage the fast performance and rich expressivity of SPARQL for various application purposes.
SPIN can be used to:
These rules are implemented USING SPARQL CONSTRUCT or SPARQL UPDATE requests (INSERT and DELETE). SPIN Templates also make it possible to define such rules in higher-level domain specific languages so that rule designers do not need to work with SPARQL directly.
Another common need in applications is to check validity of the data. For example, you may want to require that a field is entered and/or that the string entered follows your format requirements.
SPIN offers a way to do constraint checking with closed world semantics and automatically raise inconsistency flags when currently available information does not fit the specified integrity constraints. Constraints are specified using SPARQL ASK or CONSTRUCT queries, or corresponding SPIN Templates.
SPIN combines concepts from object oriented languages, query languages, and rule-based systems to describe object behavior on the web of data. One of the key ideas of SPIN is to link class definitions with SPARQL queries to capture rules and constraints that formalize the expected behavior of those classes. To do so, SPIN defines a light-weight collection of RDF properties.
Finally, SPIN also supports the definition of new SPARQL functions with a transparent and web-friendly framework.
The following optional specifications extend SPIN for certain tasks:
SPIN is part of the SPIN Technology Stack that also includes SPARQLMotion and SPARQL Web Pages (UISPIN).
See also: Frequently Asked Questions.