// load the ontology using the ontology manager
// we need only classes (concepts) from it
tboxOntology = manager.loadOntologyFromPhysicalURI(tBoxPhysicalURI);
VocabularyManager vManager = new VocabularyManager(tboxOntology);
CSVFileWriter out = new CSVFileWriter(outputCSVFile, ',');
Vector<String> fields = new Vector<String>();
fields.add("Concept name");
for(ConceptMetric metric: metrics)
{
String[] headers = metric.getHeaders();
for(int i=0; i < headers.length; i++)
fields.add(headers[i]);
}
out.writeFields(fields);
//get the concepts
Set<OWLClass> classes = vManager.getConceptSet();
for (OWLClass owlClass : classes)
{
String name = owlClass.toString();
logger.info("Concept name - " + name);
fields.clear();
//add URI
fields.add(owlClass.getURI().toString());
for(ConceptMetric metric : metrics)
{
Object[] values = metric.getValues(name);
for(int i = 0; i < values.length; i++)
{
fields.add(values[i].toString());
}
}
out.writeFields(fields);
}
out.close();
}
catch (Exception e)
{
//e.printStackTrace();
}