QueryRewriteProcessor
Keywords: uk.ac.ic.doc.rodex.qproc.QueryRewriteProcessor class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## uk.ac.ic.doc.rodex.qproc
Class QueryRewriteProcessor

    java.lang.Object
      uk.ac.ic.doc.rodex.qproc.QueryRewriteProcessor

    public class QueryRewriteProcessor

extends java.lang.Object

Field Summary
`static int` | `TYPE_BUCKET`
`static int` | `TYPE_INVERSE_RULE`
`static int` | `TYPE_MINICON`
`static int` | `TYPE_MINICON_ADAPTIVE`
`static int` | `TYPE_MINICON_DISTRIBUTED`
`static int` | `TYPE_MINICON_NONCONJUNCTIVE`
`static int` | `TYPE_RANGE_BASED`

Constructor Summary
`QueryRewriteProcessor(Schema querySchema, ASG query, int type)`
`QueryRewriteProcessor(Schema querySchema, QueryAnalyser qa, int type)`

Method Summary
`java.lang.String` | `getExecutionalQuery(boolean rebuildIfExist)` Rewrite optimised query the same way as in `getInternalQuery(boolean rebuildIfExist)` to construct the executional query.
`java.lang.String` | `getExternalQuery()` Get external query
`java.lang.String` | `getFormuatedQuery()` Return the original formulated query
`java.lang.String` | `getInternalQuery(boolean rebuildIfExist)` Rewrite formulated query string so that each scheme (sub-goal) is replaced by a unique scheme-obj-id in the repository.
`static SchemaObject[]` | `getQueriedSchemaObjects(QueryAnalyser qa)` Return an array of schema objects being queried.
`QueryAnalyser` | `getQueryMetadata()` Return the metadata (`QueryAnalyser`) object of the external query
`static java.lang.String` | `getRepositoryFriendlyQuery(Schema defaultSchema, QueryAnalyser qa)` A common method for building the repository-oriented representation of an IQL query One requirement for this is that the rewritting query must contain schema name for each scheme (subgoal) that it contains.
`ASG` | `getResultASG()` Return the `ASG` representation of the cached views
`java.lang.String` | `getResultString()` Return the `String` representation of the cached views
`void` | `initRewriterEngine(ASG extent)` Create a new `QueryWriter` instance for range-based queries
`void` | `initRewriterEngine(java.util.List cachedViews)` Create a new `QueryWriter` instance from a `List` of cached view `String`s
`void` | `initRewriterEngine(QueryAnalyser[] viewMetadata)` Create a new `QueryWriter` instance from an array of metadata objects
`static java.lang.String` | `joinIQLResult(java.util.List asgObjects)`
`void` | `produceIQLResult(java.util.List asgObjects)` Once rewriting is performed, produce the IQL results
`QueryRewriterResult` | `rewrite()` Rewrite query to produce `QueryRewriterResult` object
`void` | `setFormulatedQuery(ASG formulatedQuery)` Setter for formulated query (i.e.
`void` | `setOptimisedQuery(ASG optimisedQuery)` Store result of query optimisation

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### TYPE_BUCKET

    public static final int TYPE_BUCKET

See Also:
  Constant Field Values

### TYPE_INVERSE_RULE

    public static final int TYPE_INVERSE_RULE

See Also:
  Constant Field Values

### TYPE_MINICON

    public static final int TYPE_MINICON

See Also:
  Constant Field Values

### TYPE_MINICON_NONCONJUNCTIVE

    public static final int TYPE_MINICON_NONCONJUNCTIVE

See Also:
  Constant Field Values

### TYPE_MINICON_ADAPTIVE

    public static final int TYPE_MINICON_ADAPTIVE

See Also:
  Constant Field Values

### TYPE_MINICON_DISTRIBUTED

    public static final int TYPE_MINICON_DISTRIBUTED

See Also:
  Constant Field Values

### TYPE_RANGE_BASED

    public static final int TYPE_RANGE_BASED

See Also:
  Constant Field Values

Constructor Detail

### QueryRewriteProcessor

    public QueryRewriteProcessor(Schema querySchema,
                                 ASG query,
                                 int type)

### QueryRewriteProcessor

    public QueryRewriteProcessor(Schema querySchema,
                                 QueryAnalyser qa,
                                 int type)

Method Detail

### initRewriterEngine

    public void initRewriterEngine(java.util.List cachedViews)

  Create a new `QueryWriter` instance from a `List` of cached view `String`s

  Parameters:
    `views` - a `List` of cached views for rewriting query

### initRewriterEngine

    public void initRewriterEngine(QueryAnalyser[] viewMetadata)
                            throws QueryRewriterException

  Create a new `QueryWriter` instance from an array of metadata objects

  Parameters:
    `viewMetadata` - an array of `QueryAnalyser` objects of the cached views
  Throws:
    `QueryRewriterException`

### initRewriterEngine

    public void initRewriterEngine(ASG extent)

  Create a new `QueryWriter` instance for range-based queries

  Parameters:
    `viewMetadata` - an array of `QueryAnalyser` objects of the cached views

### setOptimisedQuery

    public void setOptimisedQuery(ASG optimisedQuery)

  Store result of query optimisation

### setFormulatedQuery

    public void setFormulatedQuery(ASG formulatedQuery)

  Setter for formulated query (i.e. external query rewritten w.r.t schema). This query format is used to produce internal query

### getFormuatedQuery

    public java.lang.String getFormuatedQuery()

  Return the original formulated query

### getExternalQuery

    public java.lang.String getExternalQuery()

  Get external query

### getInternalQuery

    public java.lang.String getInternalQuery(boolean rebuildIfExist)
                                      throws QueryIntegrityException

  Rewrite formulated query string so that each scheme (sub-goal) is replaced by
  a unique scheme-obj-id in the repository. This is performed by analysing the
  external query structure and identify all scheme-obj-ids from the repository that corresponds to the schema:scheme elements using `Schema` class

  Parameters:
    `rebuildIfExist` - `true|false`: whether to rebuild query if one already exists
  Returns:
    the rewritten query
  Throws:
    `QueryIntegrityException`

### getExecutionalQuery

    public java.lang.String getExecutionalQuery(boolean rebuildIfExist)
                                         throws QueryIntegrityException

  Rewrite optimised query the same way as in `getInternalQuery(boolean rebuildIfExist)`
  to construct the executional query.

  Parameters:
    `rebuildIfExist` - `true|false`: whether to rebuild query if one already exists
  Returns:
    the rewritten query
  Throws:
    `QueryIntegrityException`

### getRepositoryFriendlyQuery

    public static java.lang.String getRepositoryFriendlyQuery(Schema defaultSchema,
                                                              QueryAnalyser qa)
                                                       throws QueryIntegrityException

  A common method for building the repository-oriented representation of an IQL query
  One requirement for this is that the rewritting query must contain schema name for each scheme (subgoal) that it contains.

  Parameters:
    `defaultSchema` - reference to the public `Schema` to which schemes are attached
    Each scheme might already have a schema defined, but if this is not the case
    the default schema is used.
    `{@link` - QueryAnalyser} the analyser object for looking up query elements
  Throws:
    `QueryIntegrityException`

