org.eml.MMAX2.annotation.query.simplified
Class SimplifiedMMAXQLConverter

java.lang.Object
  extended by org.eml.MMAX2.annotation.query.simplified.SimplifiedMMAXQLConverter

public class SimplifiedMMAXQLConverter
extends java.lang.Object


Constructor Summary
SimplifiedMMAXQLConverter(MarkableChart _chart, boolean _interactive)
           
 
Method Summary
 java.lang.String convertFromSimplifiedMMAXQL(java.lang.String simplifiedCommand)
          This method is the main processing method for simplified MMAXQL queries.
 java.lang.String createVariableAssignmentForBasedataAccess(java.lang.String token, java.lang.String variableName)
          This method receives a sequence query token for basedata access (e.g.
 java.lang.String createVariableAssignmentForMarkableAccess(java.lang.String token, java.lang.String variableName)
          This method receives a sequence query token for markable access, and returns a MMAXQL statement for assigning the result to the variable variableName.
 void displayUserMessage(java.lang.String message)
           
 java.util.ArrayList getCompatibleLevelAndAttributeNames(java.lang.String singleCondition, boolean activeLevelsOnly)
           
 int getMatchingBracketPosition(int startposition, java.lang.String queryString, java.lang.String openingBracket, java.lang.String closingBracket)
           
 int[] getNextTerminalPositions(java.lang.String entireInputString, int from, int to)
           
 boolean isInFirstPartOfQueryToken(java.lang.String entireString, int pos)
           
 boolean isQueryToken(java.lang.String currentToken)
           
 boolean isTopLevelOpeningBracket(java.lang.String inString, int pos)
           
 java.util.ArrayList[] parseSequenceQueryTokenConditions(java.lang.String tokenString)
          This method receives a string representing a single simplified query token, and returns a list of all its AND- or OR-connected parts (separated by , or ;, respectively).
 java.lang.String processBracketedSimplifiedMMAXQLQuery(java.lang.String simplifiedCommand)
          This method receives an entire (potentially complex) string of simplified MMAXQL and returns the equivalent complex MMAXQL statement.
 java.util.ArrayList removeRedundantVariableAssigments(java.util.ArrayList list)
           
 java.lang.String simplifiedSequenceQueryToMMAXQL(java.lang.String simplifiedCommand, java.lang.String toplevelCommand, java.lang.String varNameSpace)
          This method receives a simplified MMAXQL sequence query and converts it to a sequence of MMAXQL queries ready to be executed.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimplifiedMMAXQLConverter

public SimplifiedMMAXQLConverter(MarkableChart _chart,
                                 boolean _interactive)
Method Detail

simplifiedSequenceQueryToMMAXQL

public final java.lang.String simplifiedSequenceQueryToMMAXQL(java.lang.String simplifiedCommand,
                                                              java.lang.String toplevelCommand,
                                                              java.lang.String varNameSpace)
This method receives a simplified MMAXQL sequence query and converts it to a sequence of MMAXQL queries ready to be executed.


isQueryToken

public final boolean isQueryToken(java.lang.String currentToken)

createVariableAssignmentForBasedataAccess

public final java.lang.String createVariableAssignmentForBasedataAccess(java.lang.String token,
                                                                        java.lang.String variableName)
This method receives a sequence query token for basedata access (e.g. '[Ii]t') and returns a MMAXQL statement for assigning the result to the variable variableName.


createVariableAssignmentForMarkableAccess

public final java.lang.String createVariableAssignmentForMarkableAccess(java.lang.String token,
                                                                        java.lang.String variableName)
This method receives a sequence query token for markable access, and returns a MMAXQL statement for assigning the result to the variable variableName. Sequence query tokens have the form text/attributes, where text is the (optional) specification of the markable text, and attributes the required attribute-value pair(s). If a query token does only contain a text specification, the attribute part is interpreted as the name of the level, if it does not contain ,.=. The attribute part can be empty if only one markable level is active at the time of execution. The attribute part can be complex, if a query token is required to match several attributes. In this case, single conditions must be separated by comma. Individual conditions for one query token must come from the same level!! Each condition can exhibit different forms of underspecification: It can consist of attribute values only, e.g. jj or {jj,jjr,jjs}. In this case, all supplied attribute values must be uniquely associated with *one* attribute on *one* level.


getCompatibleLevelAndAttributeNames

public final java.util.ArrayList getCompatibleLevelAndAttributeNames(java.lang.String singleCondition,
                                                                     boolean activeLevelsOnly)

parseSequenceQueryTokenConditions

public final java.util.ArrayList[] parseSequenceQueryTokenConditions(java.lang.String tokenString)
This method receives a string representing a single simplified query token, and returns a list of all its AND- or OR-connected parts (separated by , or ;, respectively). This method is required because splitting the string at all , positions is not safe because a string may contain ,-tokens at certain positions.


convertFromSimplifiedMMAXQL

public final java.lang.String convertFromSimplifiedMMAXQL(java.lang.String simplifiedCommand)
This method is the main processing method for simplified MMAXQL queries. It receives a string in simplified MMAXQL and returns a sequence of queries in converted MMAXQL, ready to be executed.


displayUserMessage

public final void displayUserMessage(java.lang.String message)

isTopLevelOpeningBracket

public final boolean isTopLevelOpeningBracket(java.lang.String inString,
                                              int pos)

isInFirstPartOfQueryToken

public final boolean isInFirstPartOfQueryToken(java.lang.String entireString,
                                               int pos)

getNextTerminalPositions

public final int[] getNextTerminalPositions(java.lang.String entireInputString,
                                            int from,
                                            int to)

processBracketedSimplifiedMMAXQLQuery

public final java.lang.String processBracketedSimplifiedMMAXQLQuery(java.lang.String simplifiedCommand)
This method receives an entire (potentially complex) string of simplified MMAXQL and returns the equivalent complex MMAXQL statement.


removeRedundantVariableAssigments

public java.util.ArrayList removeRedundantVariableAssigments(java.util.ArrayList list)

getMatchingBracketPosition

public int getMatchingBracketPosition(int startposition,
                                      java.lang.String queryString,
                                      java.lang.String openingBracket,
                                      java.lang.String closingBracket)