Hello Russel;  There are a couple of things to understand about SPIN rules.  The first is that it is model-driven.  This means that you define a rule on the class and apply it to all members of the class (and subclasses).  Hence if you have no instances, there will be no triples constructed by the rule.

Second SPIN Rules executes as a forward chaining rule engine by executing until there are no new triples to create.  Therefore a caveat is that if you create an object from a system-generated source, such as bnodes or generateUUID(), then you have an infinite loop - each execution creates a new triple.

Hence the rules with "BIND (spif:generateUUID() AS ?x) ." need to be set to execute only once.  The best way to do this is to make a subproperty of spin:rule, let's call it spin:ruleWithUUID.  For that property definition, set the property spin:rulePropertyMaxIterationCount to one, then define the rules using spif:generateUUID() with that property.  For each instance of the class the spin:ruleWithUUID definition is defined on, the rule will be executed once only.

Given the above, which you can extend further to order the rule sets (defined by spin:rule and its subproperties) with spin:nextRuleProperty, etc. I think most of the issues you address will be covered.  If you have further questions, let us know.

-- Scott

On 8/17/2014, 10:16 AM, Russell Robbins wrote:
Summary:

Thank you in advance for helping me write a CONSTRUCT/WHERE statement that can be declared as a SPIN Rule in TopBraid Composer Free Edition and used. I am trying to embed a SPARQL CONSTRUCT/WHERE statement in a SPIN:rule declaration and then execute it. I am returning zero inferences to Statements 1 or 2 below. I am using Java 7, and Eclipse 4.3., and TopBraid Composer Free Edition. I have been successful running Statement 3 as a SPIN Constructor Declaration in the classes form (Statement 3). I have been successful running Statement 4 in the SPARQL query editor (interpreter) .

Detail:

Fact 1: I have not been able to run Statement 1 as a SPIN Rule.

----Statement 1---

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
BIND (spif:generateUUID() AS ?x) .
}

Fact 2: I have not been able to run Statement 2 as a SPIN Rule.

----Statement 2----

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
?this rdfs:subClassOf node:entity .
BIND (spif:generateUUID() AS ?x) .
}
--No Error Message--

Fact 3: However I have been successful with Statement 3 in the constructor field of the classes form.

----Statement 3----

CONSTRUCT {
?this owl:hasKey ?x .
}
WHERE {
BIND (spif:generateUUID() AS ?x) .
}
Success: When a new instance is created a new triple indicating a key is created.

Fact 4: I have been successful with Statement 4 in the SPARQL query editor which is analogous.

----Statement 4----

CONSTRUCT {
?s owl:hasKey ?x .
}
WHERE {
?s rdf:type node:word_use
BIND (spif:generateUUID() AS ?x) .
}
Success: When statement is run all current instances get keys.

Fact 5: I do not have any SPARQL Rules libraries checked in the Ontology Profile form.

Fact 6: I have imported the following two libraries.

<http://spinrdf.org/spin> from local file TopBraid/SPIN/spin.ttl.
<http://spinrdf.org/sp> from local file TopBraid/SPIN/sp.ttl

Fact 7: The namespaces in the file are:

Base URI (Location) - http://example.org/
Default Namespace - http://example.org/

But the Base URI keeps getting reset to:
http://www.semanticweb.org/owl/owlapi/turtle

ace_lexicon - http://attempto.ifi.uzh.ch/ace_lexicon#
arc - http://example.org/arc#
arg - http://spinrdf.org/arg#
concept - http://example.org/concept#
node - http://www.example.org/node#
owl - http://www.w3.org/2002/07/owl#
rdf - http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs - http://www.w3.org/2001/01/rdf-schema#
skos - http://www.w3.org/2004/02/skos/core#
sp - http://spinrdf.org/sp#
spif - http://spinrdf.org/spif#
spin - http://spinrdf.org/spin#
spl - http://spinrdf.org/spl#
word_sense - http://example.org/word_sense#
word_term - http://example.org/word_term#
word_use - http://example.org/word_use#

Fact 8: The class that I am using has the following assertions.

Name - node:unclassified_concept
SubClassOf - node:entity

Fact 9: An instance of the node:unclassified_concept class is described below.

URI - http://example.org/concept#regardless_of1
rdfs:comment - without attention to
rdfs:isDefinedBy - <http://en.wiktionary.org/wiki/regardless_of>
rdfs:label - regardless of

Fact 10: I have been successful using Jena Generic Rules reasoning as well as the OWL_MEM_RULE_INF OntModelSpec, reading/writing, base models, inf models, and ont models.

Context:

The context of my problem is the following. I am building and iteratively executing an ontology and rule set using Java and Jena to prove the concept of OWL/RDF representing, considering, and responding to non-trivial type-written English. The sentence I am using is non-trivial (41 words, three clauses, etc.). The current ontology has 1422 assertions when not run against any OWL/RDF rules (transitivity, etc.). I am using TopBraid Composer when possible to complement Jena programming to make sure I am compliant with conventions and standards.

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to