Class SimpleRuntimeContext

  • All Implemented Interfaces:
    IQueryRuntimeContext, ITableContext

    public class SimpleRuntimeContext
    extends TabularRuntimeContext
    A simple demo implementation of the IQRC interface using tables.

    Usage: first, instantiate IIndexTable tables with this as the 'tableContext' argument, and call TabularRuntimeContext.registerIndexTable(IIndexTable) manually to register them. Afterwards, they will be visible to the query backends.

    EXPERIMENTAL. This class or interface has been added as part of a work in progress. There is no guarantee that this API will work or that it will remain the same.

    Since:
    2.0
    • Constructor Detail

      • SimpleRuntimeContext

        public SimpleRuntimeContext​(IQueryMetaContext metaContext)
    • Method Detail

      • logError

        public void logError​(java.lang.String message)
        Description copied from interface: ITableContext
        Indicates that an error has occurred in maintaining an index table, e.g. duplicate value.
      • getMetaContext

        public IQueryMetaContext getMetaContext()
        Description copied from interface: IQueryRuntimeContext
        Provides metamodel-specific info independent of the runtime instance model.
      • coalesceTraversals

        public <V> V coalesceTraversals​(java.util.concurrent.Callable<V> callable)
                                 throws java.lang.reflect.InvocationTargetException
        Description copied from interface: IQueryRuntimeContext
        The given callable will be executed, and all model traversals will be delayed until the execution is done. If there are any outstanding information to be read from the model, a single coalesced model traversal will initialize the caches and deliver the notifications.

        Calls may be nested. A single coalesced traversal will happen at the end of the outermost call.

        Caution: results returned by the runtime context may be incomplete during the coalescing period, to be corrected by notifications sent during the final coalesced traversal. For example, if a certain input key is not cached yet, an empty relation may be reported during callable.call(); the cache will be constructed after the call terminates and notifications will deliver the entire content of the relation. Non-incremental query backends should therefore never enumerate input keys while coalesced (verify using IQueryRuntimeContext.isCoalescing()).

        Throws:
        java.lang.reflect.InvocationTargetException
      • isIndexed

        public boolean isIndexed​(IInputKey key,
                                 IndexingService service)
        Description copied from interface: IQueryRuntimeContext
        Returns true if index is available for the given key providing the given service.
      • wrapElement

        public java.lang.Object wrapElement​(java.lang.Object externalElement)
        Description copied from interface: IQueryRuntimeContext
        Wraps the external element into the internal representation that is to be used by the query backend

        model element -> internal object.

        null must be mapped to null.

      • unwrapElement

        public java.lang.Object unwrapElement​(java.lang.Object internalElement)
        Description copied from interface: IQueryRuntimeContext
        Unwraps the internal representation of the element into its original form

        internal object -> model element

        null must be mapped to null.

      • wrapTuple

        public Tuple wrapTuple​(Tuple externalElements)
        Description copied from interface: IQueryRuntimeContext
        Unwraps the tuple of elements into the internal representation that is to be used by the query backend

        model elements -> internal objects

        null must be mapped to null.

      • unwrapTuple

        public Tuple unwrapTuple​(Tuple internalElements)
        Description copied from interface: IQueryRuntimeContext
        Unwraps the tuple of internal representations of elements into their original forms

        internal objects -> model elements

        null must be mapped to null.

      • ensureWildcardIndexing

        public void ensureWildcardIndexing​(IndexingService service)
        Description copied from interface: IQueryRuntimeContext
        Starts wildcard indexing for the given service. After this call, no registration is required for this IndexingService. a previously set wildcard level cannot be lowered, only extended.
      • executeAfterTraversal

        public void executeAfterTraversal​(java.lang.Runnable runnable)
                                   throws java.lang.reflect.InvocationTargetException
        Description copied from interface: IQueryRuntimeContext
        Execute the given runnable after traversal. It is guaranteed that the runnable is executed as soon as the indexing is finished. The callback is executed only once, then is removed from the callback queue.
        Throws:
        java.lang.reflect.InvocationTargetException