knowsys / rulewerk

Java library based on the VLog rule engine
Apache License 2.0
32 stars 13 forks source link

Unexpected Reasoning result #166

Closed mrnolte closed 4 years ago

mrnolte commented 4 years ago

Hey there, I have a problem regarding the reasoning using version 0.5.0 per maven and Java 13. Consider the following code:

final KnowledgeBase KB = RuleParser.parse( 
      "B(?x2) :- A(?x2) .\n" // statement 1
    + "B(star) .\n" // statement 2
    + "Rel(r0) :- C2(cy), B(?x0) .\n" // statement 3
    + "C2(cy) ."); // statement 4

try (final Reasoner reasoner = new VLogReasoner(KB)) {
    if (!reasoner.reason()) {
        throw new RuntimeException();
    }
    try (var result = reasoner.answerQuery(Expressions.makePositiveLiteral("Rel", Expressions.makeUniversalVariable("a")), false)) {
        while (result.hasNext()) {
            System.out.println(result.next());
        }
    }
}

This does not print anything, although I would expect Rel(r0) because of the statements 2 - 4. Interestingly, without statement 1 Rel(r0) does get printed. Do I miss something about the reasoning or is this behaviour a bug?

Cheers, Robin Nolte

mmarx commented 4 years ago

This seems to be a bug in VLog, cf. karmaresearch/vlog#43.

mmarx commented 4 years ago

Fixed in current upstream VLog.