Rules engine built-ins that take numeric arguments, such as sum and
greaterThan, are not working for me. My situation is as follows:
I'm loading a simple NT file into a default model:
Model contextData = FileManager.get().loadModel(contextPath, "N3");
The NT file includes the following triple:
<item1> <hasHeight> "8"^^<http://www.w3.org/2001/XMLSchema/integer> .
I'm creating an inference model in the usual way:
List rules = Rule.rulesFromURL("file:C:/test.rule");
Reasoner reasoner = new GenericRuleReasoner(rules);
Infmodel inf = ModelFactory.createInfModel(reasoner, contextData);
I have the following rule:
[checkItemHeight:
(?item, hasHeight, ?height),
print('In checkItemHeight antecedent:', ?height),
greaterThan(?height, "7"^^http://www.w3.org/2001/XMLSchema/integer),
->
print('In checkItemHeight:', ?height)
]
The first print clause succeeds:
'In checkCarHeight antecedent:'
'8'^^http://www.w3.org/2001/XMLSchema/integer
but the call to greaterThan never succeeds; the rule never fires. I've tried
different data types in the NT file and in the rules file, but nothing works.
The *only* thing I can get to work is when I use two simple constants, with no
datatype, in the rules file:
greaterThan(8, 7),
I've looked around for discussions and documentation related to this, and I've
looked at the Jena source code for greaterThan, but to no avail. I'd greatly
appreciate some clarification of what's going on here, and what
approaches*will* work.
Thanks!
David Martin
AI Lab
Nuance Communications