owl api - Replace current super class of an individual with the inferred superclass -


greetings professor ignazio palmisano,

kindly have question in regards owl-api v5

scenario:

i have owl ontology contains individuals , defined classes (has equivalent axioms).

i add new individual "x" subclass of thing, , add individual properties.

i initialise reasoner , precomputeinferences()

goal:

if new individual "x" classified under existing defined class, want retrieve inferred class , replace current individual superclass thing inferred superclass.

main question:

1) kindly best way this?

sub question:

2) have save new inferred ontology , deal asserted, in order retrieve class? not since interest replace current individual superclass inferred superclass.

i trying find how this, came across: entitysearcher.gettypes(owlindividual, owlontology), retrieves original asserted superclass not inferred.

thanks time.

sincere regards.

in order replace asserted class inferred 1 (or ones - there might more one), need following:

  • retrieve inferred types
  • remove asserted types
  • add inferred types

so, called r owlreasoner instance, i owlindividual, t original type , t inferred type:

owlontology o = ... owlreasoner r = ... // returns node of direct types - i.e., set of equivalent classes specific named types including among instances // node single class. if reasoner can infer there equivalent classes, appear in node node<owlclass> types = r.gettypes(i, true);  // remove existing type assertions o.removeaxioms(o.getclassassertionaxioms(i));  // add new ones owldatafactory df = ... stream<owlaxiom> axiomstoadd = types.entities().map(t->df.getowlclassassertionaxiom(t, i)); o.addaxioms(owlapistreamutils.aslist(axiomstoadd)); 

now o contains new assertions in place of old ones. save or further elaborate ontology needed.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -