本文整理汇总了Java中com.hp.hpl.jena.tdb.TDB类的典型用法代码示例。如果您正苦于以下问题:Java TDB类的具体用法?Java TDB怎么用?Java TDB使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TDB类属于com.hp.hpl.jena.tdb包,在下文中一共展示了TDB类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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());
}
示例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();
}
示例4: sync
import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
@Override
public void sync() throws DBException {
if (connection != null) {
connection.flush();
}
TDB.sync(dataset);
}
示例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);
}
示例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);
}
}
示例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;
}
示例8: sync
import com.hp.hpl.jena.tdb.TDB; //导入依赖的package包/类
public boolean sync() {
if (ds != null) {
TDB.sync(ds);
return true;
}
return false;
}
示例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;
}
示例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;
}
示例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;
}
示例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");
}
}
示例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);
}
示例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) ;
}
示例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) ;
}