Package org.ar.domainspecific.tools.csv

Examples of org.ar.domainspecific.tools.csv.CSVFileWriter


      // 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();
    }
View Full Code Here


   
  }
 
  private void saveCSV(URI tboxURI) throws IOException
  {
    CSVFileWriter out = new CSVFileWriter("csv-pagerank/" + this.getOntologyName(tboxURI)+ ".csv" , ',');
    Vector<String> fields = new Vector<String>();
   
    fields.add("Concept name");
    fields.add("Score");
    out.writeFields(fields);
   
    for(ScoreMap entry: classesSorted)
    {
      fields.clear();
      fields.add(entry.concept.getURI().toString());
      fields.add(entry.score.toString());
      out.writeFields(fields);
    }
   
    out.close();
  }
View Full Code Here

TOP

Related Classes of org.ar.domainspecific.tools.csv.CSVFileWriter

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.