Package gavo :: Package adql :: Module nodes
[frames] | no frames]

Module nodes

source code

Node classes and factories used in ADQL tree processing.

Classes
  ReplaceNode
can be raised by code in the constructor of and ADQLNode to replace itself.
  BOMB_OUT
  ADQLNode
A node within an ADQL parse tree.
  TransparentMixin
a mixin just pulling through the children and serializing them.
  FieldInfoedNode
An ADQL node that carries a FieldInfo.
  FunctionNode
An ADQLNodes having a function name and arguments.
  ColumnBearingNode
A Node types defining selectable columns.
  TableName
  PlainTableRef
A reference to a simple table.
  DerivedTable
  JoinSpecification
A join specification ("ON" or "USING").
  JoinOperator
the complete join operator (including all LEFT, RIGHT, ",", and whatever).
  JoinedTable
A joined table.
  SubJoin
A sub join (JoinedTable surrounded by parens).
  TransparentNode
An abstract base for Nodes that don't parse out anything.
  WhereClause
  Grouping
  Having
  OrderBy
  OffsetSpec
  SelectNoParens
  SetOperationNode
A node containing a set expression.
  SetTerm
  WithQuery
A query from a with clause.
  SelectQuery
A complete query excluding CTEs.
  QuerySpecification
The toplevel query objects including CTEs.
  ColumnReference
  ColumnReferenceByUCD
  FromClause
  DerivedColumn
A column within a select list.
  QualifiedStar
  SelectList
  Comparison
is required when we want to morph the braindead contains(...)=1 into a true boolean function call.
  Factor
is a factor within an SQL expression.
  ArrayReference
  CombiningFINode
  Term
  NumericValueExpression
  StringValueExpression
  GenericValueExpression
A container for value expressions that we don't want to look at closer.
  SetFunction
An aggregate function.
  NumericValueFunction
A numeric function.
  StringValueFunction
  TimestampFunction
  InUnitFunction
  CharacterStringLiteral
according to the current grammar, these are always sequences of quoted strings.
  CastSpecification
  CoosysMixin
is a mixin that works cooSys into FieldInfos for ADQL geometries.
  GeometryNode
Nodes for geometry constructors.
  Point
  Circle
A circle parsed from ADQL.
  Box
  PolygonCoos
a base class for the various argument forms of polygons.
  PolygonSplitCooArgs
  PolygonPointCooArgs
  Polygon
  STCSRegion
  Centroid
  Distance
  PredicateGeometryFunction
  PointFunction
  Area
Functions
 
symbolAction(*symbols)
is a decorator to mark functions as being a parseAction for symbol.
source code
 
getType(arg)
returns the type of an ADQL node or the value of str if arg is a string.
source code
 
flatten(arg)
returns the SQL serialized representation of arg.
source code
 
autocollapse(nodeBuilder, children)
inhibts the construction via nodeBuilder if children consists of a single ADQLNode.
source code
 
collectUserData(infoChildren) source code
 
flattenKWs(obj, *fmtTuples)
returns a string built from the obj according to format tuples.
source code
 
cleanNamespace(ns)
removes all names starting with an underscore from the dict ns.
source code
 
getChildrenOfType(nodeSeq, type)
returns a list of children of type typ in the sequence nodeSeq.
source code
 
getChildrenOfClass(nodeSeq, cls) source code
 
getChildOfType(nodeSeq, type, default=<class 'gavo.adql.nodes.BOMB_OUT'>)
returns the unique node of type in nodeSeq.
source code
 
getChildOfClass(nodeSeq, cls, default=<class 'gavo.adql.nodes.BOMB_OUT'>)
returns the unique node of class in nodeSeq.
source code
 
parseArgs(parseResult)
returns a sequence of ADQL nodes suitable as function arguments from parseResult.
source code
 
makeBinaryJoinTree(children)
takes the parse result for a join and generates a binary tree of JoinedTable nodes from it.
source code
 
dispatchColumnReference(parseResult) source code
 
makeValueExpression(children) source code
 
registerRegionMaker(fun)
adds a region maker to the region resolution chain.
source code
 
makeRegion(children) source code
 
makeSTCSRegion(spec) source code
Variables
  __package__ = 'gavo.adql'
Function Details

symbolAction(*symbols)

source code 

is a decorator to mark functions as being a parseAction for symbol.

This is evaluated by getADQLGrammar below. Be careful not to alter global state in such a handler.

autocollapse(nodeBuilder, children)

source code 

inhibts the construction via nodeBuilder if children consists of a single ADQLNode.

This function will automatically be inserted into the the constructor chain if the node defines an attribute collapsible=True.

flattenKWs(obj, *fmtTuples)

source code 

returns a string built from the obj according to format tuples.

A format tuple is consists of a literal string, and an attribute name. If the corresponding attribute is non-None, the plain string and the flattened attribute value are inserted into the result string, otherwise both are ignored.

Nonexisting attributes are taken to have None values.

To allow unconditional literals, the attribute name can be None. The corresponding literal is always inserted.

All contributions are separated by single blanks.

This is a helper method for flatten methods of parsed-out elements.

cleanNamespace(ns)

source code 

removes all names starting with an underscore from the dict ns.

This is intended for _getInitKWs methods. ns is changed in place *and* returned for convenience

getChildOfType(nodeSeq, type, default=<class 'gavo.adql.nodes.BOMB_OUT'>)

source code 

returns the unique node of type in nodeSeq.

If there is no such node in nodeSeq or more than one, a NoChild or MoreThanOneChild exception is raised, Instead of raising NoChild, default is returned if given.

getChildOfClass(nodeSeq, cls, default=<class 'gavo.adql.nodes.BOMB_OUT'>)

source code 

returns the unique node of class in nodeSeq.

See getChildOfType.

parseArgs(parseResult)

source code 

returns a sequence of ADQL nodes suitable as function arguments from parseResult.

This is for cleaning up _parseResults["args"], i.e. stuff from the Args symbol decorator in grammar.

makeBinaryJoinTree(children)

source code 

takes the parse result for a join and generates a binary tree of JoinedTable nodes from it.

It's much easier to do this in a separate step than to force a non-left-recursive grammar to spit out the right parse tree in the first place.

Decorators:
  • @symbolAction("joinedTable")

dispatchColumnReference(parseResult)

source code 
Decorators:
  • @symbolAction("columnReference")

makeValueExpression(children)

source code 
Decorators:
  • @symbolAction("valueExpression")

registerRegionMaker(fun)

source code 

adds a region maker to the region resolution chain.

region makers are functions taking the argument to REGION and trying to do something with it. They should return either some kind of FieldInfoedNode that will then replace the REGION or None, in which case the next function will be tried.

As a convention, region specifiers here should always start with an identifier (like simbad, siapBbox, etc, basically [A-Za-z]+). The rest is up to the region maker, but whitespace should separate this rest from the identifier.

The entire region functionality will probably disappear with TAP 1.1. Don't do anything with it any more. Use ufuncs instead.

makeRegion(children)

source code 
Decorators:
  • @symbolAction("region")