SPARQLMotion is a visual scripting language for RDF and OWL. SPARQLMotion scripts can be used to define data processing chains. These chains typically consist of three kinds of steps:
The goal of SPARQLMotion is to simplify the development of data processing and mash-up applications. Partially inspired by systems such as Yahoo Pipes, SPARQLMotion combines the ease of a visual modeling language with the power of semantic data processing. Many SPARQLMotion modules actually make heavy use of the RDF query language SPARQL, and it is possible to combine SPARQL with a complete armada of Semantic Web tools such as inference engines, translators and filters to create the desired output and behavior.
The SPARQLMotion language is defined by the
SPARQLMotion core ontology,
which defines the basic structure of SPARQLMotion scripts. In particular
this ontology defines a class sm:Module
and a property
sm:next
that can link together two modules to specify the
direction of execution and information flow. Modules represent a processing
step, such as loading an XML file, converting an XML file to RDF, running
a SPARQL query over the RDF, and displaying RDF resources on a map.
The result of one module is passed as input to all modules that are
connected to it via the sm:next
property.
When executed, each SPARQLMotion module also represents RDF data (triples).
When two modules are chained together using sm:next
, then the
output RDF of the first module is the input of the second module. If a
module has multiple predecessors, then it will get the union of all RDF
inputs. Each module may add or remove RDF triples from this stream.
In addition to passing RDF data from one module to another, SPARQLMotion
modules can bind variables. Variables are identified by a string name,
and can hold RDF nodes (literals or resources) or XML as values. For
example, a user input module may prompt the user to enter a string value,
and the resulting string literal is then bound to a variable ?input
.
All following modules below the input module will then be able to reference
this variable, especially in SPARQL queries and in strings. Any string
property in a SPARQLMotion module can contain variables, and bound variables
will be inserted into those strings. For example, the file path string
myProject/myFolder/file{?name}.txt
will include the value of
the variable ?name
if it has been bound in previous steps.
Variable binding is important in SPARQLMotion's looping capabilities.
For example, sml:IterateOverSelect
runs a SPARQL query and
then repeats the body of the loop for each matching result set variable.
The sm:body
property is used to define the branch of the main
execution flow into the iterated block. In addition to iterating,
SPARQLMotion also supports branching modules, comparable to if-then-else
statements in a programming language. For example, the module
sml:BranchByAsk
runs a SPARQL Ask query and then either
continues with the branch specified as sm:if
or the
sm:else
branch.
SPARQLMotion is based on SPIN for its representation of SPARQL queries. This also means that you can use any SPIN feature such as user-defined functions and templates in all SPARQLMotion modules.
As of TopBraid 3.6, SPARQLMotion modules can also be used directly as part of SPARQL Web Pages. See the SWP overview page for details.
In order to get started with SPARQLMotion, please visit the online documentation at http://www.sparqlmotion.org. In particular, this site contains a Tutorial and several example scripts.