Public Types | |
typedef string | Id |
Generic identifier (can be from any of AGSetId, AGId, AnnotationId, TimelineId, SignalId). | |
typedef string | AGSetId |
AGSet identifier. | |
typedef string | AGId |
AG identifier. | |
typedef string | AnnotationId |
Annotation identifier. | |
typedef string | AnnotationType |
Annotation type. | |
typedef string | AnchorId |
Anchor identifier. | |
typedef string | TimelineId |
Timeline identifier. | |
typedef string | SignalId |
Signal identifier. | |
typedef string | FeatureName |
feature name | |
typedef string | FeatureValue |
feature value | |
typedef string | URI |
a uniform resource identifier | |
typedef string | MimeClass |
the MIME class | |
typedef string | MimeType |
the MIME type | |
typedef string | Encoding |
the signal encoding | |
typedef string | Unit |
the unit for offsets | |
typedef double | Offset |
the offset into a signal | |
typedef string | Track |
the track of a signal | |
Public Methods | |
AnnotationId | tree_init_tree (AnnotationType type, Id id="AGTree") |
Create an empty tree, a tree with only one node. | |
bool | tree_move_down (AnnotationId anno, AnnotationType type="syn", AnnotationId new_anno="") |
Move the given node down, creating a new node above it. | |
bool | tree_move_up (AnnotationId anno) |
Move the given node up, deleting the parent node. | |
bool | tree_promote_right (AnnotationId anno) |
Make the given node a right sibling of parent node. | |
bool | tree_promote_left (AnnotationId anno) |
Make the given node a left sibling of parent node. | |
bool | tree_demote_right (AnnotationId anno) |
Make the given node a rightmost child of the left sibling. | |
bool | tree_demote_left (AnnotationId anno) |
Make the given node a leftmost child of the right sibling. | |
AnnotationId | tree_first_tree (AGId agId) |
Find the first tree (root) in a given annotation graph. | |
AnnotationId | tree_last_tree (AGId agId) |
Find the last tree (root) in a given annotation graph. | |
bool | tree_move (AnnotationId x, AnnotationId y) |
Move a subtree under a certain node. | |
AnnotationId | tree_insert_node_left (AnnotationId x, AnnotationType type="wrd", AnnotationId annoId="") |
Insert a new terminal node on the left. | |
AnnotationId | tree_insert_node_right (AnnotationId x, AnnotationType type="wrd", AnnotationId annoId="") |
Insert a new terminal node on the right. | |
bool | tree_delete_node_left (AnnotationId x) |
Delete a node on the left. | |
bool | tree_delete_node_right (AnnotationId x) |
Delete a node on the left. | |
AnnotationId | tree_root (AnnotationId x, int depth=1) |
Find the root node. | |
AnnotationId | tree_parent (AnnotationId x) |
Find the parent node. | |
sequence< AnnotationId > | tree_children (AnnotationId x) |
Find children. | |
AnnotationId | tree_left (AnnotationId x) |
Find a left sibling. | |
AnnotationId | tree_right (AnnotationId x) |
Find a right sibling. | |
sequence< AnnotationId > | tree_path (AnnotationId x) |
Find a path from the root to the given node. | |
AnnotationId | tree_common_ancestor (AnnotationId x, AnnotationId y) |
Find the nearest common ancestor of the two nodes. | |
AnnotationId | tree_insert_node (AnnotationId x, AnnotationId y, AnnotationType type="syn", AnnotationId annoId="") |
Insert a non-terminal node. | |
bool | tree_delete_node (AnnotationId x) |
Delete a non-terminal node. |
This is a description of Tree API. In this description, although function signatures are represented in C++ style, it's straightforward to translate them to other languages. C++ programmers should check the exact argument types and return types in agtree.h for some functions return or accept pointer types, and set and list should be distinguished. Java programmers also should check the exact types to use in jag.java for the similar reasons.
Here is how functions are represented in this desctiption:
<return type> TreeAPI::<function name> ( <arg list> ) <arg list> := _empty_string_ | <arg type> <arg name> | <arg type> <arg name> = <default value> | <arg type> <arg name> , <arg list> | <arg list> , <arg type> <arg name> = <default value> <arg type> := <base type> | <compound type> <return type> := <base type> | <compound type> <compound type> := sequence< <base type> > | hash< <base type> , <base type> > <base type> := (one of the types listed in typedef statements above) | bool | int | float | double | string |
<default value>
is the value assigned to the argument when the argument is not present in the function call. sequence<t1>
is a list type, in which elements are of t1 type. hash<t1,t2>
is a hash table type, in which keys are of t1 type and values are t2 type.
Here is an example:
AnnotationId TreeAPI::tree_insert_node( AnnotationId x, AnnotationId y, AnnotationType type="syn", AnnotationId annoId="" ) |
Function tree_insert_node returns an AnnotationId. It takes two AnnotationIds as arguments. AnnotationType can be given optionally. If it is not given, default value for type is `syn'. annoId is also an optional argument. If it is not present, an empty string will be assumed for the value.
|
Find children.
|
|
Find the nearest common ancestor of the two nodes.
|
|
Delete a non-terminal node.
|
|
Delete a node on the left.
|
|
Delete a node on the left.
|
|
Make the given node a leftmost child of the right sibling.
|
|
Make the given node a rightmost child of the left sibling.
|
|
Find the first tree (root) in a given annotation graph.
|
|
Create an empty tree, a tree with only one node.
|
|
Insert a non-terminal node.
|
|
Insert a new terminal node on the left.
|
|
Insert a new terminal node on the right.
|
|
Find the last tree (root) in a given annotation graph.
|
|
Find a left sibling.
|
|
Move a subtree under a certain node.
|
|
Move the given node down, creating a new node above it.
|
|
Move the given node up, deleting the parent node.
|
|
Find the parent node.
|
|
Find a path from the root to the given node.
|
|
Make the given node a left sibling of parent node.
|
|
Make the given node a right sibling of parent node.
|
|
Find a right sibling.
|
|
Find the root node.
|
![]() |