📄 modelrdb.java
字号:
* specify the database type when constructing the DBConnection. Then use the call
* ModelRDB.createModel(IDBConnection)
*/
public static ModelRDB create(IDBConnection dbcon, String databaseType) throws RDFRDBException {
dbcon.setDatabaseType(databaseType);
return createModel(dbcon, null, getDefaultModelProperties(dbcon));
}
/**
* Returns a Jena Model containing model-specific properties.
* These describe the optimization/layout for this model in the database.
*
* The returned Model is a copy, modifying it will have no
* immediate effect on the database.
*
*
* @since Jena 2.0
*/
public Model getModelProperties() {
Model m = ModelFactory.createDefaultModel();
Graph g = m.getGraph();
ExtendedIterator it = m_graphRDB.getPropertyTriples();
while (it.hasNext()) g.add( (Triple) it.next());
return m;
}
/**
* Retrieve a default set of model customization properties
*
* The returned default set of properties is suitable for use in a call to
* ModelRDB.create(..., modelProperties);
*
* @param dbcon a DBConnectionI specifying the database connection
* @return Model containing default properties
*/
public static Model getDefaultModelProperties( IDBConnection dbcon ) {
return dbcon.getDefaultModelProperties();
}
/**
* List the names of all models stored in the database
* @return ExtendedIterator over the model names.
*/
public static ExtendedIterator listModels(IDBConnection dbcon) throws RDFRDBException {
return dbcon.getAllModelNames();
}
/** Close the Model and free up resources held.
*
* <p>Not all implementations of Model require this method to be called. But
* some do, so in general its best to call it when done with the object,
* rather than leave it to the finalizer.</p>
*/
public void close() {
m_graphRDB.close();
}
/**
* Remove all traces of this particular Model from the database.
*/
public void remove() throws RDFRDBException {
m_graphRDB.remove();
}
/**
* A convenience function to return the connection
*/
public IDBConnection getConnection() {
return m_graphRDB.getConnection();
}
/**
* Remove all the statements from the database which are associated with just this model.
* This no longer reformats the database (which makes it safer and useful for multi-model
* databases) but means that it is not guaranteed to garbage collect the resource table.
* @deprecated Since Jena 2.0 this call is not recommended (it's name
* is misleading) - to clear an entire database use DBConnection.cleanDB,
* to remove just this Model use Model.remove().
*/
public void clear() throws RDFRDBException {
remove();
}
/**
* Remove a named model from an existing multi-model database.
* Will throw an RDFDBException if the database layout does not support
* multiple models or if the database does not seem to formated.
* @param dbcon a DBConnectionI specifying the database connection
* @param name the name to give the newly created model
* @deprecated Since Jena 2.0, to remove a model use the ModelRDB.remove()
*/
public static void deleteModel(IDBConnection dbcon, String name) throws RDFRDBException {
ModelRDB modelToDelete = ModelRDB.open(dbcon, name);
modelToDelete.remove();
}
/**
* Loads all the statements for this model into an in-memory model.
* @return a ModelMem containing the whole of the RDB model
* @deprecated Since Jena 2.0, this call is not recommended. Instead use
* the soon-to-be-released bulk-load functions.
*/
public Model loadAll() {
Model m = ModelFactory.createDefaultModel();
for (StmtIterator i = this.listStatements(); i.hasNext(); ) {
m.add( i.nextStatement() );
}
return m;
}
/**
* Get the value of DoDuplicateCheck
* @return bool boolean
*/
public boolean getDoDuplicateCheck() {
return m_graphRDB.getDoDuplicateCheck();
}
/**
* Set the value of DoDuplicateCheck.
* @param bool boolean
*/
public void setDoDuplicateCheck(boolean bool) {
m_graphRDB.setDoDuplicateCheck(bool);
}
/**
* Set the value of DoFastpath.
* @param val boolean
*/
public void setDoFastpath ( boolean val ) {
m_graphRDB.setDoFastpath(val);
}
/**
* Get the value of DoFastpath.
* @return boolean
*/
public boolean getDoFastpath () {
return m_graphRDB.getDoFastpath();
}
/**
* Set the value of QueryOnlyAsserted.
* @param opt boolean
*/
public void setQueryOnlyAsserted ( boolean opt ) {
m_graphRDB.setQueryOnlyAsserted(opt);
}
/**
* Get the value of QueryOnlyAsserted.
* @return boolean
*/
public boolean getQueryOnlyAsserted() {
return m_graphRDB.getQueryOnlyAsserted();
}
/**
* Set the value of QueryOnlyReified.
* @param opt boolean
*/
public void setQueryOnlyReified ( boolean opt ) {
m_graphRDB.setQueryOnlyReified(opt);
}
/**
* Get the value of QueryOnlyReified.
* @return boolean
*/
public boolean getQueryOnlyReified() {
return m_graphRDB.getQueryOnlyReified();
}
/**
* Set the value of QueryFullReified.
* @param opt boolean
*/
public void setQueryFullReified ( boolean opt ) {
m_graphRDB.setQueryFullReified(opt);
}
/**
* Get the value of QueryFullReified.
* @return boolean
*/
public boolean getQueryFullReified() {
return m_graphRDB.getQueryFullReified();
}
/**
* Set the value of DoImplicitJoin.
* @param val boolean
*/
public void setDoImplicitJoin ( boolean val ) {
m_graphRDB.setDoImplicitJoin(val);
}
}
/*
(c) Copyright 2002, 2003, 2004, 2005, 2006, 2007 Hewlett-Packard Development Company, LP
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -