use of fr.lirmm.graphik.graal.store.rdbms.util.DBTable in project graal by graphik-team.
the class AbstractRdbmsStore method createPredicateTable.
/**
* Create a table associated to the specified predicate and return the table
* informations.
*
* @param predicate
* @return the table informations.
* @throws AtomSetException
*/
protected DBTable createPredicateTable(Predicate predicate) throws AtomSetException {
String tableName = this.getFreshPredicateTableName(predicate);
DBTable table = null;
if (predicate.getArity() >= 1) {
Statement stat = this.createStatement();
table = generateNewDBTableData(tableName, predicate.getArity());
String query = this.getConjunctiveQueryTranslator().translateCreateTable(table);
try {
stat.executeUpdate(query);
} catch (SQLException e) {
throw new AtomSetException("Error during table creation: " + query, e);
}
if (stat != null) {
try {
stat.close();
} catch (SQLException e) {
throw new AtomSetException(e);
}
}
// add to the local map
this.predicateMap.put(predicate, table);
} else {
throw new AtomSetException("Unsupported arity 0");
}
return table;
}
use of fr.lirmm.graphik.graal.store.rdbms.util.DBTable in project graal by graphik-team.
the class AbstractRdbmsStore method getPredicateTable.
/**
* Get the table informations associated to the specified predicate. If
* there is no table for it, return null.
*
* @param predicate
* @return the table informations associated to the specified predicate.
* @throws AtomSetException
*/
protected DBTable getPredicateTable(Predicate predicate) throws AtomSetException {
// look in the local map
DBTable table = this.predicateMap.get(predicate);
if (table == null) {
// look in the database
table = this.getPredicateTableIfExist(predicate);
this.predicateMap.put(predicate, table);
}
return table;
}
Aggregations