I noticed that the OntClass super/sub relationships do not seem to work
properly. Here is a definition of two classes that clearly establish a
parent-child relationship:
<owl:Class rdf:ID="TerrorAttack">
<rdfs:subClassOf rdf:resource="#Killing" />
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#actor" />
<owl:allValuesFrom rdf:resource="#TerrorAgent" />
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
<owl:Class rdf:ID="AircraftHijacking">
<rdfs:subClassOf rdf:resource="#TerrorAttack" />
</owl:Class>
So when I get a reference to the AircraftHijacking as an OntClass, and invoke
getSuperClass(), I would expect to get a reference to the TerrorAttack class.
But this does not happen. Here is the snippet of code:
OntModel model =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
FileInputStream inStream =
new FileInputStream("ontology/terrorism.xml");
model.read(inStream, null);
inStream.close();
String uriBase = model.getNsPrefixURI("");
OntClass cls = model.getOntClass(uriBase + "TerrorAttack");
System.out
.println("TerAtt: " + cls + " Super=" + cls.getSuperClass());
for (Iterator<OntClass> iter = cls.listSubClasses(true); iter
.hasNext();) {
System.out.println("Sub: " + iter.next());
}
cls = model.getOntClass(uriBase + "AircraftHijacking");
System.out.println("CLass=" + cls + " Super=" + cls.getSuperClass());
System.out.flush();
for (Iterator<OntClass> iter = cls.listSuperClasses(true); iter
.hasNext();) {
System.out.println(" CLS=" + iter.next());
}
And here is what is printed:
TerAtt: http://blsdev1.vsticorp.com/terrorism#TerrorAttack
Super=http://www.w3.org/2002/07/owl#Thing
Sub: -60c2c7fc:13d7deb0ee3:-7fee
CLass=http://blsdev1.vsticorp.com/terrorism#AircraftHijacking
Super=http://www.w3.org/2000/01/rdf-schema#Resource
CLS=-60c2c7fc:13d7deb0ee3:-7ff7
CLS=-60c2c7fc:13d7deb0ee3:-7ff4
CLS=-60c2c7fc:13d7deb0ee3:-7ffa
CLS=-60c2c7fc:13d7deb0ee3:-7fec
CLS=-60c2c7fc:13d7deb0ee3:-7ff6
CLS=-60c2c7fc:13d7deb0ee3:-7ff8
CLS=-60c2c7fc:13d7deb0ee3:-7ff9
CLS=-60c2c7fc:13d7deb0ee3:-7fe4
CLS=-60c2c7fc:13d7deb0ee3:-7fe5
CLS=-60c2c7fc:13d7deb0ee3:-7fed
CLS=-60c2c7fc:13d7deb0ee3:-7fef
CLS=http://blsdev1.vsticorp.com/terrorism#NonCountry
CLS=http://blsdev1.vsticorp.com/terrorism#TerrorAgent
CLS=http://blsdev1.vsticorp.com/terrorism#Agent
Note that the TerrorAttack's superclass is Thing, not Killing (or a reference
to an anonymous class?). It has one child, which is incorrect - the
TerrorAttack has multiple children in the ontology, including AircraftHijacking.
Then we get to AircraftHijacking. Its superclass is apparenty Resource (huh?).
When I list all superclasses, I get a bunch of anonymous classes and then three
classes in my ontology that are not only not the parent class(es), but are in
fact disjoint with it. Those three classes are defined as unions of classes
which are disjoint with TerrorAttack's (actual) parent:
<owl:Class rdf:ID="Agent">
<owl:unionOf rdf:parseType="Collection">
<owl:Class rdf:about="#Person" />
<owl:Class rdf:about="#Organization" />
</owl:unionOf>
</owl:Class>
<owl:Class rdf:ID="Killing">
<rdfs:subClassOf rdf:resource="#Event" />
...
</owl:Class>
<owl:Class rdf:ID="Event">
...
<owl:disjointWith rdf:resource="#Person" />
<owl:disjointWith rdf:resource="#Organization" />
<owl:disjointWith rdf:resource="#Location" />
</owl:Class>
I need to be able to get the reference to the TerrorAttack OntClass from the
AircraftHijacking OntClass. This seems like it should be trivial.
Edward Swing
Applied Research Technologist
Vision Systems + Technology, Inc., a SAS Company
6021 University Boulevard * Suite 360 * Ellicott City * Maryland * 21043
Tel: 410.418.5555 Ext: 919 * Fax: 410.418.8580
Email: [email protected]<mailto:[email protected]>
Web: http://www.vsticorp.com<http://www.vsticorp.com/>