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


Java Dataset.close方法代码示例

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


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

示例1: main

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static void main(String[] args) {

    if (args.length != 3) {
      System.err.println("Wrong arguments");
      showUsage();
    }
    System.out.println("Model file   : " + args[0]);
    System.out.println("Model URI    : " + args[1]);
    System.out.println("Model tdb dir: " + args[2]);

    Dataset dataset = TDBFactory.createDataset(args[2]);
    try {
      Model model = dataset.getNamedModel(args[1]);
      TDBLoader.loadModel(model, args[0]);
    } finally {
      dataset.close();
    }
  }
 
开发者ID:Smartlogic-Semaphore-Limited,项目名称:Java-APIs,代码行数:19,代码来源:SKOSTDBLoader.java

示例2: queryData

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static List<String> queryData(String query){
	Dataset db = TDBFactory.createDataset("temp/dataset");
	db.begin(ReadWrite.READ);
    Model model = db.getDefaultModel();
    Query q = QueryFactory.create(query);
    QueryExecution qexec = QueryExecutionFactory.create(query, model);
    ResultSet results = qexec.execSelect();
    List<String> answer = new ArrayList<String>();
    while(results.hasNext()){
    	QuerySolution t = results.nextSolution();
    	RDFNode x  = t.get("x");
    	String s = x.toString();
	System.out.println(s);
    	answer.add(s.substring(7));
    }
    qexec.close();
    db.close();
    return answer;
}
 
开发者ID:kunal15595,项目名称:smart-question-answering-nlp,代码行数:20,代码来源:Database.java

示例3: getFragmentTriples

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
/**
 * Return all triples from the given dataset in one model, i.e., all graphs in the dataset are merged.
 * @param dataset The dataset to get the model from
 * @return  The model containing all triples from the graphs from the dataset.
 */
private Model getFragmentTriples(final Dataset dataset) {
    Model fragmentTriples = ModelFactory.createDefaultModel();

    // add unnamed graph
    Model defaultModel = dataset.getDefaultModel();
    fragmentTriples.add(defaultModel);

    // add named graph(s)
    Iterator<String> names = dataset.listNames();
    while (names.hasNext()) {
        String name = names.next();
        Model namedModel = dataset.getNamedModel(name);
        fragmentTriples.add(namedModel);
        namedModel.close();
    }
    dataset.close();
    return fragmentTriples;
}
 
开发者ID:LinkedDataFragments,项目名称:Client.Java,代码行数:24,代码来源:LinkedDataFragmentsClient.java

示例4: main

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static void main(String... argv)
{
    // Direct way: Make a TDB-back Jena model in the named directory.
    String directory = "MyDatabases/DB1" ;
    Dataset dataset = TDBFactory.createDataset(directory) ;
    
    // Potentially expensive query.
    String sparqlQueryString = "SELECT (count(*) AS ?count) { ?s ?p ?o }" ;
    // See http://incubator.apache.org/jena/documentation/query/app_api.html
    
    Query query = QueryFactory.create(sparqlQueryString) ;
    QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
    try {
      ResultSet results = qexec.execSelect() ;
      for ( ; results.hasNext() ; )
      {
          QuerySolution soln = results.nextSolution() ;
          int count = soln.getLiteral("count").getInt() ;
          System.out.println("count = "+count) ;
      }
    } finally { qexec.close() ; }

    // Close the dataset.
    dataset.close();
    
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:27,代码来源:ExTDB5.java

示例5: main

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static void main(String... argv)
{
    // Direct way: Make a TDB-back Jena model in the named directory.
    String directory = "MyDatabases/DB1" ;
    Dataset dataset = TDBFactory.createDataset(directory) ;
    
    // Potentially expensive query.
    String sparqlQueryString = "SELECT (count(*) AS ?count) { ?s ?p ?o }" ;
    // See http://incubator.apache.org/jena/documentation/query/app_api.html
    
    Query query = QueryFactory.create(sparqlQueryString) ;
    QueryExecution qexec = QueryExecutionFactory.create(query, dataset) ;
    ResultSet results = qexec.execSelect() ;
    ResultSetFormatter.out(results) ;
    qexec.close() ;

    dataset.close();
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:19,代码来源:ExTDB4.java

示例6: oneTimeTearDown

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
@AfterClass
public static void oneTimeTearDown() {
	// Close dataset
	Dataset ds = ThingDirectory.get().dataset;
	ds.close();
	
	deleteAll(dbPath); // FIXME returns false?
	deleteAll(idxPath);
}
 
开发者ID:thingweb,项目名称:thingweb-directory,代码行数:10,代码来源:ThingWebRepoTest.java

示例7: queryData2

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static Boolean queryData2(String query){
	Dataset db = TDBFactory.createDataset("temp/dataset");
	db.begin(ReadWrite.READ);
    Model model = db.getDefaultModel();
    Query q = QueryFactory.create(query);
    QueryExecution qexec = QueryExecutionFactory.create(query, model);
    List<String> answer = new ArrayList<String>();
    Boolean t = (qexec.execAsk());
    qexec.close();
    db.close();
    return t;
}
 
开发者ID:kunal15595,项目名称:smart-question-answering-nlp,代码行数:13,代码来源:Database.java

示例8: oneTimeTearDown

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
@AfterClass
public static void oneTimeTearDown() {
	// Close dataset
	Dataset ds = Repository.get().dataset;
	ds.close();
	
	deleteAll(dbPath); // FIXME returns false?
	deleteAll(idxPath);
}
 
开发者ID:thingweb,项目名称:thingweb-repository,代码行数:10,代码来源:ThingWebRepoTest.java

示例9: main

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static void main(String... argv)
{
    // Direct way: Make a TDB-back Jena model in the named directory.
    String directory = "MyDatabases/DB1" ;
    Dataset ds = TDBFactory.createDataset(directory) ;
    Model model = ds.getDefaultModel() ;
    
    // ... do work ...
    
    // Close the dataset.
    ds.close();
    
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:14,代码来源:ExTDB1.java

示例10: main

import org.apache.jena.query.Dataset; //导入方法依赖的package包/类
public static void main(String... argv)
{
    String assemblerFile = "Store/tdb-assembler.ttl" ;

    Dataset ds = TDBFactory.assembleDataset(assemblerFile) ;
    
    // ... do work ...
    
    ds.close() ;
}
 
开发者ID:xcurator,项目名称:xcurator,代码行数:11,代码来源:ExTDB2.java


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