pcs.firePropertyChange(ONTOLOGY_LOAD_STAGE,null,ONTOLOGY_LOAD_STAGE_BUILDHIERARCHY);
pcs.firePropertyChange(ONTOLOGY_LOADING_EVENT,null,"Creating Hierarchy ...");
// create some important properties
IProperty partOf = target.getProperty(PART_OF);
if(partOf == null){
partOf = target.createProperty(PART_OF,IProperty.OBJECT);
partOf.setDomain(new IClass [] {target.getRoot()});
partOf.setRange(new IClass [] {target.getRoot()});
}
IProperty hasPart = target.getProperty(HAS_PART);
if(hasPart == null){
hasPart = target.createProperty(HAS_PART,IProperty.OBJECT);
hasPart.setDomain(new IClass [] {target.getRoot()});
hasPart.setRange(new IClass [] {target.getRoot()});
}
// make them inverses of eachother
hasPart.setInverseProperty(partOf);
partOf.setInverseProperty(hasPart);
// now that we have all classes, build a tree, since classes only have the superclasses set
IResourceIterator it = target.getAllClasses();
while(it.hasNext()){
IClass cls = (IClass) it.next();
long time = System.currentTimeMillis();
// now copy equivalent classes classes
IProperty p = target.getProperty(EQUIVALENT_CLASS);
if(p != null){
for(IClass sibling: getClassList(target,cls.getPropertyValues(p))){
cls.addEquivalentClass(sibling);
}
// remove temporary property