QueryAnalyser
Keywords: uk.ac.ic.doc.rodex.qproc.QueryAnalyser 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 QueryAnalyser

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

    public class QueryAnalyser

extends java.lang.Object

Constructor Summary
`QueryAnalyser(ASG asg)` Creates a new instance of QueryAnalyser

Method Summary
`void` | `analyse()` Start analysing the query
`boolean` | `containsSubGoal(java.util.List subGoals)` Check if a query/view contains some sub-goals
`ASG` | `getASG()` The original ASG object of the represented view
`Cell` | `getASGRoot()`
`java.util.List` | `getConstantVariables()` Return a `List` of constant variables in the query.
`java.util.List` | `getFunctions()` Return the `List` of `QueryFunction` objects found. Returns `null` if no functions found
`java.util.List` | `getFunctions(QuerySubGoal qsg)` Get a `List` of query functions which are linked to a specified query sub-goal
`java.util.List` | `getFunctions(QueryVariable var)` Get a `List` of query functions which are linked to a specified query variable
`int` | `getHeadVarIndex(java.lang.String var)` Return the index of a head variable in the query head var set
`java.util.List` | `getHeadVars()` Getter methods
`java.util.Map` | `getHeadVarsForTable(java.lang.String tableName)` Return a `Map` of head vars that are associated to a table.
`java.lang.String` | `getInternalQuery(boolean rebuildIfExist)` Create the internal representation of the original query in which each query scheme is replaced by a unique object-id assigned to it in the repository.
`java.lang.String` | `getQueryString()` Return the query representation as it was originally passed in
`java.util.Map` | `getQueryVariables()`
`java.lang.String` | `getSchemaName()` Return the schema name of the query
`java.util.List` | `getSubGoals()` Return a list of `QuerySubGoal` objects
`java.util.List` | `getTableNames()`
`java.util.List` | `getVariableMappings(QueryVariable var)` Check if a query variable is mappable to one of the variables of the query If mappings found, return them in a `List`
`boolean` | `hasConstants()` A quick check whether there are constants in the query
`boolean` | `hasFunctions(QueryVariable var)` Test if a `QueryVariable` has any associated functions
`boolean` | `isHeadVar(QueryVariable var)`
`boolean` | `isMappableToHeadVar(QueryVariable var)` Check that a query variable object is truly a head var, i.e.
`void` | `setSchemaName(java.lang.String schemaName)` Set the schema name
`void` | `setSubGoal(int index, QuerySubGoal qsg)` Push a sub-goal object in a pariticular position in the sub goal list

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

Constructor Detail

### QueryAnalyser

    public QueryAnalyser(ASG asg)

  Creates a new instance of QueryAnalyser

Method Detail

### analyse

    public void analyse()
                 throws QueryIntegrityException

  Start analysing the query

  Throws:
    `QueryIntegrityException`

### getHeadVars

    public java.util.List getHeadVars()

  Getter methods

### getHeadVarIndex

    public int getHeadVarIndex(java.lang.String var)

  Return the index of a head variable in the query head var set

### isHeadVar

    public boolean isHeadVar(QueryVariable var)

### isMappableToHeadVar

    public boolean isMappableToHeadVar(QueryVariable var)

  Check that a query variable object is truly a head var, i.e. at least one of the sub-goals to which this var is mapped is the same as one of the sub-goals of the head vars of this view

### getSubGoals

    public java.util.List getSubGoals()

  Return a list of `QuerySubGoal` objects

### containsSubGoal

    public boolean containsSubGoal(java.util.List subGoals)

  Check if a query/view contains some sub-goals

### getTableNames

    public java.util.List getTableNames()

### getQueryVariables

    public java.util.Map getQueryVariables()

### getConstantVariables

    public java.util.List getConstantVariables()

  Return a `List` of constant variables in the query. If there
  are not constant variables then `null` is returned instead.

### setSubGoal

    public void setSubGoal(int index,
                           QuerySubGoal qsg)

  Push a sub-goal object in a pariticular position in the sub goal list

### hasConstants

    public boolean hasConstants()

  A quick check whether there are constants in the query

### hasFunctions

    public boolean hasFunctions(QueryVariable var)

  Test if a `QueryVariable` has any associated functions

### getVariableMappings

    public java.util.List getVariableMappings(QueryVariable var)

  Check if a query variable is mappable to one of the variables of the query
  If mappings found, return them in a `List`

  Parameters:
    `var` - a `QueryVariable` object
  Returns:
    `List` of mapped `QueryVariable`s in the query
    OR null if no mappings found

### getSchemaName

    public java.lang.String getSchemaName()

  Return the schema name of the query

### setSchemaName

    public void setSchemaName(java.lang.String schemaName)

  Set the schema name

### getFunctions

    public java.util.List getFunctions()

  Return the `List` of `QueryFunction` objects found.
  Returns `null` if no functions found

### getFunctions

    public java.util.List getFunctions(QueryVariable var)

  Get a `List` of query functions which are linked to a specified query variable

### getFunctions

    public java.util.List getFunctions(QuerySubGoal qsg)

  Get a `List` of query functions which are linked to a specified query sub-goal

### getHeadVarsForTable

    public java.util.Map getHeadVarsForTable(java.lang.String tableName)

  Return a `Map` of head vars that are associated to a table. The returned hash map maps a variable to the actual query field that it is mapped to

### getASGRoot

    public Cell getASGRoot()

### getASG

    public ASG getASG()

  The original ASG object of the represented view

### getQueryString

    public java.lang.String getQueryString()

  Return the query representation as it was originally passed in

### getInternalQuery

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

  Create the internal representation of the original query in which each query scheme
  is replaced by a unique object-id assigned to it in the repository. This method is typically used after the original query has undergone some form of
  transformation or rewriting which cause changes to its schemes.

  Parameters:
    `rebuildIfExist` - a boolean flag indicating whether to re-use the existing query string (if any)
    or to rebuild even if it exists
  Throws:
    `QueryIntegrityException`

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