/** * @param out - Output writer to write the ontology to. * @param format - Output format may be one of these values; * "RDF/XML","RDF/XML-ABBREV","N-TRIPLE","N3". */ public void writeOntology(Writer out, String format) { ontology.write(out, format, null); }
void printModels(OntModel superModel, OntModel subModel) { // Detach the submodel for printing to get an accurate // account of what is in each. superModel.removeSubModel(subModel); System.out.println("\nThe sub-model has " + subModel.size() + " statements:"); System.out.println("---------------------------------------------------"); subModel.writeAll(System.out,"N3",null); System.out.println("\nThe super-model has " + superModel.size() + " statements:"); System.out.println("---------------------------------------------------"); superModel.write(System.out,"N3",null); superModel.addSubModel(subModel); }
/** * @param out - Output stream to write to. * @param format - Output format may be one of these values; * "RDF/XML","RDF/XML-ABBREV","N-TRIPLE","N3". */ public void writeOntology(OutputStream out, String format) { ontology.write(out, format, null); }
void printModels(OntModel superModel, OntModel subModel) { // Detach the submodel for printing to get an accurate // account of what is in each. superModel.removeSubModel(subModel); System.out.println("\nThe sub-model has " + subModel.size() + " statements:"); System.out.println("---------------------------------------------------"); subModel.writeAll(System.out,"N3",null); System.out.println("\nThe super-model has " + superModel.size() + " statements:"); System.out.println("---------------------------------------------------"); superModel.write(System.out,"N3",null); superModel.addSubModel(subModel); }
/** * @param out - Output stream to write the ontology to. * @param format - Output format may be one of these values; * "RDF/XML","RDF/XML-ABBREV","N-TRIPLE","N3". */ public void writeOntology(OutputStream out, String format) { ontology.write(out, format, null); }
void printModels(OntModel superModel, OntModel subModel) { // Detach the submodel for printing to get an accurate // account of what is in each. superModel.removeSubModel(subModel); System.out.println("\nThe sub-model has " + subModel.size() + " statements:"); System.out.println("---------------------------------------------------"); subModel.writeAll(System.out,"N3",null); System.out.println("\nThe super-model has " + superModel.size() + " statements:"); System.out.println("---------------------------------------------------"); superModel.write(System.out,"N3",null); superModel.addSubModel(subModel); }
/** * @param writer - Output writer to write to. * @param format - Output format may be one of these values; * "RDF/XML","RDF/XML-ABBREV","N-TRIPLE","N3". */ public void writeOntology(Writer writer, String format) { ontology.write(writer, format, null); }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
@Override protected void outputModel(String documentSourceName, OntModel model) throws AnalysisEngineProcessException { try (OutputStream outputStream = createOutputStream(documentSourceName)) { model.write(outputStream, rdfFormat.getKey()); } catch (IOException e) { throw new AnalysisEngineProcessException(e); } } }
private void writeToConsole(OntModel model) { StringWriter writer = new StringWriter(); model.write(writer, RdfFormat.TURTLE.getKey()); System.out.println(writer.toString()); }
public static void main2( String[] args ) { final String NS = "http://stackoverflow.com/q/20194409/1281433/"; final OntModel model = ModelFactory.createOntologyModel( OntModelSpec.RDFS_MEM ); OntProperty p = model.createOntProperty( NS+"PropertyName" ); p.addDomain( model.getOntClass( NS+"ClassName" )); p.addRange( RDFS.Literal ); model.write( System.out, "RDF/XML-ABBREV" ); }
public static void main( String[] args ) { final OntModel ontModel = ModelFactory.createOntologyModel( OntModelSpec.RDFS_MEM ); ontModel.setNsPrefix( "so", NS ); final OntClass classA = ontModel.createClass( NS+"A" ); final OntClass classB = ontModel.createClass( NS+"B" ); final OntClass classC = ontModel.createClass( NS+"C" ); final Individual x = ontModel.createIndividual( NS+"x", classA ); x.addRDFType( classB ); classC.createIndividual( NS+"x" ); ontModel.write( System.out, "RDF/XML" ); }
public void testWritesPrefixes() { OntModel om = ModelFactory.createOntologyModel(); om.setNsPrefix( "spoo", "http://spoo.spoo.com/spoo#" ); om.add( statement( om, "ping http://spoo.spoo.com/spoo#pang pilly" ) ); om.add( statement( om, "gg " + OWL.getURI() + "hh ii" ) ); StringWriter sw = new StringWriter(); om.write( sw ); String s = sw.getBuffer().toString(); assertTrue( s.indexOf( "xmlns:spoo=\"http://spoo.spoo.com/spoo#\"" ) > 0 ); assertTrue( s.indexOf( "xmlns:owl=\"" + OWL.getURI() + "\"" ) > 0 ); }
public void testWritesPrefixes() { OntModel om = ModelFactory.createOntologyModel(); om.setNsPrefix( "spoo", "http://spoo.spoo.com/spoo#" ); om.add( statement( om, "ping http://spoo.spoo.com/spoo#pang pilly" ) ); om.add( statement( om, "gg " + OWL.getURI() + "hh ii" ) ); StringWriter sw = new StringWriter(); om.write( sw ); String s = sw.getBuffer().toString(); assertTrue( s.indexOf( "xmlns:spoo=\"http://spoo.spoo.com/spoo#\"" ) > 0 ); assertTrue( s.indexOf( "xmlns:owl=\"" + OWL.getURI() + "\"" ) > 0 ); }