Class QueryRewriteIndex


  • public class QueryRewriteIndex
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      QueryRewriteIndex()  
      QueryRewriteIndex​(java.lang.String queryRewriteLabel, int maxSize, long expiryInterval)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()
      Empty the index.
      static QueryRewriteIndex createDefault()
      Create QueryRewriteIndex using the default global settings.
      long getIndexSize()  
      boolean isIndexActive()  
      static void prepare​(Dataset dataset)
      Prepare a Dataset with the default QueryRewriteIndex settings.
      static void prepare​(Dataset dataset, java.lang.String queryRewriteLabel, int maxSize, long expiryInterval)
      Prepare a Dataset with the provided QueryRewriteIndex settings.
      void reset​(int maxSize, long expiryInterval)
      Reset the index to the provided max size and expiry interval.
      All contents will be lost.
      static QueryRewriteIndex retrieve​(Dataset dataset)
      Retrieve the QueryRewriteIndex from the Dataset Context.
      If no index has been setup then QueryRewriteIndex is created.
      static QueryRewriteIndex retrieve​(ExecutionContext execCxt)
      Retrieve the QueryRewriteIndex from the Context.
      If no index has been setup then QueryRewriteIndex is created.
      static QueryRewriteIndex retrieve​(Context context)
      Retrieve the QueryRewriteIndex from the Dataset Context.
      If no index has been setup then QueryRewriteIndex is created.
      void setActive​(boolean indexActive)
      Sets whether the index is active.
      static void setExpiry​(long mapExpiryIntervalDefault)
      Set the maximum default expiry interval in millisecond of QueryRewriteIndexes.
      void setMapExpiry​(long expiryInterval)
      Sets the expiry time in milliseconds of the Query Rewrite Index, if active.
      void setMapSize​(int maxSize)
      Sets whether the Query Rewrite Index is active.
      static void setMaxSize​(int mapSizeDefault)
      Set the maximum default size of QueryRewriteIndexes.
      java.lang.Boolean test​(Node subjectGeometryLiteral, Property predicate, Node objectGeometryLiteral, GenericPropertyFunction propertyFunction)  
      Model toModel()
      COnverts the index to a model of asserted spatial relation statements.
      static Dataset wrapModel​(Model model)
      Wrap Model in a Dataset and include QueryRewriteIndex.
      • Methods inherited from class java.lang.Object

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

      • QUERY_REWRITE_INDEX_SYMBOL

        public static final Symbol QUERY_REWRITE_INDEX_SYMBOL
    • Constructor Detail

      • QueryRewriteIndex

        public QueryRewriteIndex()
      • QueryRewriteIndex

        public QueryRewriteIndex​(java.lang.String queryRewriteLabel,
                                 int maxSize,
                                 long expiryInterval)
    • Method Detail

      • test

        public final java.lang.Boolean test​(Node subjectGeometryLiteral,
                                            Property predicate,
                                            Node objectGeometryLiteral,
                                            GenericPropertyFunction propertyFunction)
        Parameters:
        subjectGeometryLiteral -
        predicate -
        objectGeometryLiteral -
        propertyFunction -
        Returns:
        Result of relation between subject and object.
      • clear

        public final void clear()
        Empty the index.
      • setMapSize

        public final void setMapSize​(int maxSize)
        Sets whether the Query Rewrite Index is active.
        The index will be empty after this process.
        Parameters:
        maxSize - : use -1 for unlimited size
      • setMapExpiry

        public final void setMapExpiry​(long expiryInterval)
        Sets the expiry time in milliseconds of the Query Rewrite Index, if active.
        Parameters:
        expiryInterval - : use 0 or negative for unlimited timeout
      • isIndexActive

        public boolean isIndexActive()
        Returns:
        True if index is active.
      • toModel

        public Model toModel()
        COnverts the index to a model of asserted spatial relation statements.
        Returns:
        Model containing all true assertions.
      • setActive

        public final void setActive​(boolean indexActive)
        Sets whether the index is active.
        Parameters:
        indexActive -
      • getIndexSize

        public final long getIndexSize()
        Returns:
        Number of items in the index.
      • reset

        public void reset​(int maxSize,
                          long expiryInterval)
        Reset the index to the provided max size and expiry interval.
        All contents will be lost.
        Parameters:
        maxSize -
        expiryInterval -
      • setMaxSize

        public static final void setMaxSize​(int mapSizeDefault)
        Set the maximum default size of QueryRewriteIndexes. -1 for no limit, 0 for no storage.
        Parameters:
        mapSizeDefault -
      • setExpiry

        public static final void setExpiry​(long mapExpiryIntervalDefault)
        Set the maximum default expiry interval in millisecond of QueryRewriteIndexes. 0 for no expiry.
        Parameters:
        mapExpiryIntervalDefault -
      • createDefault

        public static final QueryRewriteIndex createDefault()
        Create QueryRewriteIndex using the default global settings.
        Returns:
        Query Rewrite Index using default global settings.
      • prepare

        public static final void prepare​(Dataset dataset)
        Prepare a Dataset with the default QueryRewriteIndex settings.
        Parameters:
        dataset -
      • prepare

        public static final void prepare​(Dataset dataset,
                                         java.lang.String queryRewriteLabel,
                                         int maxSize,
                                         long expiryInterval)
        Prepare a Dataset with the provided QueryRewriteIndex settings.
        Parameters:
        dataset -
        queryRewriteLabel -
        maxSize -
        expiryInterval -
      • retrieve

        public static final QueryRewriteIndex retrieve​(ExecutionContext execCxt)
        Retrieve the QueryRewriteIndex from the Context.
        If no index has been setup then QueryRewriteIndex is created.
        Parameters:
        execCxt -
        Returns:
        QueryRewriteIndex contained in the Context.
      • retrieve

        public static final QueryRewriteIndex retrieve​(Dataset dataset)
        Retrieve the QueryRewriteIndex from the Dataset Context.
        If no index has been setup then QueryRewriteIndex is created.
        Parameters:
        dataset -
        Returns:
        QueryRewriteIndex contained in the Context.
      • retrieve

        public static final QueryRewriteIndex retrieve​(Context context)
        Retrieve the QueryRewriteIndex from the Dataset Context.
        If no index has been setup then QueryRewriteIndex is created.
        Parameters:
        context -
        Returns:
        QueryRewriteIndex contained in the Context.
      • wrapModel

        public static final Dataset wrapModel​(Model model)
        Wrap Model in a Dataset and include QueryRewriteIndex.
        Parameters:
        model -
        Returns:
        Dataset with default Model and QueryRewriteIndex in Context.