Examples of CSVFileWriter


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

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

   
  }
 
  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

Examples of org.ar.tools.CSVFileWriter

   
    //open a reader to get the Sudokus
    BufferedReader in = new BufferedReader(new FileReader(inSudokuFile));
    String strLine;
    //write the results in a CSV file
    CSVFileWriter out = new CSVFileWriter(outCSVResults, ',');
    FileOutputStream fout = new FileOutputStream(output);
    PrintStream printStream = new PrintStream(fout);
    Vector<String> fields;
    long startTime, endTime;
    int k = 0;
   
    double sum = 0;
    double bck = 0;
    String solution = "";
    double avg_time;
    double avg_bck;
   
    while ((strLine = in.readLine()) != null)  
    {  
      k++;
      fields = new Vector<String>();
      fields.add(""+k);
     
      for(int i=0; i < searchers.size(); i++)
      {
        avg_time = 0;
        avg_bck = 0;
        for(int j = 0; j < NO_RUNS; j++)
        {
          startTime   = System.currentTimeMillis();
          solution = searchers.get(i).run(strLine);
          endTime   = System.currentTimeMillis();
          avg_time += endTime - startTime;
          avg_bck  += searchers.get(i).noBactracks;       

        }
        avg_bck /= (double)NO_RUNS;
        avg_time /= (double)NO_RUNS;
        fields.add(solution);
       
        fields.add(""+ (avg_time));
        fields.add("" + avg_bck);
        fields.add("" + (avg_bck + searchers.get(i).noGivens - 81));
        sum += avg_time;
        bck += avg_bck;
      }
      //print the solution in the file
      printStream.println(solution);
      out.writeFields(fields);
    }
    in.close();
    out.close();
    fout.close()
  }
View Full Code Here

Examples of org.sf.bee.commons.csv.CSVFileWriter

    //                      p u b l i c
    // ------------------------------------------------------------------------
    public String exportAsFile(final String filepath) throws IOException {
        final String destination = this.getFilePath(filepath);
        FileUtils.createParentDirs(filepath);
        final CSVWriter writer = new CSVFileWriter(destination);
        try {
            final List<DBObject> data = _srvc.find();
            this.export(writer, data);
        } catch (Throwable t) {
        }
        writer.close();
        return destination;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.