if(isFilteredOut(c, semanticTypeFilter)){
return;
}
IOntology ont = parent.getOntology();
String clsName = getClassName(c.getName());
IClass cls = ont.getClass(clsName);
// if class exists, then we have a cycle, just add a parent and quit
if(cls != null){
if(!(cls.equals(parent) || cls.hasSuperClass(parent) || cls.hasSubClass(parent)))
cls.addSuperClass(parent);
return;
}
// create class
cls = parent.createSubClass(clsName);
Set<String> labels = new LinkedHashSet<String>();
labels.add(c.getName());
Collections.addAll(labels,c.getSynonyms());
// add synonyms
for(String s: labels){
cls.addLabel(s);
}
// add definitions
for(Definition d: c.getDefinitions()){
cls.addComment(d.getDefinition());
}
// get concept code
IProperty code = getProperty(ont,"code");
cls.setPropertyValue(code,c.getCode());
// get semantic types
IProperty stype = getProperty(ont,"SemanticType");
for(SemanticType st: c.getSemanticTypes())
cls.addPropertyValue(stype,st.getName());
// output
console.append(prefix+c.getName()+"\n");
SwingUtilities.invokeLater(new Runnable(){
public void run(){