• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java TDB类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.hp.hpl.jena.tdb.TDB的典型用法代码示例。如果您正苦于以下问题:Java TDB类的具体用法?Java TDB怎么用?Java TDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TDB类属于com.hp.hpl.jena.tdb包,在下文中一共展示了TDB类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: init

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public static void init() { 
        if ( initialized )
            return ;
        Quack.log.info("Quack");
        initialized = true ;
        TDB.init();
        MappingRegistry.addPrefixMapping("quack", "quack:");
        
        QueryEngineTDB.unregister(); 
        QueryEngineQuackTDB.register() ;
        Quack.setOpExecutorFactory(OpExecutorQuackTDB.factorySubstitute) ;
        PlannerSubstitution.DOMERGE = false ;

//        rewire() ;

//        if (PlannerTDB.DOMERGE ) {
//            log.info("Quack initialization [ Merge ]");
//            hardRewire();
//        } else
//            log.info("Quack initialization [ No Merge ]");
        // printIndexes() ;
        // ARQ.setExecutionLogging(InfoLevel.ALL);
    }
 
开发者ID:afs,项目名称:quack,代码行数:24,代码来源:Quack.java


示例2: open

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
@Override
    public void open() throws DatabaseConfigurationException {
//        this.dataset = TDBFactory.createDataset(getDataDir());
	directory = getDataDir();

        TDB.getContext().set(TDB.symUnionDefaultGraph, true); // todo: make configurable?
        connection = StoreConnection.make(getMyDataDir());
    }
 
开发者ID:ljo,项目名称:exist-sparql,代码行数:9,代码来源:TDBRDFIndex.java


示例3: close

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
@Override
public void close() throws DBException {
    if (dataset != null) {
        dataset.close();
        dataset = null;
    }
    connection = null;
    TDB.closedown();
}
 
开发者ID:ljo,项目名称:exist-sparql,代码行数:10,代码来源:TDBRDFIndex.java


示例4: sync

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
@Override
public void sync() throws DBException {
    if (connection != null) {
        connection.flush();
    }
    TDB.sync(dataset);
}
 
开发者ID:ljo,项目名称:exist-sparql,代码行数:8,代码来源:TDBRDFIndex.java


示例5: addModel

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public void addModel(Model m, String name) {
	if (name == null) {
		logger.info("cannot add the model because the given name is null.");
		return;
	}
	
	Model namedModel = this.dataset.getNamedModel(name); 
	namedModel.removeAll();
	namedModel.add(m.listStatements());
	namedModel.setNsPrefixes(m.getNsPrefixMap());
	namedModel.commit();
	TDB.sync(this.dataset);
}
 
开发者ID:therelaxist,项目名称:spring-usc,代码行数:14,代码来源:Repository.java


