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

public class EncodingAdHocSQLLayout extends AdHocSQLLayout
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.
  • Constructor Details

    • EncodingAdHocSQLLayout

      public EncodingAdHocSQLLayout(RDBMSDriver driver)
      Creates a new Strategy over the given driver
      Parameters:
      driver - the database driver
  • Method Details

    • handleTerms

      public void handleTerms(Set<Term> terms) throws SQLException
      //////////////////////////////////////////////
      Specified by:
      handleTerms in interface RDBMSStorageLayout
      Overrides:
      handleTerms in class AdHocSQLLayout
      Parameters:
      terms - the terms to handle
      Throws:
      SQLException - if an exception occur
    • getRepresentation

      public String getRepresentation(Term t) throws SQLException
      Description copied from interface: RDBMSStorageLayout
      Returns 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

      public Term createTerm(String term_encoding, TermFactory factory) throws SQLException
      Description copied from interface: RDBMSStorageLayout
      Recreates a term from its stored representation.

      This is the reverse operation of getRepresentation

      Specified by:
      createTerm in interface RDBMSStorageLayout
      Overrides:
      createTerm in class AdHocSQLLayout
      Parameters:
      term_encoding - string representation
      factory - to instantiate the term
      Returns:
      the term associated with the given string representation
      Throws:
      SQLException - if an exception occur
    • get_create_terms_table_query

      protected String get_create_terms_table_query()
      //////////////////////////////////////////////
      Overrides:
      get_create_terms_table_query in class AdHocSQLLayout
      Returns:
      the SQL query to create the term table
    • get_term_table_query_from_encoding

      protected String 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

      protected String 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

      protected String 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