On 31/12/13 15:35, Olivier Torres wrote:
Hi,
i have the following type hierarchy, from the more general to the more specific 
:
A1, A2, A3,

and the rules :
if A1 then B= "value1"
if A2 then B= "value2"
if A3 then B= "value3"

When a triple matches with A3 then the rules infer the triples : B= "value1", B= 
"value2", B= "value3".
In my use case i want only the deduced triple B= "value3",
Is someone know how to implement this behavior ?

You have a couple of options. Either include the RDFS closure rules and write your rules as backward rules [1] or include the type inference directly in your own rules.

A simple brute force version without need for transitive caching would be something like:

  (?a rdfs:subClassOf ?b)  (?b rdfs:subClassOf ?c)
       -> (?a rdfs:subClassOf ?c) .

  (?a rdf:type ?c)  (?c rdfs:subClass ?d)
       -> (?a rdf:type ?d) .

  (?a rdf:type eg:A1) -> (?a eg:B "value1") .
  (?a rdf:type eg:A2) -> (?a eg:B "value2") .
  (?a rdf:type eg:A3) -> (?a eg:B "value3") .

Dave

[1] http://jena.apache.org/documentation/inference/#RDFSPlusRules

Reply via email to