On 11/04/12 15:31, Rodrigo Jardim wrote:
and RIF Rules :) ?

A contribution of those builtins would be good too :)

Indeed a contribution of a RIF implementation would definitely be great :)

Though RIF is harder because RIF is a more powerful (and useful) language. The way that the RIF/RDF mapping works means that you can use RIF tuples to do lots of interesting computations and then express the results back in RDF. At a stroke it removes the need for clunky things like Jena's "hide" meta-predicates and gives you full power of recursion for that intermediate working.

Dave


--
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


Reply via email to