Class EncodingAdHocSQLLayout
java.lang.Object
fr.inria.rules.integraal.storage.external.rdbms.layout.AdHocSQLLayout
fr.inria.rules.integraal.storage.external.rdbms.layout.EncodingAdHocSQLLayout
- All Implemented Interfaces:
RDBMSStorageLayout
This strategy works in the same way as the AdHoc but additionally
Each term is also stored with it's encoding (a number)
In the tables representing atoms, only the encoding is stored
This lets us work only with numbers for comparison and also potentially reduces the storage cost of string representations for each occurrence of the term.
-
Field Summary
Fields inherited from class AdHocSQLLayout
driver, runnerFields inherited from interface RDBMSStorageLayout
ATOM_TABLE_PREDICATE_PREFIX, INDEX_NAME_PREFIX, PREDICATE_TABLE_NAME, TERM_TABLE_NAME -
Constructor Summary
ConstructorsConstructorDescriptionEncodingAdHocSQLLayout(RDBMSDriver driver) Creates a new Strategy over the given driver -
Method Summary
Modifier and TypeMethodDescriptioncreateTerm(String term_encoding, TermFactory factory) Recreates a term from its stored representation.protected String//////////////////////////////////////////////protected StringReturns the SQL query used to retrieve the current maximum encoding.protected StringReturns the SQL query used to retrieve a term by its encoding.protected StringReturns the SQL query used to retrieve the encoding of a term.Returns the storage representation of a term.voidhandleTerms(Set<Term> terms) //////////////////////////////////////////////Methods inherited from class AdHocSQLLayout
addSpecificConditions, canHandleFiltering, createDatabaseSchema, createPredicate, get_all_predicates_query, get_atom_table_prefix, get_count_predicate_query, get_create_atom_table, get_create_predicate_table_query, get_insert_predicate_query, get_predicate_table_name, get_predicate_table_query, get_term_table_query, getAllPredicates, getAllTableNames, getColumnName, getTableName, getTermsTableName, getType, hasCorrectDatabaseSchema
-
Constructor Details
-
EncodingAdHocSQLLayout
Creates a new Strategy over the given driver- Parameters:
driver- the database driver
-
-
Method Details
-
handleTerms
//////////////////////////////////////////////- Specified by:
handleTermsin interfaceRDBMSStorageLayout- Overrides:
handleTermsin classAdHocSQLLayout- Parameters:
terms- the terms to handle- Throws:
SQLException- if an exception occur
-
getRepresentation
Description copied from interface:RDBMSStorageLayoutReturns the storage representation of a term.This is the reverse operation of createTerm
- Parameters:
t- the term- Returns:
- the string representation according to the storage strategy of the given term
- Throws:
SQLException- if an exception occur
-
createTerm
Description copied from interface:RDBMSStorageLayoutRecreates a term from its stored representation.This is the reverse operation of getRepresentation
- Specified by:
createTermin interfaceRDBMSStorageLayout- Overrides:
createTermin classAdHocSQLLayout- Parameters:
term_encoding- string representationfactory- to instantiate the term- Returns:
- the term associated with the given string representation
- Throws:
SQLException- if an exception occur
-
get_create_terms_table_query
//////////////////////////////////////////////- Overrides:
get_create_terms_table_queryin classAdHocSQLLayout- Returns:
- the SQL query to create the term table
-
get_term_table_query_from_encoding
Returns the SQL query used to retrieve a term by its encoding.- Returns:
- the SQL query to get a term by its encoding
-
get_term_table_query_from_label
Returns the SQL query used to retrieve the encoding of a term.- Returns:
- the SQL query to get the encoding of a term
-
get_max_term_encoding_query
Returns the SQL query used to retrieve the current maximum encoding.- Returns:
- the SQL query to get the max encoding already used
-