Thanks for the test code.

Please correct me if I am wrong. Per the doc of listStatements:  Find all
the statements matching a pattern.

My problem is that when I update the facts, this rule is not be triggered
(executed).  I assume this rule will be triggered every time when the fact
is updated.

On the other hand, a leading triple can bypass it. For example

[test1: (a b ?c) now(?x) -> print(\"now test\") ].   When you update triple
(a, b, xxx), the rule will be executed.

Lorenz Buehmann <[email protected]> 于2023年1月26日周四 23:13写道:

> I cannot reproduce this. For example, the test code
>
>
> public static void main(String[] args) {
>          String raw = "<http://ex.org/a> <http://ex.org/p>
> <http://ex.org/b> .";
>          Model rawData = ModelFactory.createDefaultModel();
>          rawData.read(new StringReader(raw), null, "N-Triples");
>          String rules =
>                  "[test1: now(?x) -> print(\"now test\") ]";
>          Reasoner reasoner = new
> GenericRuleReasoner(Rule.parseRules(rules));
>          InfModel inf = ModelFactory.createInfModel(reasoner, rawData);
>          System.out.println("A * * =>");
>          StmtIterator iterator = inf.listStatements(null, null,
> (RDFNode) null);
>          while (iterator.hasNext()) {
>              System.out.println(" - " + iterator.next());
>          }
> }
>
>
> does in fact print "now test" to the console.
>
>
> On 26.01.23 19:43, L B wrote:
> > test1: now(?x) -> print("now test")
>

Reply via email to