Main Page   Class Hierarchy   Compound List   Compound Members  

AG Class Reference

List of all members.

Public Methods

 AG (Id id, Timeline *timeline=NULL, string type="")
 A constructor.

 ~AG ()
 A destructor.

Id getId () const
 Get the id of the AG.

void setType (string type)
 Set Type.

string getType () const
 Get Type.

TimelinegetTimeline () const
 Get Timeline.

void addAnchor (Anchor *a)
 Add an anchor.

void deleteAnchor (Anchor *a) throw (AGException)
 Delete an anchor.

void setAnchorOffset (Anchor *, Offset)
 Set an anchor's offset to the specified value.

AnchorsplitAnchor (Anchor *original)
void add (Annotation *anchor)
 Add a new annotation to the AG.

Id createAnnotation (Id id, Anchor *anchor1, Anchor *anchor2, AnnotationType annotationType) throw (AGException)
void setFeature (Id id, FeatureName featureName, FeatureValue featureValue)
bool existsFeature (Id id, FeatureName featureName)
void deleteFeature (Id id, FeatureName featureName)
string getFeature (Id id, FeatureName featureName)
set< string > getFeatureNames (Id id)
void getAnnotationFeatureNames (set< string > &S, const AnnotationType &type="")
void getAnnotationTypes (set< string > &S)
void setFeatures (Id id, map< string, string > &features)
map< string, string > getFeatures (Id id)
void unsetFeatures (Id id)
AnchorId createAnchor (Id id, Offset offset, Unit unit, set< string > const &ignals)
AnchorId createAnchor (Id id, Unit unit, set< string > const &signals)
Offset getAnchorOffset (Anchor *anchor)
 Get the offset of the specified anchor.

AnnotationcopyAnnotation (const Annotation *annotation)
AnnotationsplitAnnotation (Annotation *original)
AnnotationSet nSplitAnnotation (Annotation *original, int n)
void deleteAnnotation (Annotation *annotation)
 Delete the annotation from the AG.

void setStartAnchor (Annotation *annotation, Anchor *anchor)
 Set the start anchor of an annotation to the specified anchor.

void setEndAnchor (Annotation *annotation, Anchor *anchor)
 Set the end anchor of an annotation to the specified anchor.

void unsetAnchorOffset (Anchor *a)
 Unset the offset of the specified anchor.

void setFeature (Annotation *, const String &, const String &)
 Set the specified feature of the annotation to this value.

AnchorSeq * getAnchorSet ()
 Get the set of anchors, sorted by offsets.

IdSet & getAnnotationSet ()
 Get the set of annotations.

AnnotationgetById (const Id &id) throw (AGException)
 Get the annotation reference by its id.

AnchorgetAnchorById (const Id &id) throw (AGException)
 Get the anchor reference by its id.

AnchorSet getAnchorSetByOffset (Offset offset, double epsilon=0.0)
 Get anchors with the specified offset.

AnnotationSet getAnnotationSetByType (const String &t)
 Get the annotations of type t.

AnnotationSet getAnnotationSetByOffset (Offset o)
AnnotationSet getAnnotationSetByFeature (const String &f, const String &v)
 Get the annotations with value of feature f equals to v.

AnnotationSet getIncomingAnnotationSet (Anchor *a)
 Get the incoming annotations to the specified node.

AnnotationSet getIncomingAnnotationSetByType (Anchor *a, AnnotationType t)
 Get the incoming annotations of this type to the specified node.

AnnotationSet getOutgoingAnnotationSet (Anchor *a)
 Get the outgoing annotations from the specified node.

AnnotationSet getOutgoingAnnotationSetByType (Anchor *a, AnnotationType t)
 Get the outgoing annotations of this type from the specified node.

Offset getNearestOffset (Offset o)
 Get the nearest used offset to the specified offset.

AnnotationSeq getAnnotationSeqByOffset (Offset begin=0.0, Offset end=0.0)
AnnotationgetAnnotationByOffset (Offset offset, const AnnotationType &type="")
AnchorSet getAnchorSetNearestOffset (Offset offset)
 Get all anchors whose offset is the nearest to the specified offset.

list< string > storeSQLs (AGSetId agSetId, FeatureNameSet features)
 Create list of SQLs used to save the metadata to the DB server.

string toString ()
 Dump the AG in AIF format.


Detailed Description

An AG (Annotation Graph) is a set of annotations along with the index structure.
Author:
Xiaoyi Ma
Note:
that operations on anchors are private - these are used only by the class itself when building an annotation


Member Function Documentation

Annotation* AG::copyAnnotation const Annotation   annotation
 

Clone an annotation. Make a copy of the specified annotation, assign the new annotation a new AnnotationId.

Parameters:
annotation  the original annotation
Returns:
the pointer to the clone

AnchorId AG::createAnchor Id    id,
Unit    unit,
set< string > const &    signals
 

Create an anchor with specified unit and signals.

Parameters:
id  might be AGId or AnchorId. If id is a AGId, an AnchorId will be assigned the new anchor. If id is a AnchorId, it will try the given id first, if it's taken, assign a new AnchorId.
Returns:
AnchorId of the new anchor.
Exceptions:
AGException  IF (the id given is invalid)

AnchorId AG::createAnchor Id    id,
Offset    offset,
Unit    unit,
set< string > const &    ignals
 

Create an anchor with specified offset, unit and signals.

Parameters:
id  might be AGId or AnchorId. If id is a AGId, an AnchorId will be assigned the new anchor. If id is a AnchorId, it will try the given id first, if it's taken, assign a new AnchorId.
Returns:
AnchorId of the new anchor.
Exceptions:
AGException  IF (the id given is invalid)

