本文整理了Java中org.apache.jena.rdf.model.Model.getWriter()
方法的一些代码示例,展示了Model.getWriter()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.getWriter()
方法的具体详情如下:
包路径:org.apache.jena.rdf.model.Model
类名称:Model
方法名:getWriter
暂无
代码示例来源:origin: vivo-project/Vitro
@Override
public RDFWriter getWriter(String lang) {
return inner.getWriter(lang);
}
代码示例来源:origin: vivo-project/Vitro
@Override
public RDFWriter getWriter() {
return inner.getWriter();
}
代码示例来源:origin: ch.epfl.bluebrain.nexus.org.topbraid/shacl
protected RDFWriter createRDFWriter(Model model) {
return model.getWriter(FileUtils.langTurtle);
}
代码示例来源:origin: TopQuadrant/shacl
protected RDFWriter createRDFWriter(Model model) {
return model.getWriter(FileUtils.langTurtle);
}
代码示例来源:origin: apache/jena
@Override
public RDFWriter getWriter() {
return holder.getBaseItem().getWriter();
}
代码示例来源:origin: apache/jena
@Override
public RDFWriter getWriter(final String lang) {
return holder.getBaseItem().getWriter(lang);
}
代码示例来源:origin: SmartDataAnalytics/jena-sparql-api
public static String toString(Model model, String format)
{
if(model == null)
return "null";
RDFWriter writer = model.getWriter(format);
return toString(model, writer);
}
代码示例来源:origin: srdc/ontmalizer
/**
* @param out - Output stream to write the model to.
* @param format - Output format may be one of these values;
* "RDF/XML","RDF/XML-ABBREV","N-TRIPLE","N3".
*/
public void writeModel(OutputStream out, String format) {
if (format.equals("RDF/XML") || format.equals("RDF/XML-ABBREV")) {
// This part is to add xml:base attribute to the RDF/XML and RDF/XML-ABBREV output
RDFWriter writer = model.getWriter(format);
writer.setProperty("xmlbase", baseNS);
writer.write(model, out, baseURI);
} else {
model.write(out, format, baseURI);
}
}
代码示例来源:origin: srdc/ontmalizer
/**
* @param out - Output writer to write the model to.
* @param format - Output format may be one of these values;
* "RDF/XML","RDF/XML-ABBREV","N-TRIPLE","N3".
*/
public void writeModel(Writer out, String format) {
if (format.equals("RDF/XML") || format.equals("RDF/XML-ABBREV")) {
// This part is to add xml:base attribute to the RDF/XML and RDF/XML-ABBREV output
RDFWriter writer = model.getWriter(format);
writer.setProperty("xmlbase", baseNS);
writer.write(model, out, baseURI);
} else {
model.write(out, format, baseURI);
}
}
代码示例来源:origin: apache/jena
public void testInterface() {
Model m1 = createMemModel();
assertTrue( "Default writer should be Basic.", m1.getWriter() instanceof Basic );
assertTrue( "RDF/XML writer should be Basic.", m1.getWriter() instanceof Basic );
assertTrue(
"RDF/XML-ABBREV writer should be Abbreviated.",
m1.getWriter("RDF/XML-ABBREV") instanceof Abbreviated);
assertTrue(
"N-TRIPLE writer should be NTripleWriter.",
m1.getWriter("N-TRIPLE") instanceof NTripleWriter);
}
代码示例来源:origin: org.apache.jena/jena-core
public void testInterface() {
Model m1 = createMemModel();
assertTrue( "Default writer should be Basic.", m1.getWriter() instanceof Basic );
assertTrue( "RDF/XML writer should be Basic.", m1.getWriter() instanceof Basic );
assertTrue(
"RDF/XML-ABBREV writer should be Abbreviated.",
m1.getWriter("RDF/XML-ABBREV") instanceof Abbreviated);
assertTrue(
"N-TRIPLE writer should be NTripleWriter.",
m1.getWriter("N-TRIPLE") instanceof NTripleWriter);
}
代码示例来源:origin: apache/jena
private String modelToString( Model m )
{
StringWriter s = new StringWriter();
RDFWriter w = m.getWriter( "RDF/XML-ABBREV" );
w.setProperty( "showDoctypeDeclaration", Boolean.TRUE );
w.write( m, s, null );
return s.toString();
}
代码示例来源:origin: org.apache.jena/jena-core
private String modelToString( Model m )
{
StringWriter s = new StringWriter();
RDFWriter w = m.getWriter( "RDF/XML-ABBREV" );
w.setProperty( "showDoctypeDeclaration", Boolean.TRUE );
w.write( m, s, null );
return s.toString();
}
代码示例来源:origin: apache/jena
@Override
public void runTest() throws IOException {
if (logging) {
RDFWriter w = testResults.getWriter("RDF/XML-ABBREV");
w.setProperty("xmlbase",BASE_RESULTS_URI );
try ( OutputStream out = new FileOutputStream("/tmp/rdf-results.rdf") ) {
w.write(testResults,out,BASE_RESULTS_URI);
}
}
}
}
代码示例来源:origin: org.apache.jena/jena-core
@Override
public void runTest() throws IOException {
if (logging) {
RDFWriter w = testResults.getWriter("RDF/XML-ABBREV");
w.setProperty("xmlbase",BASE_RESULTS_URI );
try ( OutputStream out = new FileOutputStream("/tmp/rdf-results.rdf") ) {
w.write(testResults,out,BASE_RESULTS_URI);
}
}
}
}
代码示例来源:origin: apache/jena
@Test
public void rdfjson_get_jena_writer()
{
Model m = ModelFactory.createDefaultModel();
m.getWriter("RDF/JSON");
}
代码示例来源:origin: apache/jena
@Test public void propertiesAbbrev() {
String name = "RDF/XML-ABBREV" ;
// Write without setting properties
StringWriter w = new StringWriter() ;
model.getWriter(name).write(model, w, null);
String x0 = w.toString() ;
// Write with setting properties
RDFWriter rdfWriter = model.getWriter(name);
rdfWriter.setProperty("showXmlDeclaration", "true");
rdfWriter.setProperty("showDoctypeDeclaration", "true");
StringWriter w2 = new StringWriter() ;
rdfWriter.write(model, w2, null);
String x2 = w2.toString() ;
// Did it have an effect?
Assert.assertNotEquals(x0, x2) ;
}
代码示例来源:origin: com.powsybl/powsybl-triple-store-impl-jena
public TripleStoreJena() {
// creates an in-memory Jena model that is able to contain multiple graphs
dataset = DatasetFactory.createMem();
// Create a model just to obtain a writer and configure it
writer = ModelFactory.createDefaultModel().getWriter("RDF/XML-ABBREV");
writer.setProperty("showXmlDeclaration", "true");
writer.setProperty("tab", "8");
writer.setProperty("relativeURIs", "same-document,relative");
// We create a model that will be the union of all loaded graphs,
// to be able to make queries over all data without the need for specifying a
// graph
// https://stackoverflow.com/questions/6981467/jena-arq-difference-between-model-graph-and-dataset
union = ModelFactory.createDefaultModel();
}
代码示例来源:origin: apache/jena
public void testRelativeAPI() {
RDFWriter w = createMemModel().getWriter(lang);
String old = (String) w.setProperty("relativeURIs", "");
assertEquals("default value check", old,
"same-document, absolute, relative, parent");
w.setProperty("relativeURIs", "network, grandparent,relative, ");
w.setProperty("relativeURIs",
" parent, same-document, network, parent, absolute ");
// TestLogger tl = new TestLogger(URI.class);
blockLogger();
w.setProperty("relativeURIs", "foo"); // will get warning
assertTrue("A warning should have been generated.", unblockLogger());
}
代码示例来源:origin: org.apache.jena/jena-core
public void testRelativeAPI() {
RDFWriter w = createMemModel().getWriter(lang);
String old = (String) w.setProperty("relativeURIs", "");
assertEquals("default value check", old,
"same-document, absolute, relative, parent");
w.setProperty("relativeURIs", "network, grandparent,relative, ");
w.setProperty("relativeURIs",
" parent, same-document, network, parent, absolute ");
// TestLogger tl = new TestLogger(URI.class);
blockLogger();
w.setProperty("relativeURIs", "foo"); // will get warning
assertTrue("A warning should have been generated.", unblockLogger());
}
内容来源于网络,如有侵权,请联系作者删除!