uk.ac.bbk.dcs.automed.qproc
Class ASG

java.lang.Object
  |
  +--uk.ac.bbk.dcs.automed.qproc.ASG

public class ASG
extends java.lang.Object

Every IQL query is internally represented as an Abstract Syntax Graph (ASG).


Constructor Summary
ASG(Cell n)
           
ASG(java.io.File f)
           
ASG(java.lang.String s)
           
 
Method Summary
 ASG copyOfASG()
          Creates and returns an exact copy of the ASG.
static ASG emptyQuery()
          Returns the ASG representation of the empty query.
 java.lang.String formattedString()
          Given that the ASG represents a list the string returned has each element separated by carriage returns for more legible output.
static java.lang.String formattedString(ASG g)
          If g is an ASG list the string returned has each element separated by carriage returns for more legible output.
static java.lang.String formattedString(Cell n)
          If n is the root of an ASG that represents a list, the string returned has each element separated by carriage returns for more legible output.
static java.lang.String fromASG(ASG g)
          Returns the text IQL of g.
static java.lang.String fromASG(Cell n)
          returns the text IQL of the abstract syntax graph of which n is the root.
static java.util.ArrayList fromASGList(ASG g)
          If g represents a list this returns an ArrayList of its Cells.
static java.util.ArrayList fromASGList(Cell n)
          If n is the root of an ASG that represents a list, this returns an ArrayList of its Cells.
static java.util.ArrayList fromASGTuple(ASG g)
          If g represents a tuple this returns an ArrayList of its Cells.
static java.util.ArrayList fromASGTuple(Cell n)
          If n is the root of an ASG that represents a tuple, this returns an ArrayList of its Cells.
 java.util.ArrayList listOfSchemes()
          Returns a list of the schemes used in the ASG as String objects.
static java.util.ArrayList listOfSchemes(ASG g)
          Returns a list of the schemes used in the ASG as String objects.
static void replaceAllSchemaRefs(ASG g, Schema s)
          Replaces all references to Schemas within g by references to s.
static void replaceNullSchemaRefs(ASG g, Schema s)
          Replaces all references to a null Schema object in g with references to s.
 Cell root()
          Returns the root of the ASG
static ASG toASGList(java.util.ArrayList list)
          Generates an ASG list from an ArrayList.
static ASG toASGTuple(java.util.ArrayList list)
          Generates an ASG tuple from an ArrayList.
 java.lang.String toString()
           
static ASG voidQuery()
          Returns the ASG representation of the query Void.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ASG

public ASG(Cell n)
Parameters:
n - the root cell of a graph. This graph will be copied and packaged as an ASG.

ASG

public ASG(java.lang.String s)
    throws java.lang.Exception
Parameters:
s - text IQL query
Throws:
java.lang.Exception

ASG

public ASG(java.io.File f)
    throws java.lang.Exception
Parameters:
f - text file containing the text of an IQL query.
Method Detail

toASGList

public static ASG toASGList(java.util.ArrayList list)
Generates an ASG list from an ArrayList. The ArrayList should be an array of Cells.


toASGTuple

public static ASG toASGTuple(java.util.ArrayList list)
Generates an ASG tuple from an ArrayList. The ArrayList should be an array of Cells.


fromASGList

public static java.util.ArrayList fromASGList(ASG g)
If g represents a list this returns an ArrayList of its Cells.


fromASGList

public static java.util.ArrayList fromASGList(Cell n)
If n is the root of an ASG that represents a list, this returns an ArrayList of its Cells.


fromASGTuple

public static java.util.ArrayList fromASGTuple(ASG g)
If g represents a tuple this returns an ArrayList of its Cells.


fromASGTuple

public static java.util.ArrayList fromASGTuple(Cell n)
If n is the root of an ASG that represents a tuple, this returns an ArrayList of its Cells.


fromASG

public static java.lang.String fromASG(ASG g)
Returns the text IQL of g.


fromASG

public static java.lang.String fromASG(Cell n)
returns the text IQL of the abstract syntax graph of which n is the root.


formattedString

public static java.lang.String formattedString(ASG g)
If g is an ASG list the string returned has each element separated by carriage returns for more legible output.


formattedString

public static java.lang.String formattedString(Cell n)
If n is the root of an ASG that represents a list, the string returned has each element separated by carriage returns for more legible output.


listOfSchemes

public static java.util.ArrayList listOfSchemes(ASG g)
Returns a list of the schemes used in the ASG as String objects.


root

public Cell root()
Returns the root of the ASG


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

formattedString

public java.lang.String formattedString()
Given that the ASG represents a list the string returned has each element separated by carriage returns for more legible output.


listOfSchemes

public java.util.ArrayList listOfSchemes()
Returns a list of the schemes used in the ASG as String objects.


emptyQuery

public static ASG emptyQuery()
Returns the ASG representation of the empty query.


voidQuery

public static ASG voidQuery()
Returns the ASG representation of the query Void.


replaceAllSchemaRefs

public static void replaceAllSchemaRefs(ASG g,
                                        Schema s)
Replaces all references to Schemas within g by references to s.


replaceNullSchemaRefs

public static void replaceNullSchemaRefs(ASG g,
                                         Schema s)
Replaces all references to a null Schema object in g with references to s.


copyOfASG

public ASG copyOfASG()
Creates and returns an exact copy of the ASG.