Id AG::createAnnotation Id    id,
Anchor   anchor1,
Anchor   anchor2,
AnnotationType    annotationType
throw (AGException)
 

Create a new annotation.

Parameters:
id  might be AGId or AnnotationId. If id is an AGId, an AnnotationId will be assigned to the new annotation. If id is an AnnotationId, it will try the given id first, if it's taken, assign a new AnnotationId.
Returns:
the AnnotationId of the new annotation.
Exceptions:
AGException  IF (the id given is invalid)

void AG::deleteFeature Id    id,
FeatureName    featureName
 

Delete the specified feature from the metadata or annotation.

Parameters:
id  could be AGId or AnnotationId. If it is AGId, then delete the feature from the metadata of the AG. Or, if it is AnnotationId, delete the feature from the annotation.

bool AG::existsFeature Id    id,
FeatureName    featureName
 

Test if a feature exists in the metadata or annotation.

Parameters:
id  could be AGId or AnnotationId. If it is AGId, then test the existence of the feature of the metadata of the AG. Or, if it is AnnotationId, test the existence of the feature of the annotation.

Annotation* AG::getAnnotationByOffset Offset    offset,
const AnnotationType &    type = ""
[inline]
 

Get one of the annotations which overlap a particular time offset. Same as getByOffset except that getAnnotationByOffset returns only one qualified annotation while getByOffset returns all of them. getAnnotationByOffset is signaficantly faster than getByOffset. Should be favored over getAnnotationSetByOffset whenever possible.

See also:
getAnnotationSetByOffset

void AG::getAnnotationFeatureNames set< string > &    S,
const AnnotationType &    type = ""
 

Get all feature names of all annotations in this AG.

Parameters:
S  The container for this method to put the results. Note that this method doesn't clean S before it puts the results.
type  If given, only the annotations of the given type is considered in the computation -- things will get slow.

AnnotationSeq AG::getAnnotationSeqByOffset Offset    begin = 0.0,
Offset    end = 0.0
 

Get all annotations with its start anchor offset in between the specified values. Get all annotations with its start anchor offset in between the specified values. If both values are 0, return all annotations in the AG.

Parameters:
begin, the  lower bound, default is 0.0.
end, the  upper bound, default is 0.0.
Returns:
all qualified annotations, sorted by start anchor offset.

AnnotationSet AG::getAnnotationSetByOffset Offset    o [inline]
 

Get the annotations that overlap a particular time offset. Get all annotations whose start anchor offset is smaller than or equal to the given offset AND end anchor offset is greater than or equal to the given offet.

void AG::getAnnotationTypes set< string > &    S
 

Get types of all annotations in this AG.

Parameters:
S  The container for this method to put the results. Note that this method doesn't clean S before it puts the results.

string AG::getFeature Id    id,
FeatureName    featureName
 

Get the value of specified feature in the metadata or annotation.

Parameters:
id  could be AGId or AnnotationId. If it is AGId, then get the value of specified feature from the metadata of the AG. Or, if it is AnnotationId, get the value of specified feature from the annotation.

set<string> AG::getFeatureNames Id    id
 

Get all feature names from the metadata or annotation.

Parameters:
id  could be AGId or AnnotationId. If it is AGId, then get all feature names from the metadata of the AG. Or, if it is AnnotationId, get all feature names from the annotation.
Returns:
string set which contains all the feature names

map<string,string> AG::getFeatures Id    id
 

Get all the features. Returns all features in a hash table of feature-value pairs.

AnnotationSet AG::nSplitAnnotation Annotation   original,
int    n
 

Split an annotation to n annotations. A version of split which does the split operation n-1 times, i.e. split the original annotation into n annotations.

Parameters:
original, the  annotation to be split.
n  an integer specifying the number of annotations to split into.
Returns:
the set of new annotations, including the original one.
See also:
splitAnnotation

void AG::setFeature Id    id,
FeatureName    featureName,
FeatureValue    featureValue
 

Set feature value of the metadata or annotation.

Parameters:
id  could be AGId or AnnotationId. If it is AGId, then set the feature value of the metadata of the AG. Or, if it is AnnotationId, set the feature value of the annotation.

void AG::setFeatures Id    id,
map< string, string > &    features
 

Set multiple features in a hash table of feature-value pairs.

Note:
id could be AGId or AnnotationId. If it is AGId, then set features of the metadata of the AG. Or, if it is AnnotationId, set features of the annotation.

Anchor* AG::splitAnchor Anchor   original
 

Split an anchor in two. Split an anchor a in two, creating a new anchor a' having the same offset as the original one. Anchor a has all the incoming annotations, while anchor a' has all the outgoing annotations. The new anchor a' is returned.

Annotation* AG::splitAnnotation Annotation   original
 

Split an annotation a in two. Split an annotation a in two, creating a new annotation a' having the same label data as the original one. The two annotations a, a' connect head-to-tail at a new anchor. The new annotation and anchor have identifiers taken from the specified identifier spaces. The new anchor is unanchored, i.e. has no offset.

Parameters:
original, the  annotation to be split.
Returns:
a pointer to the new annotation a'.

void AG::unsetFeatures Id    id
 

Unset all features in the metadata or annotation. Set all the features to empty string.

Parameters:
id  could be AGId or AnnotationId. If it is AGId, then unset features of the metadata of the AG. Or, if it is AnnotationId, unset features of the annotation.