and RIF Rules :) ?
--
Rodrigo
Em 11/04/2012 11:25, Dave Reynolds escreveu:
HI Taha,
On 11/04/12 09:19, Osman, Taha wrote:
Hello,
We are trying to convert our system's SWRL rules into equivalent Jena
rules, but are stuck at the point where we have to compare a variable
to a
string literal while ignoring the case. The corresponding functor in
SWRL
is stringEqualIgnoreCase (our SWRL rule is examplified below). Is
there an
equivalent functor in Jena rules? Can you provide an example?
No sorry, the set of builtin functions is Jena rules is a bit
minimalist. If anyone was interested in contributing a fuller SWRL
compatible set that would be great :)
It would be easy enough for you to create a custom builtin. Something
like:
class StringEqualIgnoreCase extends BaseBuiltin implements Builtin {
public String getName() {
return "stringEqualIgnoreCase";
}
@Override
public int getArgLength() {
return 2;
}
@Override
public boolean bodyCall(Node[] args, int length, RuleContext
context) {
checkArgs(length, context);
Node n1 = getArg(0, args, context);
Node n2 = getArg(1, args, context);
if (n1.isLiteral() && n1.isLiteral()) {
return n1.getLiteralLexicalForm().equalsIgnoreCase(
n2.getLiteralLexicalForm() );
} else {
return false;
}
}
}
Which you need to install in the registry before use:
BuiltinRegistry.theRegistry.register( new StringEqualIgnoreCase() );
Dave