示例6: closeTdbDS

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
protected void closeTdbDS() {
	if (getTdbDS(false) != null) {
		while (tdbDS.isInTransaction()) {
			logger.debug("Waiting for TDB Repo transaction to complete before closing");
//			thread.sleep(100);
		}
		logger.debug("Closing TDB Repo, setting Dataset " + tdbDS + " to null");
		TDB.sync(tdbDS);
		tdbDS.close();
		TDB.closedown();
		setTdbDS(null);
	}
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:14,代码来源:CsvImporter.java


示例7: deleteTdbRepository

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
/** Method to remove TDB repository from file system
 * 
 * @param f TDB folder on file system
 * @return true if successful else false
 */
private synchronized boolean deleteTdbRepository(File f) {
	if (!getSadlUtils().recursiveDelete(f)) {
		TDB.closedown();
		if (!getSadlUtils().recursiveDelete(f)) {
			logger.debug("Failed to delete TDB Repo '" + f.getAbsolutePath() + "'");
			return false;
		}
	}
	logger.debug("Deleted TDB Repo '" + f.getAbsolutePath() + "'");
	return true;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:17,代码来源:CsvImporter.java


示例8: sync

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public boolean sync() {
	if (ds != null) {
		TDB.sync(ds);
		return true;
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:8,代码来源:SadlJenaModelGetter.java


示例9: close

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public boolean close() {
	if (ds != null) {
		TDB.sync(ds);
		ds.close();
		ds = null;
		return true;
	}
	return false;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:10,代码来源:SadlJenaModelGetter.java


示例10: setTdbFolder

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public void setTdbFolder(String _tdbFolder) {
   	if (ds != null) {
   		// we have an open TDB Dataset
   		if (getTdbFolder() != null && !_tdbFolder.equals(getTdbFolder())) {
   			// the TDB location has changed
   			TDB.sync(ds);
   			ds.close();
   			ds = TDBFactory.createDataset( _tdbFolder );
   		}
   	}
   	else if (getFormat().equals(IConfigurationManager.JENA_TDB)){
		ds = TDBFactory.createDataset( _tdbFolder );
   	}
	tdbFolder = _tdbFolder;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:16,代码来源:SadlJenaModelGetter.java


示例11: setTdbFolder

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public void setTdbFolder(String _tdbFolder) {
   	if (ds != null) {
   		// we have an open TDB Dataset
   		if (getTdbFolder() != null && !_tdbFolder.equals(getTdbFolder())) {
   			// the TDB location has changed
   			TDB.sync(ds);
   			ds.close();
   			ds = TDBFactory.createDataset( _tdbFolder );
   		}
   	}
   	else if (getFormat().equals(JENA_TDB)){
		ds = TDBFactory.createDataset( _tdbFolder );
   	}
	tdbFolder = _tdbFolder;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:16,代码来源:SadlJenaModelGetter.java


示例12: showQueryResults

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
private void showQueryResults(String queryString, HttpServletRequest request, HttpServletResponse response) 
		throws IOException {
	Query query = QueryFactory.create(queryString);
	if(query.isSelectType() || query.isDescribeType()) {
		Config config = new Config(request);
		ResultsFormat fmt = ResultsFormat.lookup(request.getParameter("format"));
		Dataset tdbstore = TDBFactory.createDataset(config.getTripleStoreDir());
		QueryExecution qexec = QueryExecutionFactory.create(query, tdbstore);
		qexec.getContext().set(TDB.symUnionDefaultGraph, true);
		if(query.isSelectType()) {
 			ResultSet results = qexec.execSelect();
 			if(fmt == null) {
 				out.print(queryString+"\n");
 				ResultSetFormatter.out(out, results, query);
 			}
 			else
 				ResultSetFormatter.output(out, results, fmt);
		}
		else {
		  Model model = qexec.execDescribe();
       RDFWriter rdfWriter = model.getWriter("RDF/XML-ABBREV");
       rdfWriter.setProperty("showXmlDeclaration", "true");
       rdfWriter.setProperty("tab", "6");
       rdfWriter.write(model, out, null);
		}
	}
	else {
		out.print("Only select or describe queries allowed");
	}
}
 
开发者ID:IKCAP,项目名称:turbosoft,代码行数:31,代码来源:SparqlEndpoint.java


示例13: updateDataset

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
private void updateDataset(String updateString, HttpServletRequest request, HttpServletResponse response) 
		throws IOException {
	Config config = new Config(request);
	Dataset tdbstore = TDBFactory.createDataset(config.getTripleStoreDir());
	UpdateRequest update = UpdateFactory.create(updateString);
	UpdateAction.execute(update, tdbstore);
	out.print("Updated");
	TDB.sync(tdbstore);
}
 
开发者ID:IKCAP,项目名称:turbosoft,代码行数:10,代码来源:SparqlEndpoint.java


示例14: tdbindexdump

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
protected tdbindexdump(String[] argv) {
    super(argv) ;
    super.modVersion.addClass(ARQ.class) ;
    super.modVersion.addClass(RIOT.class) ;
    super.modVersion.addClass(TDB.class) ;
    super.add(argLocation) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:8,代码来源:tdbindexdump.java


示例15: tdbindexcopy

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
protected tdbindexcopy(String[] argv) {
    super(argv) ;
    super.modVersion.addClass(ARQ.class) ;
    super.modVersion.addClass(RIOT.class) ;
    super.modVersion.addClass(TDB.class) ;
    super.add(argLocation) ;
}
 
开发者ID:afs,项目名称:quack,代码行数:8,代码来源:tdbindexcopy.java


示例16: getModel

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
/**
 * Call this method to get a model by its public URI and if necessary read it using the specified ModelReader
 */
public Model getModel( String uri, ModelReader loadIfAbsent ) {
	boolean addToTDB = addMissingModelToTDB;
	Model m = null;
	if (uri.equals(IConfigurationManager.ServicesConfigurationURI)) {
		// this is a special case--it is always left as an OWL file in RDF/XML format
		addToTDB = false;
	}
	else if (getFormat().equals(IConfigurationManager.JENA_TDB)) {
		// try TDB first
		m = getModel(uri);
	}
	if (m == null && loadIfAbsent != null) {
        String altUrl = configurationManager.getJenaDocumentMgr().doAltURLMapping(uri);
        if (altUrl != null && altUrl.endsWith(".TDB/")) {
        	try {
        		SadlUtils su = new SadlUtils();
        		Dataset tmpds = TDBFactory.createDataset(su.fileUrlToFileName(altUrl));
        		tmpds.begin(ReadWrite.READ);
	m = tmpds.getDefaultModel();
	tmpds.end();
} catch (MalformedURLException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
        }
        else {
            m = ModelFactory.createDefaultModel();
         loadIfAbsent.readModel( m, altUrl != null ? altUrl : uri );
         if (addToTDB && ds != null && getFormat().equals(IConfigurationManager.JENA_TDB)) {
         	ds.begin(ReadWrite.WRITE);
         	ds.addNamedModel( uri, m );
         	ds.commit();
         	ds.end();
         	TDB.sync(ds);
         }
        }
        loadUserDefinedDataTypes(uri, altUrl);
    }

    return m;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:45,代码来源:SadlJenaModelGetter.java


示例17: getModel

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
/**
 * Call this method to get a model by its public URI and if necessary read it using the specified ModelReader
 */
public Model getModel( String uri, ModelReader loadIfAbsent ) {
	boolean addToTDB = addMissingModelToTDB;
	Model m = null;
	if (uri.equals(IConfigurationManager.ServicesConfigurationURI)) {
		// this is a special case--it is always left as an OWL file in RDF/XML format
		addToTDB = false;
	}
	else if (getFormat().equals(IConfigurationManager.JENA_TDB)) {
		// try TDB first
		m = getModel(uri);
	}
	if (m == null && loadIfAbsent != null) {
        String altUrl = configurationManager.getJenaDocumentMgr().doAltURLMapping(uri);
        if (altUrl != null && altUrl.endsWith(".TDB/")) {
        	try {
        		SadlUtils su = new SadlUtils();
        		Dataset tmpds = TDBFactory.createDataset(su.fileUrlToFileName(altUrl));
        		tmpds.begin(ReadWrite.READ);
	m = tmpds.getDefaultModel();
	tmpds.end();
} catch (MalformedURLException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
        }
        else {
            m = ModelFactory.createDefaultModel();
         loadIfAbsent.readModel( m, altUrl != null ? altUrl : uri );
         if (addToTDB && ds != null && getFormat().equals(IConfigurationManager.JENA_TDB)) {
         	ds.begin(ReadWrite.WRITE);
         	ds.addNamedModel( uri, m );
         	ds.commit();
         	ds.end();
         	TDB.sync(ds);
         }
        }
    }

    return m;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:44,代码来源:SadlJenaModelGetter.java


示例18: getModel

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
/**
 * Call this method to get a model by its public URI and if necessary read it using the specified ModelReader
 */
public Model getModel( String uri, ModelReader loadIfAbsent ) {
	boolean addToTDB = addMissingModelToTDB;
	Model m = null;
	if (uri.equals(ServicesConfigurationURI)) {
		// this is a special case--it is always left as an OWL file in RDF/XML format
		addToTDB = false;
	}
	else if (getFormat().equals(JENA_TDB)) {
		// try TDB first
		m = getModel(uri);
	}
	if (m == null && loadIfAbsent != null) {
        String altUrl = modelSpec.getDocumentManager().doAltURLMapping(uri);
        if (altUrl != null && altUrl.endsWith(".TDB/")) {
        	try {
        		SadlUtils su = new SadlUtils();
        		Dataset tmpds = TDBFactory.createDataset(su.fileUrlToFileName(altUrl));
        		tmpds.begin(ReadWrite.READ);
	m = tmpds.getDefaultModel();
	tmpds.end();
} catch (MalformedURLException e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
        }
        else {
            m = ModelFactory.createDefaultModel();
         loadIfAbsent.readModel( m, altUrl != null ? altUrl : uri );
         if (addToTDB && ds != null && getFormat().equals(JENA_TDB)) {
         	ds.begin(ReadWrite.WRITE);
         	ds.addNamedModel( uri, m );
         	ds.commit();
         	ds.end();
         	TDB.sync(ds);
         }
        }
        loadUserDefinedDataTypes(uri, altUrl);
    }

    return m;
}
 
开发者ID:crapo,项目名称:sadlos2,代码行数:45,代码来源:SadlJenaModelGetter.java


示例19: main

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
static public void main(String... argv) {
    TDB.setOptimizerWarningFlag(false) ;
    new qupdate(argv).mainRun() ;
}
 
开发者ID:afs,项目名称:quack,代码行数:5,代码来源:qupdate.java


示例20: main

import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
static public void main(String... argv) {
    TDB.setOptimizerWarningFlag(false) ;
    new tdbindexdump(argv).mainRun() ;
}
 
开发者ID:afs,项目名称:quack,代码行数:5,代码来源:tdbindexdump.java



注:本文中的com.hp.hpl.jena.tdb.TDB类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Tar类代码示例发布时间:2022-05-23
下一篇:
Java JaroWinklerDistance类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap