buda-base/editserv

minimal graphs

Closed this issue · 0 comments

eroux commented

When dealing with graphs, in order to keep a clean and coherent state, it would be important to apply rules to make them minimal, in the sense of the minimal number of triples necessary to obtain an inferred model. Basically all the triples that can be inferred from another triple in the same graph should be removed. Now, this is actually not true in some cases such as bdg:W12827

bdr:W12827  bdo:instanceHasVolume   bdr:I2062 .
bdr:I2062      bdo:volumeOf                    bdr:W12827 ;

and

bdo:instanceHasVolume  owl:inverseOf bdo:volumeOf .

in the ontology, so one of the above triples could be inferred from the other... So let's restrict the definition to a certain type of reasoner which would be the RDFS reasoner (which doesn't consider owl:inverseOf). The main feature of the RDFS reasoner are (using Jena Rule syntax):

?s ?p ?o . ?p rdfs:subPropertyOf ?q . -> ?s ?q ?o .
?s a ?c . ?c rdfs:subClassOf ?d . -> ?s a ?d .

So for instance when the RDF reasoner sees

bdr:A  bdo:hasSon bdr:B .
bdo:hasSon rdfs:subPropertyOf bdo:hasChild .

it infers

bdr:A  bdo:hasChild bdr:B .

. Now, to get a minimal graph, we want to reverse that. So if we take the convention that RM(?s ?p ?o) means remove ?s ?p ?o . from the graph, we can apply rules such as:

?s ?p ?o . ?p rdfs:subPropertyOf ?q . ?s ?q ?o . -> RM(?s ?q ?o) .
?s a ?c . ?c rdfs:subClassOf ?d .  ?s a ?d -> RM(?s a ?d) .

That should be enough for our purpose. That will keep odd things from happening in the update neighbor function.