The top-level components of an AQL annotator are its views
— "logical" statements that define but do not necessarily compute a set
of tuples. The create view
statement in AQL creates a new view
name and defines the tuples inside the view. The statement can take either of
three forms. The first form:
create view <viewname> as <select or extract statement>;
creates a new logical view for the results of a single select
or
extract
statement.
The second form of create view
statement:
create view <viewname> as (<select or extract statement>) union all (<select or extract statement>) ... union all (<select or extract statement>);
defines a view that computes the multiset union of the results of several
select
or extract
statements. Note that all
statements in a given create view
statement must have the same
output schema, including column names.
The third form of create view
statement finds the set
difference between the results of two select
or
extract
statements:
create view <viewname> as (<select or extract statement>) minus (<select or extract statement>);
as with the union all
form, the two select
or
extract
statements must have the same output schema.
View names must be unique within an AQL expression. Note that these names are
case-sensitive; Person
, PERSON
, and
person
are different view names.
A view in AQL can be either an "output" view or a "non-output" view. When an
AQL annotator executes, it computes the result tuples for all output views,
only evaluating non-output views if their outputs are needed to compute an
output view.
By default, views created with the create view
statement are
"non-output" views. The output view
statement converts a
"non-output" view into an "output" view:
output view <viewname>;
This statement must come after the specified view's definition.