Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Jena RuleEngine (Backward)

$
0
0
Hi All:

I have been trying to use the backward jena rule engine was not able to for
some reasons. I have already applied the forward one and works just fine.

Here is the code:

public class Ruleset {

private List<Rule> rules = null;

private GenericRuleReasoner reasoner = null;

public Ruleset (String rulesSource){

this.rules = Rule.rulesFromURL(rulesSource);

this.reasoner = new GenericRuleReasoner(rules);

reasoner.setOWLTranslation(true);

reasoner.setTransitiveClosureCaching(true);}

public InfModel applyto(Model mode){

return ModelFactory.createInfModel(reasoner, mode);

public static void main(String[] args) {

Ruleset rule = new Ruleset (rulepath);

InfModel infmodel = rule.applyto(data.tdb);}

and here is my forward rule:

[test1: (?drug2 ddids:drug_is_metabolized_by_enzyme ddidd:C1176140)

->(?drug2 rdf:type ddids:hasInteraction)]

After running the rule above, I got result. However, when I tried to make
the same rule backward, I got nothing

[test2: (?drug2 rdf:type ddids:hasInteraction)

<-
(?drug2 ddids:drug_is_metabolized_by_enzyme ddidd:C1176140) ]

Am I doing something wrong here ?

Thanks

Viewing all articles
Browse latest Browse all 5648

Trending Articles