Hi all,
I have a project to use GEDCOM ontology (
http://www.daml.org/2001/01/gedcom/gedcom), enrich it with additional
classes and properties, and do some inferences against an RDF file based on
the enriched GEDCOM ontology.
Currently, I want to print all classes and properties from that ontology
(just to see if Jena can read it properly) using the code I put in the end
of this message. I download the ontology as 'gedcom-ori.xml'. However, the
code returns nothing.
I have tried this code for another ontology which uses OWL. And it works
properly (prints all classes and properties). But I have no idea why it
does not work for GEDCOM ontology above. I suspect the problem is because
the ontology uses DAML. I tried my best to find in the documentation of
Jena about how to read DAML, but I can't find it.
My question is, how can my code print all classes and properties from the
GEDCOM ontology? what is the correct way to read DAML-based ontology using
Jena?
It is very likely that I misunderstand this problem, since I am still new
in this field. If that is the case, would you mind to show me my mistake?
Thanks!
Regards,
Arif
=============
code:
OntModel m = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
OntDocumentManager dm = m.getDocumentManager();
dm.addAltEntry("http://www.daml.org/2001/01/gedcom/gedcom",
"file:/home/arif/workspace/RoyalInference/gedcom-ori.xml");
m.read("http://www.daml.org/2001/01/gedcom/gedcom");
if(m.isEmpty()) {
System.out.println("is empty");
} else {
System.out.println("not empty");
}
ExtendedIterator allProperties = m.listAllOntProperties();
while(allProperties.hasNext()) {
System.out.println("datatypeproperties: " +
allProperties.next().toString());
}
ExtendedIterator classes = m.listClasses();
while(classes.hasNext()) {
OntClass thisClass= (OntClass) classes.next();
System.out.println("found class: " + thisClass.toString());
ExtendedIterator instances = thisClass.listInstances();
while(instances.hasNext()) {
Individual thisInstance = (Individual) instances.next();
System.out.println("found instance: " +
thisInstance.toString());
}
}
======================================