当前位置: 首页>>代码示例>>Java>>正文


Java StreamRDFLib.graph方法代码示例

本文整理汇总了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) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:27,代码来源:DevRDFS.java

示例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) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:11,代码来源:TestExpandCombinedRDFS.java

示例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) ;
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:8,代码来源:TestExpandSplitRDFS.java

示例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);
    }
}
 
开发者ID:apache,项目名称:commons-rdf,代码行数:31,代码来源:JenaRDFParser.java

示例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() );
}
 
开发者ID:epimorphics,项目名称:dclib,代码行数:9,代码来源:ConverterProcess.java


注:本文中的org.apache.jena.riot.system.StreamRDFLib.graph方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。