### getQueriedSchemaObjects

    public static SchemaObject[] getQueriedSchemaObjects(QueryAnalyser qa)
                                                  throws QueryIntegrityException

  Return an array of schema objects being queried. Note: This method ONLY works after the internal query has been generated for the associated query!

  Parameters:
    `qa` - the `QueryAnalyser` object associated to a query
  Throws:
    `QueryIntegrityException`

### rewrite

    public QueryRewriterResult rewrite()
                                throws AutoMedException

  Rewrite query to produce `QueryRewriterResult` object

  Throws:
    `AutoMedException`

### getQueryMetadata

    public QueryAnalyser getQueryMetadata()
                                   throws QueryIntegrityException

  Return the metadata (`QueryAnalyser`) object of the external query

  Throws:
    `QueryIntegrityException`

### produceIQLResult

    public void produceIQLResult(java.util.List asgObjects)
                          throws QueryResultException

  Once rewriting is performed, produce the IQL results

  Throws:
    `QueryResultException`

### joinIQLResult

    public static java.lang.String joinIQLResult(java.util.List asgObjects)
                                          throws QueryResultException

  Throws:
    `QueryResultException`

### getResultString

    public java.lang.String getResultString()

  Return the `String` representation of the cached views

### getResultASG

    public ASG getResultASG()
                     throws ParseException

  Return the `ASG` representation of the cached views

  Throws:
    `ParseException`

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD