Hi,
I have a problem writing jena rules with min/max built in primitives operating
on dateTime literals. I have Jena model which contains resource that have
dateTime literals, and what I want to do is compare to dateTime literals from
two separate resources and assign the max or min value to another resource. An
example:
[rule:
(ex:resource1 ex:timestamp ?a)
(ex:resource2 ex:timestamp ?b)
min(?a, ?b, ?c) ->
(ex:resource3 ex:timestamp ?c)
]
The rule works when a and b are bound to integer literals, but fails when a and
b are xsd:dateTime literals. For example this works:
[rule:
min(1, 2, ?c) ->
(ex:resource1 ex:timestamp ?c)
]
while this does not:
[rule:
min('16-05-12T00:00:00'^^xsd:dateTime, '16-05-12T01:00:00'^^xsd:dateTime, ?c) ->
(ex:resource1 ex:timestamp ?c)
]
I am using the GenericRuleReasoner of Jena 2.7.0, this is the code I use for
inference:
String rules = "...";//see above
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
InfModel m = ModelFactory.createInfModel(reasoner, model);
greaterThan(), lessThan(), ge() and le() work just fine with the dateTime
literals I operate with, but when I try to use min and max with same literals,
the rule with min or max fails and nothing get inferred. Is the min and max
even supposed to work with dateTime literals or am I doing something silly here?
Regards,
Matti