I spotted an inconsistency in the ontology.

#NewsOrganization has a restriction:

[[

        <rdfs:subClassOf>
            <owl:Restriction>
                <owl:onProperty rdf:resource="#associatedWith" />
<owl:maxCardinality rdf:datatype="&xsd;nonNegativeInteger">0
                </owl:maxCardinality>
            </owl:Restriction>
        </rdfs:subClassOf>

]]

Thus #NewsOrganization can have an #associatedWith property, i.e. is within the domain of #associatedWith. The domain of #associatedWith is #Person. #Organization is disjoint with #Person. #NewsOrganization is a subclass of #Organization.

The ontology is thus inconsistent. If I eliminate the restriction quoted above, and run:

[[
OntModel model =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
            FileInputStream inStream =
                new FileInputStream("terrorism3.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.listSuperClasses(true); iter.hasNext(); ) {
                System.out.println("Super: " + iter.next());
            }
            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());
            }
]]

I get:

[[

TerAtt: http://blsdev1.vsticorp.com/terrorism#TerrorAttack Super=http://www.w3.org/2002/07/owl#Thing
Super: -574eea0e:13d7f0d23aa:-7fed
Super: http://blsdev1.vsticorp.com/terrorism#Killing
Sub: http://blsdev1.vsticorp.com/terrorism#PlantedExplosive
Sub: http://blsdev1.vsticorp.com/terrorism#AircraftHijacking
Sub: -574eea0e:13d7f0d23aa:-7feb
Sub: http://blsdev1.vsticorp.com/terrorism#CarBombing
CLass=http://blsdev1.vsticorp.com/terrorism#AircraftHijacking Super=http://blsdev1.vsticorp.com/terrorism#AircraftHijacking
  CLS=http://blsdev1.vsticorp.com/terrorism#TerrorAttack
]]

Which may be closer to what you expect.

Also note that the inverse properties #hasMember and #isMemberOf have domains and ranges that do not match exactly. Did you mean #hasMember to have a range of #Person as specified in #isMemberOf. What is there is not inconsistent, it just that #hasMember may be specified a little more liberally than you intended.

Brian




On 18/03/2013 19:38, Dave Reynolds wrote:
On 18/03/13 16:24, Ed Swing wrote:
Thanks Joshua for looking into this. From the results you generated, it looks like the Pellet reasoner gets the (more) correct results, while the default Jena reasoner has some issues (Unfortunately, I may not be able to use Pellet due to licensing issues - checking with legal).

If you want a full DL reasoner on a commercial-friendly license you should probably expect to have to pay for it :)

Anyhow, there are some incorrect results - specifically (A) AircraftHijacking does not include TerrorAttack as a parent at all,

Running:

[[[
        String NS = "http://blsdev1.vsticorp.com/terrorism#";;
        Model base = FileManager.get().loadModel("data/terrorism.rdf");
// OntModel omodel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, base); OntModel omodel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_RULE_INF, base); // OntModel omodel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, base); OntClass aircraftHijacking = omodel.getOntClass(NS + "AircraftHijacking"); for (ExtendedIterator<OntClass> supers = aircraftHijacking.listSuperClasses(); supers.hasNext();) {
            System.out.println(" - " + supers.next());
        }
]]]

On your data then I see TerrorAttack listed for all of the reasoner options.

(B) it includes Agent as a parent, which is mutually exclusive with AircraftHijacking.

The fact that they are exclusive doesn't stop it being a parent, it just suggests that the ontology isn't consistent.

In your case I seems like the issue is a "syntactic" one. In the definition of Killing you have:

<owl:Class rdf:ID="Killing">
  <rdfs:subClassOf rdf:resource="#Event" />
    <rdfs:subClassOf>
      <owl:equivalentClass>
        <owl:complementOf>
          <owl:Restriction>
            <owl:onProperty rdf:resource="#actor" />
            <owl:hasValue rdf:resource="#NewsOrganization" />
          </owl:Restriction>
        </owl:complementOf>
      </owl:equivalentClass>
    </rdfs:subClassOf>
</owl:Class>

Note the striping error where you have rdfs:subClassOf (a property) owl:equivalentClass (also a property).

Since the Jena reasoners are OWL/full reasoners they allow you to "mess with the furniture" and that certainly causes a mess.

I guess Pellet attempts to silently fix this up. If I run your example through the online Pellet checker I see the line:

"Untyped Class: Assuming owl:equivalentClass is a class"

An error message like that should ring loud warning bells!

If I comment out that problematic syntax and run the code again for each reasoner option I get:

[[[
Test: no reasoner
 - http://blsdev1.vsticorp.com/terrorism#TerrorAttack

Test: micro
 - http://blsdev1.vsticorp.com/terrorism#TerrorAttack
 - http://www.w3.org/2000/01/rdf-schema#Resource
 - 1829e3a:13d7ef83aca:-7ff2
 - http://blsdev1.vsticorp.com/terrorism#Killing
 - http://www.w3.org/2002/07/owl#Thing

Test: full
 - http://www.w3.org/2000/01/rdf-schema#Resource
 - http://www.w3.org/2002/07/owl#Thing
 - http://blsdev1.vsticorp.com/terrorism#TerrorAttack
 - http://blsdev1.vsticorp.com/terrorism#Killing
 - 1829e3a:13d7ef83aca:-7ff2
]]]

Note that the Jena rule reasoners are OWL/full reasoners (or use the "RDF semantics" if you prefer OWL2 speak). That's why you see the restriction bNodes (in OWL/full each such restriction is itself a class) and why you see every class as being a subclass of rdfs:Resource (which it is in OWL/full).

Note also that your data includes two mentions of rdf:range which generate warnings from the parser. Those are presumably supposed to be rdfs:range.

Dave



--
Epimorphics Ltd (http://www.epimorphics.com)

Epimorphics Ltd. is a limited company registered in England (number 7016688)
Registered address: Court Lodge, 105 High Street, Portishead, Bristol BS20 6PT, 
UK

Reply via email to