Q&A Session for Webinar II: SPARQL for Business Rules and Constraint Checking: Introducing SPIN*
The Following Questions were generated during the original webcast on April 1, 2009
Q: How easy is it to debug an application?
A: (Dean Allemang) As a user of this system (not its designer) I can respond to this from experience. It is surprisingly simple. Unlike Rete-based rule engines (for example), rule firing uses a very simple execution model.
Q: Do you do constraint checking before updating the data like in relational DB? How is the performance if data is frequently updated?
A (Holger Knublauch): This has been answered during the webcast.
Q: So if the rectangle has only height set what happens with the constraint.
A (HK): This has been answered during the webcast.
Q: Can I use SPIN for OWL (not just RDF)?
A (HK): Yes, absolutely. First, OWL models are expressed in RDF and therefore you can query them with SPARQL. Second, you can execute SPARQL on top of models that employ other inference engines, including OWL engines. Or just run an OWL engine first and then operate on the resulting model. Third, you can express most of the OWL semantics using SPIN itself, see my blog entry:
http://composing-the-semantic-web.blogspot.com/2009/01/owl-2-rl-in-sparql-using-spin.html
Q: how hard would it be, compared to SQL, to write more complex aggregate queries, like the average number of female astronauts on missions?
A (DA): I don’t believe we will have time to show these type of queries during the webinar. The ARQ extension to SPARQL has aggregate operations. They are loosely modeled on what you are familiar with in SQL.
Q: Does the rules propagate for the inferred concepts?
A (DA): By default, the SPIN engine in TopBraid iterates over all rules and will therefore also consider intermediate results for the next iteration. This can be switched off to improve performance, if we know in advance that there are no dependencies among the rules.
Q: Is SPIN constrained to rules or are other aspects also used?
Dean Allemang – 11:41 am
A (DA): Can you clarify this question? SPIN is using SPARQL Constructs in the same context where e.g., SWRL uses a Rule. Some other aspects of SPARQL are used in other contexts (e.g., ASK for constraints, and SELECT for function definitions).
Does that address your question? Or did you have something else in mind?
Q: What variety of Functions? yes you addressed the earlier question-Thanks Dean.
Additional answer (HK): The ideas of SPIN can be used in many other contexts as well. For example you could define a new property that links a property with a SPARQL SELECT query, and then whenever someone asks for values of that property, the system could execute those SELECT queries. There are infinite ways of using SPARQL here, and SPIN RDF syntax makes it easy to link concepts with "behavior".
Q: Shouldn’t the template, when generalized, be called something like: Invalidcharacterinstring?
A (HK): Yes, the default label is derived from the initial comment and can then be modified later.
Q: Do you do inference in the process of constraint checking? For example, there is a constraint "every student has a ID". Jane is a graduatestudent which is a subclass of Student. Will you do this ID checking for Jane?
A (HK): Handled during the call. No inferencing by default when constraint checking is done, however the system will already have the inferences up to date if incremental inferencing has been activated.
Q: Is notation .n3 similar to .n2 that you describe in your book?
A (DA): If the book calls it N2, then it is a misprint – the book uses N3.
Q: Will these examples be available for download so we can examine them more closely?
A (HK): My blog contains further details on the computer game, the units example and the spinsquare example. Only the latter it currently for download. Please contact me if you want to get a copy of the computer game.
Q: The current demo answered my question
A (DA): Thanks for that comment – it has been a challenge for some of us to figure out when the game demo (cool as it is) addresses real concerns of prospective practitioners; your comment is very helpful.
Q: what is a LET clause?
A (HK): This if currently an extension of the Jena SPARQL engine only, but (a variation of this) will become part of the upcoming next SPARQL standard. It binds a variable to the result of evaluating the expression on the right. For example LET (?area := (?width * ?height)) computes the product of width and height, and assigns it to ?area, so that the subsequent parts of the query can query the ?area value.
Q: Constrain errors are inserted as triples?
A (DA): a bit more than that, but basically, yes
A (HK): Simple ASK queries do not create triples, but you can have CONSTRUCT queries as constraints, which construct an instance of spin:ConstraintViolation with additional information (see spec for details). You can also make spin:constraint a sub-property of spin:rule so that constraint checking will be done as part of the inferencing process.
Q: hi, you said that the rules are continuously executed. How does this work when using the spin api?
A (HK): You need to implement this yourself – ideally just create a GraphListener that collects all changes (that belong together) and then check which resources have been mentioned in the change. Then re-run those inferences. I can provide details, but please ask this on the TBC mailing list.
Q: for a JAVA/JENA semantic applications what is required to start using SPIN?
A (HK): We provide the TopBraid SPIN API (open source), working on Jena.
Q: I am sorry it was N3 only and is a different semantic way than tagging?
A (HK): I don’t understand this question – please ask on the TopBraid Composer mailing list.
Q: In the game: is the run-loop implemented in SPIN as well? Keyboard "events" create triples? Just curious this was implemented specifically for the game in TopBraid?
A (HK): The run-loop (very small piece of code) is in Java, because I needed fine grained control over each step. The rules create triples that instruct the engine what to do next, e.g. to replace a field next to the current field. Yes, the keyboard is mapped to (temporary) triples that are available in each loop. Yes, the game was just made as a demo for TBC, but it was a really simple exercise.
Q: How scalable is SPIN? How many instances can you handle for a reasonable number of SPIN rules? 100? 1,000? 10,000? 100,000?
A (HK): As many as you like, assuming that the SPARQL queries are efficient. I made a small demo based on wordnet (2 million triples) which was very fast. In SPIN you can leave the data just where it is, while many other inference engines require you to copy all data over into some other data structure first.
Q: Is the game available for download?
A (HK): Yes, the game engine is part of TopBraid Composer. The file to drive the game is available on request from me only (shoot me an email).
Q: Does this depend on binding to any particular reasoning engines? is it just SPARQL?
A (HK): SPIN operates on any SPARQL engine. The TopBraid SPIN engine operates on any Jena-compliant RDF database, including Oracle RDF, Sesame, AllegroGraph.
Q: In the description of the unit example, there was some "magic" involved – is that unit conversion system implemented entirely in SPIN? Or is there a Jena property function-type module at the core?
A (HK): The "magic" was in fact another SPARQL function that was defined using SPIN only – no Java coding or other magic was needed. If you review the video you can see where I navigate into the conversion function and show its embedded SPARQL query. If unclear, I can send you some background.
Q: With SPIN you can write executable semantics. Is there any experience if SPIN is a better approach for domain experts to encode domain logic? Are there numbers of how much lets say Java code could be avoided?
A (HK): SPIN is very new and so we have no empirical evidence except for our own evaluations. I strongly believe that you can use SPIN as a model-driven approach that saves tons of Java code.
Q: enjoyed it
A (HK): Me too! Thanks for attending.

The 
Eric Franzon
VP Community
Jennifer Zaino
Contributor
Angela Guess Contributor
semanticweb.com Twitter feed loading...