Hello,
I have two rules which could produce the same triple:
String rules = "[r1: (?a eg:p ?b) -> (?a, eg:q, ?b)]" +
"[r2: (?a eg:r ?b) -> (?a, eg:q, ?b)]";
i have configured a GenericRuleReasoner in FORWARD_RETE mode.
GenericRuleReasoner reasoner = new
GenericRuleReasoner(Rule.parseRules(rules));
reasoner.setMode(GenericRuleReasoner.FORWARD_RETE);
InfModel model = ModelFactory.createInfModel(reasoner,
ModelFactory.createDefaultModel());
When a triple satisfy the first rule and another triple satisfy the second rule:
Resource subject = model.createResource();
Property predicateP = model.getProperty("urn:x-hp:eg/p");
Literal literalA = model.createTypedLiteral("A");
Property predicateR = model.getProperty("urn:x-hp:eg/r");
model.add(subject, predicateP, literalA);
model.add(subject, predicateR, literalA);
only one triple is deduced:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="urn:x-hp:eg/" >
<rdf:Description rdf:nodeID="A0">
<j.0:r rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A</j.0:r>
<j.0:p rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A</j.0:p>
<j.0:q rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A</j.0:q>
</rdf:Description>
</rdf:RDF>
When i remove the fist triple:
model.remove(subject, predicateP, literalA);
the sole deduced triple is removed even if the second rule is still satisfied:
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:j.0="urn:x-hp:eg/" >
<rdf:Description rdf:nodeID="A0">
<j.0:r rdf:datatype="http://www.w3.org/2001/XMLSchema#string">A</j.0:r>
</rdf:Description>
</rdf:RDF>
is it the expected behavior ?
is there a workaround to deduce twice the same triple or at least to don’t
remove the sole deduction ?
Thanks
Sébastien BOULET
LEAD DÉVELOPPEUR
intactile DESIGN
Création d’interfaces + subtiles
04 67 52 88 61
09 50 12 05 66
20 rue du carré du roi
34000 MONTPELLIER
France
www.intactile.com <http://intactile.com/>
Les informations contenues dans cet email et ses documents attachés sont
confidentielles. Elles sont exclusivement adressées aux destinataires
explicitement désignés ci-dessus et ne peuvent être divulguées sans
consentement de son auteur. Si vous n'êtes pas le destinataire de cet email
vous ne devez pas employer, révéler, distribuer, copier, imprimer ou
transmettre le contenu de cet email et devez le détruire immédiatement.