Commit fa426187 authored by Nicolas Seydoux's avatar Nicolas Seydoux
Browse files

Fixed logic for rule propagation

parent a0ce2e0e
......@@ -260,10 +260,10 @@ public class RuleManager {
public void propagateRules(Model inference){
Map<String, List<String>> transfers = Node.getInstance()
.getShapesManager().extractTransferNodes(inference);
Boolean activatedRule = false;
if(transfers.size() == 0){
LOGGER.debug("No transferrable rules");
}
Boolean activatedRule = false;
for (String ruleURI : transfers.keySet()) {
for (String nodeURI : transfers.get(ruleURI)) {
if (E_Centralization.rulePropagationAllowed(Node.getInstance().getConfiguration().getCentralization())) {
......@@ -297,18 +297,19 @@ public class RuleManager {
Model reinference = Node.getInstance().getKBManager().executeRules(true, true);
Node.getInstance().getKBManager().addToModel(reinference);
LOGGER.debug("Reinference : " + ModelPrinter.get().print(reinference));
LOGGER.warn("Productions are not annouced (there was reinference)");
Node.getInstance().getInterestManager().propagateInterests();
}
}
}
if (Node.getInstance().getShapesManager().hasActivatedRule(inference) ||
(!E_Centralization.rulePropagationAllowed(Node.getInstance().getConfiguration().getCentralization()) &&
activatedRule)) {
Node.getInstance().getInterestManager().propagateInterests();
LOGGER.warn("Productions are not annouced");
// If a reinference was performed, the first infernece is no longer valid, and was integrated into
// the reinference, hence the condition.
if(Node.getInstance().getShapesManager().hasActivatedRule(inference) && !activatedRule){
// If the deduction is obtained when adding the rule (and not when receiving an observation),
// it is never added to the KB, that is why it is done here
Node.getInstance().getKBManager().addToModel(inference);
// Node.getInstance().getProductionManager().pro
Node.getInstance().getInterestManager().propagateInterests();
LOGGER.warn("Productions are not annouced");
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment