I have noticed a problem within Jena when dealing with classes with multiple
property restrictions. Here's the snippet of Java code:
OntModel m =
ModelFactory
.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
FileInputStream inStream = new FileInputStream(args[0]);
m.read(inStream, null);
inStream.close();
System.err.println("Done Read");
int cnt = 0;
for (Iterator<OntClass> clsIter = m.listClasses(); clsIter
.hasNext(); cnt++) {
OntClass cls = clsIter.next();
System.out.println("CLS: " + cls.getLocalName());
}
And here's the offending class in the ontology (all mentioned properties and
other classes are well-defined):
<owl:Class rdf:ID="TravelEvent">
<rdfs:subClassOf rdf:resource="#Event" />
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#actor" />
<owl:allValuesFrom rdf:resource="#Person" />
</owl:Restriction>
</rdfs:subClassOf>
<rdfs:subClassOf>
<owl:Restriction>
<owl:onProperty rdf:resource="#destination" />
<owl:cardinality
rdf:datatype="&xsd;nonNegativeInteger">1
</owl:cardinality>
</owl:Restriction>
</rdfs:subClassOf>
</owl:Class>
When I run the code, it runs out of Java heap space. However, when I remove the
destination cardinality restriction, it works fine. I have other classes that
have multiple cardinality restrictions.
Here's the definition of destination and its parent property:
<owl:ObjectProperty rdf:ID="hasLocation">
<rdfs:domain rdf:resource="#Event" />
<rdfs:range rdf:resource="#Location" />
</owl:ObjectProperty>
<owl:ObjectProperty rdf:ID="destination">
<rdf:type rdf:resource="&owl;FunctionalProperty" />
<rdfs:subPropertyOf rdf:resource="#hasLocation"/>
<rdfs:domain rdf:resource="#TravelEvent" />
</owl:ObjectProperty>
I added the FunctionalProperty definition to replace the cardinality
restriction; it wasn't in the original.
Because I can use a FunctionalProperty here, I can work around the issue.
However, I'm not sure why the simple addition of a single restriction would
blow out the memory. The entire ontology has less than 100 defined classes.
This probably should be checked and fixed in the Jena code.
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/>