本文整理汇总了Java中org.apache.jena.riot.system.StreamRDFLib.graph方法的典型用法代码示例。如果您正苦于以下问题:Java StreamRDFLib.graph方法的具体用法?Java StreamRDFLib.graph怎么用?Java StreamRDFLib.graph使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jena.riot.system.StreamRDFLib
的用法示例。
在下文中一共展示了StreamRDFLib.graph方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: expand
import org.apache.jena.riot.system.StreamRDFLib; //导入方法依赖的package包/类
public static void expand() throws IOException {
boolean combined = false ;
String DIR = "testing/Inf" ;
String DATA_FILE = "data.ttl" ;
String VOCAB_FILE = "vocab.ttl" ;
String RULES_FILE = DIR+"/rdfs-min.rules" ;
Model vocab = RDFDataMgr.loadModel(VOCAB_FILE) ;
Model data = RDFDataMgr.loadModel(DATA_FILE) ;
String rules = FileUtils.readWholeFileAsUTF8(RULES_FILE) ;
rules = rules.replaceAll("#[^\\n]*", "") ;
InferenceSetupRDFS setup = new InferenceSetupRDFS(vocab, combined) ;
Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
InfModel m = ModelFactory.createInfModel(reasoner, vocab, data);
// Expansion Graph
Graph graphExpanded = Factory.createDefaultGraph() ;
StreamRDF stream = StreamRDFLib.graph(graphExpanded) ;
// Apply inferences.
stream = new InferenceProcessorStreamRDF(stream, setup) ;
sendToStream(data.getGraph(), stream) ;
RDFDataMgr.write(System.out, graphExpanded, Lang.TTL) ;
}
示例2: setupHere
import org.apache.jena.riot.system.StreamRDFLib; //导入方法依赖的package包/类
@BeforeClass public static void setupHere() {
Graph dataTest = GraphFactory.createDefaultGraph() ;
testGraphExpanded = GraphFactory.createDefaultGraph() ;
GraphUtil.addInto(dataTest, data) ;
GraphUtil.addInto(dataTest, vocab) ;
InferenceSetupRDFS setup = new InferenceSetupRDFS(vocab, true) ;
StreamRDF stream = StreamRDFLib.graph(testGraphExpanded) ;
stream = new InferenceProcessorStreamRDF(stream, setup) ;
StreamOps.graphToStream(dataTest, stream) ;
}
示例3: setupHere
import org.apache.jena.riot.system.StreamRDFLib; //导入方法依赖的package包/类
@BeforeClass public static void setupHere() {
testGraphExpanded = GraphFactory.createDefaultGraph() ;
InferenceSetupRDFS setup = new InferenceSetupRDFS(vocab, false) ;
StreamRDF stream = StreamRDFLib.graph(testGraphExpanded) ;
stream = new InferenceProcessorStreamRDF(stream, setup) ;
StreamOps.graphToStream(data, stream) ;
}
示例4: parseSynchronusly
import org.apache.jena.riot.system.StreamRDFLib; //导入方法依赖的package包/类
@Override
protected void parseSynchronusly() throws IOException {
StreamRDF dest;
final JenaRDF jenaRDF = getJenaFactory();
if (getTargetGraph().isPresent() && getTargetGraph().get() instanceof JenaGraph) {
final Graph jenaGraph = ((JenaGraph) getTargetGraph().get()).asJenaGraph();
dest = StreamRDFLib.graph(jenaGraph);
} else {
if (generalizedConsumerQuad != null) {
dest = jenaRDF.streamJenaToGeneralizedQuad(generalizedConsumerQuad);
} else if (generalizedConsumerTriple != null) {
dest = jenaRDF.streamJenaToGeneralizedTriple(generalizedConsumerTriple);
} else {
dest = JenaRDF.streamJenaToQuad(getRdfTermFactory().get(), getTarget());
}
}
final Lang lang = getContentTypeSyntax().flatMap(jenaRDF::asJenaLang).orElse(null);
final String baseStr = getBase().map(IRI::getIRIString).orElse(null);
if (getSourceIri().isPresent()) {
RDFParser.source(getSourceIri().get().toString()).base(baseStr).lang(lang).parse(dest);
} else if (getSourceFile().isPresent()) {
try (InputStream s = Files.newInputStream(getSourceFile().get())) {
RDFParser.source(s).base(baseStr).lang(lang).parse(dest);
}
} else {
RDFParser.source(getSourceInputStream().get()).base(baseStr).lang(lang).parse(dest);
}
}
示例5: setModel
import org.apache.jena.riot.system.StreamRDFLib; //导入方法依赖的package包/类
/**
* Set a model into which the conversion results will be stored.
* @see #setOutputStream(StreamRDF)
*/
public void setModel(Model model) {
result = model;
outputStream = StreamRDFLib.graph( result.getGraph() );
}