What I have done in such cases is to split the rule sets into two files (that 
do not import each other). Then, I run the TopSPIN engine twice, first with the 
rules that create the triples and then with those that clean up unwanted 
triples.

Holger


On Aug 23, 2011, at 9:44 PM, Gerrit wrote:

> I have created the template, but I'm having some problems
> instantiating it. I've upgraded to TBC 3.5.1 in order to add the
> update template as a spin:rule of owl:Thing. It seems that due to
> another spin:rule inserting properties that are irreflexive, TopSPIN
> does not terminate, continuously inserting and then removing the
> irreflexive properties.
> 
> Ordering the rules using sub-properties of spin:rule does not seem to
> work.
> 
> On Aug 19, 1:34 am, Holger Knublauch <[email protected]> wrote:
>> Yes, your code looks good. The constraint violation fortunately contains all 
>> information that you need (i.e. ?x and ?p), and the only minor inconvenience 
>> is matching the constraint by it's label.
>> 
>> Having said all this, you could of course also achieve the same result with 
>> a direct UPDATE query, such as
>> 
>> DELETE {
>>         ?x ?p ?x .}
>> 
>> WHERE {
>>         ?p a owl:IrreflexiveProperty .
>>         ?x ?p ?x .
>> 
>> }
>> 
>> and use ARQ to invoke that. You can use SPIN to turn the query above into a 
>> template so that you don't have to mix up Java code with inline SPARQL query 
>> strings.
>> 
>> Holger
>> 
>> On Aug 18, 2011, at 11:22 PM, Gerrit wrote:
>> 
>> 
>> 
>> 
>> 
>> 
>> 
>>> I am using the OWL 2 RL SPIN rules, so it 
>>> ishttp://topbraid.org/spin/owlrl#prp-irp
>>> (the irreflexive property rule) that is producing the violation. I new
>>> remove the triple using the following code (where newTriples is the
>>> model containing the inferred triples):
>> 
>>>    for(ConstraintViolation cv : cvs) {
>> 
>>>            Property pred = cv.getPaths().iterator().next().getPredicate();
>>>            System.out.println(cv.getMessage() + " - at " +
>>> SPINLabels.get().getLabel(cv.getRoot()) + ", getPath: " +
>>> SPINLabels.get().getLabel(pred) );
>> 
>>>            if(cv.getMessage().contains("Irreflexive property")) {
>> 
>>>                    Statement stmt = 
>>> newTriples.createStatement(cv.getRoot(), pred,
>>> cv.getRoot());
>>>                    logger.debug("Removing statement: " +
>>> SPINLabels.get().getLabel(stmt.getSubject()) + ", " +
>>> SPINLabels.get().getLabel(stmt.getPredicate()) + ", " +
>>> SPINLabels.get().getLabel(stmt.getResource()));
>>>                    newTriples.remove(stmt);
>>>            }
>>>    }
>> 
>>> Would this be the correct way to approach this?
>> 
>>> Regards,
>>> Gerrit
>> 
>>> On Aug 17, 1:28 am, Holger Knublauch <[email protected]> wrote:
>>>> Hi Gerrit,
>> 
>>>> I am not sure which spin:constraint is producing the violation, and this 
>>>> would have to contain sufficient information to populate the other fields 
>>>> of the ConstraintViolation object. For example, if you have a constraint 
>>>> using the CONSTRUCT syntax such as
>> 
>>>> http://spinrdf.org/spin.html#spin-constraint-construct
>>>> CONSTRUCT {
>>>>         _:b0 a spin:ConstraintViolation ;
>>>>              spin:violationRoot ?this ;
>>>>              spin:violationPath kennedys:spouse ;
>>>>              rdfs:label "Same-sex marriage not permitted (in this model)"
>>>>     }
>>>>     WHERE {
>>>>         ?this kennedys:spouse ?spouse .
>>>>         ?this kennedys:gender ?gender .
>>>>         ?spouse kennedys:gender ?spouseGender .
>>>>         FILTER (?gender = ?spouseGender) .
>>>>     }
>>>> then you can access the values of violationRoot and Path using the 
>>>> corresponding methods getRoot() and getPaths().
>> 
>>>> So I guess you may want to clarify what constraints you currently have. If 
>>>> it's just a simple ASK then this may not contain all the information.
>> 
>>>> BTW SPIN also supports fixes
>> 
>>>>        http://spinrdf.org/spin.html#spin-constraint-fixes
>> 
>>>> and your use case sounds like something where the system could 
>>>> automatically suggest an UPDATE operation that would fix the constraint 
>>>> violation.
>> 
>>>> Cheers
>>>> Holger
>> 
>>>> On Aug 16, 2011, at 11:07 PM, Gerrit wrote:
>> 
>>>>> Hi all,
>> 
>>>>> I have an irreflexive property. When a triple is inferred that
>>>>> violates this constraint, I would like to remove the offending triple
>>>>> from the inferred model. (Actually, I would like to prevent the triple
>>>>> from being inferred, but constraints only give a warning.)
>> 
>>>>> How can I determine which triple is generating the warning?
>> 
>>>>> SPINLabels.get().getLabel(cv.getRoot()) only shows the subject of the
>>>>> triple
>>>>> cv.getMessage() shows "Irreflexive property"
>>>>> SPINLabels.get().getLabel(cv.getSource()) is empty
>> 
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Group "TopBraid Suite Users", the topics of which include TopBraid 
>>>>> Composer,
>>>>> TopBraid Live, TopBraid Ensemble, SPARQLMotion 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
>>> Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
>>> TopBraid Live, TopBraid Ensemble, SPARQLMotion 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
> Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
> TopBraid Live, TopBraid Ensemble, SPARQLMotion 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
Group "TopBraid Suite Users", the topics of which include TopBraid Composer,
TopBraid Live, TopBraid Ensemble, SPARQLMotion 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

Reply via email to