Class PgqlConnection


  • public class PgqlConnection
    extends java.lang.Object
    This is a class used to create PgqlStatement and PgqlPreparedStatement objects for executing PGQL queries against graphs stored in Oracle Database.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearGraphMetadataCache()
      Clear the cache that stores graph metadata
      void clearTranslationCache()
      Clear the cache that stores translations
      PgqlStatement createStatement()
      Creates a new PgqlStatement object, which is used to execute PGQL queries
      void disableGraphMetadataCache()
      Disable the cache that stores graph metadata
      void disableTranslationCache()
      Disable the cache that stores translations
      void enableGraphMetadataCache()
      Enable the cache that stores graph metadata
      void enableTranslationCache()
      Enable the cache that stores translations
      static PgqlConnection getConnection​(java.sql.Connection conn)
      Factory method to get PgqlConnection instance.
      java.lang.String getGraph()
      Get the graph name on which PGQL queries will be executed for this connection.
      long getGraphMetadataRefreshInterval()
      get the time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution.
      java.sql.Connection getJdbcConnection()
      Get the JDBC connection that is used to execute PGQL queries
      int getMetadataFetchSize()
      Get fetch size that is used when loading graph metadata
      java.lang.String getSchema()
      Get the schema name that will be used to execute PGQL queries with this connection.
      PgqlPreparedStatement prepareStatement​(java.lang.String pgql)
      Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.
      PgqlPreparedStatement prepareStatement​(java.lang.String pgql, int timeout, int parallel, int dynamicSampling, int maxResults, java.lang.String matchOptions, java.lang.String options)
      Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.
      PgqlPreparedStatement prepareStatement​(java.lang.String pgql, java.lang.String matchOptions, java.lang.String options)
      Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.
      void setGraph​(java.lang.String graph)
      Sets the graph name on which PGQL queries will be executed for this connection.
      void setGraphMetadataCacheMaxCapacity​(int maxCapacity)
      Set max capacity value for the graph metadata cache
      void setGraphMetadataRefreshInterval​(long interval)
      Set a time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution.
      void setMetadataFetchSize​(int metadataFetchSize)
      Set fetch size that should be used when loading graph metadata
      void setSchema​(java.lang.String schema)
      Sets the schema name that will be used to execute PGQL queries with this connection.
      void setTranslationCacheMaxCapacity​(int maxCapacity)
      Set max capacity value for the translation cache
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getConnection

        public static PgqlConnection getConnection​(java.sql.Connection conn)
        Factory method to get PgqlConnection instance.
        Parameters:
        conn - a JDBC connection
        Returns:
        a PgqlConnection instance
      • setSchema

        public void setSchema​(java.lang.String schema)
        Sets the schema name that will be used to execute PGQL queries with this connection.
        Parameters:
        schema - the name of the schema
      • setGraph

        public void setGraph​(java.lang.String graph)
        Sets the graph name on which PGQL queries will be executed for this connection.
        Parameters:
        graph - the name of the graph
      • createStatement

        public PgqlStatement createStatement()
        Creates a new PgqlStatement object, which is used to execute PGQL queries
        Returns:
        a new PgqlStatement object that can be used to perform PGQL queries
      • prepareStatement

        public PgqlPreparedStatement prepareStatement​(java.lang.String pgql)
        Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.
        Parameters:
        pgql - the PGQL query to compile
        Returns:
        a new PgqlPreparedStatement object that can be used to efficiently execute the same query multiple times
      • prepareStatement

        public PgqlPreparedStatement prepareStatement​(java.lang.String pgql,
                                                      java.lang.String matchOptions,
                                                      java.lang.String options)
        Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.
        Parameters:
        pgql - the PGQL query to compile
        matchOptions - additional options used to influence query translation and execution
        options - additional options used to influence modify translation and execution
        Returns:
        a new PgqlPreparedStatement object that can be used to efficiently execute the same query multiple times
      • prepareStatement

        public PgqlPreparedStatement prepareStatement​(java.lang.String pgql,
                                                      int timeout,
                                                      int parallel,
                                                      int dynamicSampling,
                                                      int maxResults,
                                                      java.lang.String matchOptions,
                                                      java.lang.String options)
        Creates a new PgqlPreparedStatement object, which represents a pre-compiled PGQL statement.
        Parameters:
        pgql - the PGQL query to compile
        timeout - the number of seconds for query execution to finish
        parallel - the degree of parallelism to use for query and modify execution
        dynamicSampling - the value for dynamic sampling
        maxResults - the maximum number of rows returned
        matchOptions - additional options used to influence query translation and execution
        options - additional options used to influence modify translation and execution
        Returns:
        a new PgqlPreparedStatement object that can be used to efficiently execute the same query multiple times
      • getSchema

        public java.lang.String getSchema()
                                   throws PgqlToSqlException
        Get the schema name that will be used to execute PGQL queries with this connection. If the schema has not been set, the schema from JDBC connection is returned.
        Returns:
        the schema set for this connection
        Throws:
        PgqlToSqlException - if a database access error occurs or this method is called on a closed connection
      • getGraph

        public java.lang.String getGraph()
        Get the graph name on which PGQL queries will be executed for this connection.
        Returns:
        the graph name for this connection
      • getJdbcConnection

        public java.sql.Connection getJdbcConnection()
        Get the JDBC connection that is used to execute PGQL queries
        Returns:
        the connection
      • clearTranslationCache

        public void clearTranslationCache()
        Clear the cache that stores translations
      • disableTranslationCache

        public void disableTranslationCache()
        Disable the cache that stores translations
      • enableTranslationCache

        public void enableTranslationCache()
        Enable the cache that stores translations
      • setTranslationCacheMaxCapacity

        public void setTranslationCacheMaxCapacity​(int maxCapacity)
        Set max capacity value for the translation cache
        Parameters:
        maxCapacity - value for max capacity
      • setGraphMetadataRefreshInterval

        public void setGraphMetadataRefreshInterval​(long interval)
        Set a time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution. Metadata may become outdated if a graph is altered by another user or if a graph is altered by the same user through a separate client instance. Note: refreshing is only triggered upon query execution and would not happen during a period where no queries are executed. If not set, the default interval is 1000 milliseconds.
        Parameters:
        interval - the time interval in milliseconds to check if refreshing of graph metadata is needed
      • getGraphMetadataRefreshInterval

        public long getGraphMetadataRefreshInterval()
        get the time interval in milliseconds to determine the frequency to check for graph metadata changes in order to re-cache the necessary metadata for correct query execution.
        Returns:
        the time interval in milliseconds to check if refreshing of graph metadata is needed
      • clearGraphMetadataCache

        public void clearGraphMetadataCache()
        Clear the cache that stores graph metadata
      • disableGraphMetadataCache

        public void disableGraphMetadataCache()
        Disable the cache that stores graph metadata
      • enableGraphMetadataCache

        public void enableGraphMetadataCache()
        Enable the cache that stores graph metadata
      • setGraphMetadataCacheMaxCapacity

        public void setGraphMetadataCacheMaxCapacity​(int maxCapacity)
        Set max capacity value for the graph metadata cache
        Parameters:
        maxCapacity - value for max capacity
      • setMetadataFetchSize

        public void setMetadataFetchSize​(int metadataFetchSize)
        Set fetch size that should be used when loading graph metadata
        Parameters:
        metadataFetchSize - value for metadata fetch size
      • getMetadataFetchSize

        public int getMetadataFetchSize()
        Get fetch size that is used when loading graph metadata
        Returns:
        the fetch size used when loading graph metadata