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


Java FileUtils.readWholeFileAsUTF8方法代码示例

本文整理汇总了Java中org.apache.jena.util.FileUtils.readWholeFileAsUTF8方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtils.readWholeFileAsUTF8方法的具体用法?Java FileUtils.readWholeFileAsUTF8怎么用?Java FileUtils.readWholeFileAsUTF8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.jena.util.FileUtils的用法示例。


在下文中一共展示了FileUtils.readWholeFileAsUTF8方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fs_write_01

import org.apache.jena.util.FileUtils; //导入方法依赖的package包/类
@Test
public void fs_write_01() throws IOException {
    FileStore fs = FileStore.attach(STORE, "FILE");
    assertEquals(0, fs.getCurrentIndex());
    FileEntry entry = fs.writeNewFile(out->{
        try(AWriter aw = IO .wrapUTF8(out)) {
          aw.write("abc");  
        } 
    }) ;
    assertNotNull(entry);
    assertNotNull(entry.datafile);
    int idx = checkFilename(entry.datafile);
    assertEquals(1, idx);
    // Read it back in again.
    String s = FileUtils.readWholeFileAsUTF8(entry.getDatafileName());
    assertEquals("abc", s);
}
 
开发者ID:afs,项目名称:rdf-delta,代码行数:18,代码来源:TestFileStore.java

示例2: mainTDB

import org.apache.jena.util.FileUtils; //导入方法依赖的package包/类
public static void mainTDB(String...argv) throws IOException {
    DatasetGraphTDB dsg = ((DatasetGraphTransaction)TDBFactory.createDatasetGraph()).get() ;
    String DIR = "testing/Inf" ;
    String DATA_FILE = DIR+"/rdfs-data.ttl" ;
    String VOCAB_FILE = DIR+"/rdfs-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]*", "") ;

    // TDB
    
    InferenceSetupRDFS_TDB setup = new InferenceSetupRDFS_TDB(vocab, dsg, false) ;
    //Graph graph = new GraphRDFS(setup, data.getGraph()) ;
    
    
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:20,代码来源:DevRDFS.java

示例3: expand

import org.apache.jena.util.FileUtils; //导入方法依赖的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

示例4: plain

import org.apache.jena.util.FileUtils; //导入方法依赖的package包/类
public static void plain(String...argv) throws IOException {
        String DIR = "testing/Inf" ;
//        String DATA_FILE = DIR+"/rdfs-data.ttl" ;
//        String VOCAB_FILE = DIR+"/rdfs-vocab.ttl" ;
//        String RULES_FILE = DIR+"/rdfs-min.rules" ;

        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, false) ;
        
        Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules));
        InfModel m = ModelFactory.createInfModel(reasoner, vocab, data);
        inf = m.getGraph() ;
        g_rdfs2 = new GraphRDFS(setup, data.getGraph()) ;
        //g_rdfs3 = new GraphRDFS3(setup, data.getGraph()) ;
        
        //test(null, null, node("T2")) ;
        
        test(node("T"), null, null ) ;
        
        // Expansion
        //InferenceProcessorRDFS proc = new InferenceProcessorRDFS(setup) ;
    }
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:31,代码来源:DevRDFS.java

示例5: createRulesGraph

import org.apache.jena.util.FileUtils; //导入方法依赖的package包/类
/** Create a Jena-rules backed graph */
protected static Graph createRulesGraph(Graph data, Graph vocab, String rulesFile) {
    try {
        String rules = FileUtils.readWholeFileAsUTF8(rulesFile) ;
        rules = rules.replaceAll("#[^\\n]*", "") ;
        Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules)) ;
        return reasoner.bindSchema(vocab).bind(data);
    }
    catch (IOException ex) { IO.exception(ex) ; return null ; }
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:11,代码来源:AbstractTestGraphRDFS.java

示例6: createRulesGraph

import org.apache.jena.util.FileUtils; //导入方法依赖的package包/类
/** Create a Jena-rules backed graph */
protected static Graph createRulesGraph(Model data, Model vocab, String rulesFile) {
    try {
        String rules = FileUtils.readWholeFileAsUTF8(rulesFile) ;
        rules = rules.replaceAll("#[^\\n]*", "") ;
        Reasoner reasoner = new GenericRuleReasoner(Rule.parseRules(rules)) ;
        // Model m = ModelFactory.createInfModel(reasoner, data);
        /** Rules way */
        InfModel m = ModelFactory.createInfModel(reasoner, vocab, data) ;
        return m.getGraph() ;
    }
    catch (IOException ex) { IO.exception(ex) ; return null ; }
}
 
开发者ID:afs,项目名称:jena-inf-engine,代码行数:14,代码来源:AbstractTestRDFS.java

示例7: readFile

import org.apache.jena.util.FileUtils; //导入方法依赖的package包/类
/**
 * Try to read in a given file as UTF-8 content
 * 
 * @param baseDir
 *            Base directory
 * @param filename
 *            Filename
 * @return File contents
 * @throws FileNotFoundException
 * @throws IOException
 */
protected String readFile(File baseDir, String filename) throws FileNotFoundException, IOException {
    File f = resolveFile(baseDir, filename);

    String query = FileUtils.readWholeFileAsUTF8(f.getPath());
    return query;
}
 
开发者ID:rvesse,项目名称:sparql-query-bm,代码行数:18,代码来源:AbstractOperationLoader.java


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