ASG
Keywords: uk.ac.bbk.dcs.automed.qproc.iql.ASG 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.bbk.dcs.automed.qproc.iql
Class ASG

    java.lang.Object
      uk.ac.bbk.dcs.automed.qproc.iql.ASG

All Implemented Interfaces:
  java.io.Serializable, PersistentObject

Direct Known Subclasses:
  ASGCollection, ASGComprehension, ASGQuery, ASGTuple

    public class ASG

extends java.lang.Object
implements PersistentObject, java.io.Serializable

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

See Also:
  Serialized Form

Field Summary
`protected static java.util.logging.Logger` | `logger`
`protected Cell` | `root`

Constructor Summary
`protected` | `ASG()`
`` | `ASG(Cell n)`
`` | `ASG(java.io.File f)`
`` | `ASG(java.lang.String s)`

Method Summary
`void` | `annotate()`
`ASG` | `copyOfASG()` Creates and returns an exact copy of the ASG.
`static ASG` | `emptyBag()` Returns the ASG representation of the empty Bag - a BNil constructor.
`static ASG` | `emptyCollection(java.lang.String colType)`
`static ASG` | `emptyList()` Returns the ASG representation of the empty List - a Nil constructor.
`static ASG` | `emptySet()` Returns the ASG representation of the empty Set - an SNil constructor.
`boolean` | `equals(java.lang.Object o)`
`void` | `explore()`
`void` | `explore(java.io.PrintStream ps)`
`void` | `finalize()`
`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)` Deprecated. Functionality same as toString().
`static java.lang.String` | `formattedString(Cell n)` Deprecated. Functionality same as toString().
`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` | `fromASGCollection(ASG g)` If g represents a list/set/bag this returns an ArrayList of its Cells.
`static java.util.ArrayList` | `fromASGCollection(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` | `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.
`long` | `getCollectionSize()` Usage intended only for CallToWrapper cache, to help decide between in-memory and on-disk caching
`static java.lang.String` | `getColType(Cell c)`
`static long` | `getCreated()`
`static long` | `getDestroyed()`
`PersistentKey` | `getKey()`
`java.util.Map` | `getPersistentAttributes()`
`static boolean` | `isDAG(ASG g)`
`static boolean` | `isDAG(Cell c)`
`static java.util.ArrayList` | `listOfSchemes(ASG g, boolean full)` Returns a list of the schemes used in the ASG as String objects.
`java.util.ArrayList` | `listOfSchemes(boolean full)` Returns a list of the schemes used in the ASG as String objects.
`void` | `print()` Prints g in System.out
`void` | `print(java.io.File f)` Prints g in file f - if f already exists, it is overwritten.
`void` | `print(java.io.File f, boolean append)` Prints g in file f - if append is set to true, then printing occurs at the end of the file, otherwise file is overwritten.
`void` | `print(java.io.PrintStream ps)`
`void` | `println()`
`void` | `println(java.lang.String s)`
`Cell` | `root()` Returns the root of the ASG
`static ASG` | `toASGCollection(java.util.ArrayList collection, java.lang.String type)` Generates an ASG list from an ArrayList.
`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()`
`java.lang.String` | `toStringOBID()` Use only for printing purposes in debug settings: works just like `toString()`, but schemes has an OBID suffix.
`void` | `unify()`

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

Field Detail

### logger

    protected static java.util.logging.Logger logger

### root

    protected Cell root

Constructor Detail

### ASG

    protected ASG()

### 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 ParseException

Parameters:
  `s` - text IQL query
Throws:
  `java.lang.Exception`
  `ParseException`

### ASG

    public ASG(java.io.File f)
        throws java.io.FileNotFoundException

Parameters:
  `f` - text file containing the text of an IQL query.
Throws:
  `java.io.FileNotFoundException`

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.

### toASGCollection

    public static ASG toASGCollection(java.util.ArrayList collection,
                                      java.lang.String type)

  Generates an ASG list from an ArrayList. The ArrayList should be an array of Cells. Type is one of "List", "Set" or "Bag" WARNING: Does not transform from one collection type to another, i.e. if collection contains duplicates and type is "Set", then no error is thrown, or conversion is made.

### toASGTuple

    public static ASG toASGTuple(java.util.ArrayList list)

  Generates an ASG tuple from an ArrayList. The ArrayList should be an array of Cells.

### fromASGCollection

    public static java.util.ArrayList fromASGCollection(ASG g)
                                                 throws QProcException

  If g represents a list/set/bag this returns an ArrayList of its Cells.

  Throws:
    `QProcException`

### fromASGCollection

    public static java.util.ArrayList fromASGCollection(Cell n)

  If n is the root of an ASG that represents a list, this returns an ArrayList of its 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)
                                            throws QProcException

  If g represents a tuple this returns an ArrayList of its Cells.

  Throws:
    `QProcException`

### 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.

  Throws:
    `QProcException`

### listOfSchemes

    public java.util.ArrayList listOfSchemes(boolean full)

  Returns a list of the schemes used in the ASG as String objects.

  Parameters:
    `full` - true if the format :P:S:M:C:<<...>>:T is needed, false if the simple <<...>> format is needed

### listOfSchemes

    public static java.util.ArrayList listOfSchemes(ASG g,
                                                    boolean full)

  Returns a list of the schemes used in the ASG as String objects.

### root

    public Cell root()

  Returns the root of the ASG

### emptyList

    public static ASG emptyList()

  Returns the ASG representation of the empty List - a Nil constructor.

### emptySet

    public static ASG emptySet()

  Returns the ASG representation of the empty Set - an SNil constructor.

### emptyBag

    public static ASG emptyBag()

  Returns the ASG representation of the empty Bag - a BNil constructor.

### emptyCollection

    public static ASG emptyCollection(java.lang.String colType)
                               throws QProcException

  Throws:
    `QProcException`

### getColType

    public static java.lang.String getColType(Cell c)
                                       throws QProcException

  Throws:
    `QProcException`

### copyOfASG

    public ASG copyOfASG()

  Creates and returns an exact copy of the ASG.

### println

    public void println()

### println

    public void println(java.lang.String s)

### print

    public void print()

  Prints g in System.out

### print

    public void print(java.io.PrintStream ps)

### toStringOBID

    public java.lang.String toStringOBID()

  Use only for printing purposes in debug settings: works just like `toString()`, but schemes has an OBID suffix.

### print

    public void print(java.io.File f)
               throws java.io.IOException

  Prints g in file f - if f already exists, it is overwritten.

  Throws:
    `QProcException`
    `java.io.IOException`

### print

    public void print(java.io.File f,
                      boolean append)
               throws java.io.IOException

  Prints g in file f - if append is set to true, then printing occurs at the end of the file, otherwise file is overwritten.

  Throws:
    `QProcException`
    `java.io.IOException`

### 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)

  Deprecated. Functionality same as toString().

  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)

  Deprecated. Functionality same as toString().

  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.

### 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.

### equals

    public boolean equals(java.lang.Object o)

  Overrides:
    `equals` in class `java.lang.Object`

### getCollectionSize

    public long getCollectionSize()

  Usage intended only for CallToWrapper cache, to help decide between in-memory and on-disk caching

  Returns:
    the number of cells in the ASG; works only for ASGs created using ASG.toASG(ArrayList list)

### annotate

    public void annotate()

### unify

    public void unify()
               throws QProcException

  Throws:
    `QProcException`

### isDAG

    public static boolean isDAG(ASG g)

### isDAG

    public static boolean isDAG(Cell c)

### explore

    public void explore()

### explore

    public void explore(java.io.PrintStream ps)

### finalize

    public void finalize()

  Overrides:
    `finalize` in class `java.lang.Object`

### getKey

    public PersistentKey getKey()

  Specified by:
    `getKey` in interface `PersistentObject`

### getPersistentAttributes

    public java.util.Map getPersistentAttributes()

  Specified by:
    `getPersistentAttributes` in interface `PersistentObject`

### getCreated

    public static long getCreated()

### getDestroyed

    public static long getDestroyed()

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