List of usage examples for edu.stanford.nlp.io StringOutputStream toString
@Override public synchronized String toString()
From source file:com.tronipm.orcaide.controller.ControllerConversor.java
License:Apache License
public void print() { RDFXMLDocumentFormat f = new RDFXMLDocumentFormat(); // ManchesterSyntaxDocumentFormat f = new ManchesterSyntaxDocumentFormat(); StringOutputStream stream = new StringOutputStream(); try {//from w w w .j av a 2 s . c om manager.saveOntology(ontology, f, stream); System.out.println(stream.toString()); } catch (OWLOntologyStorageException ex) { Logger.getLogger(ControllerConversor.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:com.tronipm.orcaide.core.OWLRepository.java
License:Apache License
public void mergedOntology(String pathNewOntology) throws OWLOntologyStorageException, OWLOntologyCreationException { //OWLOntologyManager m = create(); Object[] objs = null;/*from ww w. j a va2 s .c om*/ try { objs = loadOntologyFromFile(pathNewOntology); } catch (OWLOntologyCreationException ex) { Logger.getLogger(OWLRepository.class.getName()).log(Level.SEVERE, null, ex); } OWLOntologyManager ontologyManager_new = (OWLOntologyManager) objs[0]; OWLOntology ontology_new = (OWLOntology) objs[1]; StringOutputStream aAux = new StringOutputStream(); ontologyManager_new.saveOntology(ontology_new, aAux); String aString = aAux.toString(); System.out.println(aString); currentOntologyManager.addAxiom(ontology_new, currentDataFactory .getOWLDeclarationAxiom(currentDataFactory.getOWLClass(IRI.create("PAULOMATEUS")))); OWLOntologyMerger merger = new OWLOntologyMerger(currentOntologyManager); IRI mergedOntologyIRI = IRI.create("Mateus"); OWLOntology merged = merger.createMergedOntology(ontologyManager_new, mergedOntologyIRI); StringOutputStream aaa = new StringOutputStream(); ontologyManager_new.saveOntology(merged, aaa); System.out.println("NEW ONTOLOGY START"); System.out.println(aaa.toString()); System.out.println("NEW ONTOLOGY END----------------------------------"); //ontologyManager = ontologyManager_new; currentOntology = merged; currentDataFactory = currentOntologyManager.getOWLDataFactory(); coreApp.atualizarTelas(); }
From source file:com.tronipm.orcaide.core.PelletRepository.java
License:Apache License
public void getInferring(boolean isStandard) throws OWLOntologyCreationException { List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<>(); gens.add(new InferredClassAssertionAxiomGenerator()); //gens.add(new InferredDataPropertyCharacteristicAxiomGenerator()); gens.add(new InferredDisjointClassesAxiomGenerator()); gens.add(new InferredEquivalentClassAxiomGenerator()); gens.add(new InferredEquivalentClassAxiomGenerator()); //gens.add(new InferredEquivalentDataPropertiesAxiomGenerator()); //gens.add(new InferredEquivalentObjectPropertyAxiomGenerator()); //gens.add(new InferredInverseObjectPropertiesAxiomGenerator()); //gens.add(new InferredObjectPropertyCharacteristicAxiomGenerator()); //gens.add(new InferredPropertyAssertionGenerator()); gens.add(new InferredSubClassAxiomGenerator()); //gens.add(new InferredSubObjectPropertyAxiomGenerator()); /**/*from w w w . j a v a 2 s . co m*/ * Para tirar os parmetros, s remover o "gens" de * InferredOntologyGenerator */ ontology_INFERRED_ = getOntologyManager().createOntology(); //InferredOntologyGenerator iog = new InferredOntologyGenerator(reasoner); InferredOntologyGenerator iog = null; if (isStandard) { iog = new InferredOntologyGenerator(reasoner); } else { iog = new InferredOntologyGenerator(reasoner, gens); } iog.fillOntology(getOntologyManager().getOWLDataFactory(), ontology_INFERRED_); //Gerando em outputStream ontologia StringOutputStream auxiliar = new StringOutputStream(); try { getOntologyManager().saveOntology(ontology_INFERRED_, auxiliar); } catch (OWLOntologyStorageException ex) { Logger.getLogger(PelletRepository.class.getName()).log(Level.SEVERE, null, ex); } ontology_INFERRED_STRING = auxiliar.toString(); }
From source file:knu.univ.lingvo.coref.SieveCoreferenceSystem.java
License:Open Source License
public static String getConllEvalSummary(String conllMentionEvalScript, String goldFile, String predictFile) throws IOException { ProcessBuilder process = new ProcessBuilder(conllMentionEvalScript, "all", goldFile, predictFile, "none"); StringOutputStream errSos = new StringOutputStream(); StringOutputStream outSos = new StringOutputStream(); PrintWriter out = new PrintWriter(outSos); PrintWriter err = new PrintWriter(errSos); SystemUtils.run(process, out, err);// w w w . j av a 2s . c o m out.close(); err.close(); String summary = outSos.toString(); String errStr = errSos.toString(); if (!errStr.isEmpty()) { summary += "\nERROR: " + errStr; } Pattern pattern = Pattern.compile("\\d+\\.\\d\\d\\d+"); DecimalFormat df = new DecimalFormat("#.##"); Matcher matcher = pattern.matcher(summary); while (matcher.find()) { String number = matcher.group(); summary = summary.replaceFirst(number, df.format(Double.parseDouble(number))); } return summary; }
From source file:LVCoref.LVCoref.java
License:Open Source License
public static String getConllEvalSummary(String conllMentionEvalScript, String goldFile, String predictFile) throws IOException { if (conllMentionEvalScript == null) return ""; ProcessBuilder process = new ProcessBuilder(conllMentionEvalScript, "all", goldFile, predictFile, "none"); StringOutputStream errSos = new StringOutputStream(); StringOutputStream outSos = new StringOutputStream(); PrintWriter out = new PrintWriter(outSos); PrintWriter err = new PrintWriter(errSos); SystemUtils.run(process, out, err);//from w w w . j av a 2s . co m out.close(); err.close(); String summary = outSos.toString(); String errStr = errSos.toString(); if (errStr.length() > 0) { summary += "\nERROR: " + errStr; } return summary; }