本文整理汇总了Java中org.apache.jena.riot.system.RiotLib类的典型用法代码示例。如果您正苦于以下问题:Java RiotLib类的具体用法?Java RiotLib怎么用?Java RiotLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RiotLib类属于org.apache.jena.riot.system包,在下文中一共展示了RiotLib类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: writeJsonLd
import org.apache.jena.riot.system.RiotLib; //导入依赖的package包/类
private void writeJsonLd(final OutputStream output, final DatasetGraph graph, final IRI... profiles) {
final String profile = getCustomJsonLdProfile(profiles);
final RDFFormat format = nonNull(profile) && nonNull(cache) ? JSONLD_COMPACT_FLAT : getJsonLdProfile(profiles);
final WriterDatasetRIOT writer = RDFDataMgr.createDatasetWriter(format);
final PrefixMap pm = RiotLib.prefixMap(graph);
final String base = null;
final JsonLDWriteContext ctx = new JsonLDWriteContext();
if (nonNull(profile) && nonNull(cache)) {
LOGGER.debug("Setting JSON-LD context with profile: {}", profile);
final String c = cache.get(profile, p -> {
try (final TypedInputStream res = HttpOp.execHttpGet(profile)) {
return IOUtils.toString(res.getInputStream(), UTF_8);
} catch (final IOException | HttpException ex) {
LOGGER.warn("Error fetching profile {}: {}", p, ex.getMessage());
return null;
}
});
if (nonNull(c)) {
ctx.setJsonLDContext(c);
ctx.setJsonLDContextSubstitution("\"" + profile + "\"");
}
}
writer.write(output, graph, pm, base, ctx);
}
开发者ID:trellis-ldp,项目名称:trellis,代码行数:25,代码来源:JenaIOService.java
示例2: writeTurtle
import org.apache.jena.riot.system.RiotLib; //导入依赖的package包/类
public void writeTurtle(String baseIRI, PrefixMapping prefixes, boolean writeBase) {
// Auto-register RDF prefix so that rdf:type is displayed well
// All other prefixes come from the query and should be as author intended
prefixes = ensureRDFPrefix(prefixes);
if (writeBase) {
// Jena's streaming Turtle writers don't output base even if it is provided,
// so we write it directly.
IndentedWriter w = new IndentedWriter(out);
RiotLib.writeBase(w, baseIRI);
w.flush();
}
StreamRDF writer = new WriterStreamRDFBlocks(out);
if (dedupWindowSize > 0) {
writer = new StreamRDFDedup(writer, dedupWindowSize);
}
writer.start();
writer.base(baseIRI);
for (Entry<String, String> e : prefixes.getNsPrefixMap().entrySet()) {
writer.prefix(e.getKey(), e.getValue());
}
StreamOps.sendTriplesToStream(triples, writer);
writer.finish();
}
开发者ID:tarql,项目名称:tarql,代码行数:26,代码来源:StreamingRDFWriter.java
示例3: tokenToNode
import org.apache.jena.riot.system.RiotLib; //导入依赖的package包/类
private static Node tokenToNode(Token token) {
if ( token.isIRI() )
// URI or <_:...>
return RiotLib.createIRIorBNode(token.getImage()) ;
if ( token.isBNode() ) {
// Blank node as _:...
String label = token.getImage().substring(bNodeLabelStart.length());
return NodeFactory.createBlankNode(label);
}
return token.asNode() ;
}
开发者ID:afs,项目名称:rdf-delta,代码行数:12,代码来源:RDFPatchReaderText.java
示例4: createEntity
import org.apache.jena.riot.system.RiotLib; //导入依赖的package包/类
@Test
public void createEntity() throws Exception {
Individual ent = provModel.createEntity(URI
.create("http://example.com/fred#test"));
provModel.createEntity(URI.create("http://example.com/test"));
OntModel model = provModel.model;
model.write(System.out, "TURTLE", "http://example.com/fred");
model.write(System.out, "RDF/XML", "http://example.com/fred");
WriterGraphRIOT writer = RDFDataMgr.createGraphWriter(RDFFormat.TURTLE_BLOCKS);
writer.write(System.out, model.getBaseModel().getGraph(), RiotLib.prefixMap(model.getGraph()), "http://example.com/fred", new Context());
}
开发者ID:apache,项目名称:incubator-taverna-engine,代码行数:14,代码来源:TestTavernaProvModel.java
示例5: write
import org.apache.jena.riot.system.RiotLib; //导入依赖的package包/类
@Override
public void write(Writer out, Graph graph, PrefixMap prefixMap, String baseURI, Context context)
{
// Writers are discouraged : just hope the charset is UTF-8.
IndentedWriter x = RiotLib.create(out) ;
SSE.write(x, graph) ;
}
开发者ID:xcurator,项目名称:xcurator,代码行数:8,代码来源:ExRIOT_out3.java
注:本文中的org.apache.jena.riot.system.RiotLib类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论