Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

AGAPI.h

Go to the documentation of this file.
00001 // AGAPI.h: AG API
00002 // Author: Xiaoyi Ma, Steven Bird
00003 // Copyright (C) 2001 Linguistic Data Consortium, U Penn.
00004 // Web: http://www.ldc.upenn.edu/; Email: ldc@ldc.upenn.edu
00005 // For license information, see the file `LICENSE' included
00006 // with the distribution.
00007 
00008 
00009 #ifndef AGAPI_h
00010 #define AGAPI_h
00011 
00012 #include <string>
00013 #include <list>
00014 #include <set>
00015 #include <map>
00016 #include "AGTypes.h"
00017 
00018 using namespace std;
00019 
00020 //string chomp (string s);
00021 
00022 #ifdef _MSC_VER
00023 #define DllExport __declspec( dllexport )
00024 #else
00025 #define DllExport
00026 #endif
00027 
00029 DllExport AGSetId CreateAGSet(AGSetId id);
00030 DllExport bool ExistsAGSet(AGSetId id);
00031 DllExport void DeleteAGSet(AGSetId id);
00032  
00033 // Id is AGSetId or AGId
00034 DllExport AGId CreateAG(Id id, TimelineId timelineId);
00035 DllExport bool ExistsAG(AGId agId); 
00036 DllExport void DeleteAG(AGId agId);
00037 DllExport AGIds GetAGIds(AGSetId agSetId);
00038  
00039  
00041 // Id may be AGSetId or TimelineId
00042 DllExport TimelineId CreateTimeline(Id id);
00043 DllExport bool ExistsTimeline(TimelineId timelineId);
00044 DllExport void DeleteTimeline(TimelineId timelineId);
00045  
00046 // Id may be TimelineId or SignalId
00047 DllExport SignalId CreateSignal(Id id,URI uri,MimeClass mimeClass,MimeType mimeType,
00048                       Encoding encoding,Unit unit,Track track);
00049 DllExport bool ExistsSignal(SignalId signalId);
00050 DllExport void DeleteSignal(SignalId signalId);
00051 DllExport SignalIds GetSignals(TimelineId timelineId);
00052 
00053 DllExport MimeClass GetSignalMimeClass(SignalId signalId); 
00054 DllExport MimeType GetSignalMimeType(SignalId signalId); 
00055 DllExport Encoding GetSignalEncoding(SignalId signalId); 
00056 DllExport string GetSignalXlinkType(SignalId signalId); 
00057 DllExport string GetSignalXlinkHref(SignalId signalId); 
00058 DllExport string GetSignalUnit(SignalId signalId);
00059 DllExport Track GetSignalTrack(SignalId signalId);
00060 
00062 
00063 // Id may be AGId or AnnotationId
00064 DllExport AnnotationId CreateAnnotation(Id id,AnchorId anchorId1,AnchorId anchorId2,AnnotationType annotationType);
00065 DllExport bool ExistsAnnotation(AnnotationId annotationId);
00066 DllExport void DeleteAnnotation(AnnotationId annotationId);
00067 DllExport AnnotationId CopyAnnotation(AnnotationId annotationId);
00068 DllExport AnnotationIds SplitAnnotation(AnnotationId annotationId);
00069 DllExport AnnotationIds NSplitAnnotation(AnnotationId annotationId,short N);
00070 DllExport AnnotationType GetAnnotationType(AnnotationId annotationId);
00071 DllExport String GetAnnotationInfo(AnnotationId annotationId);
00072 DllExport AnchorId GetStartAnchor(AnnotationId annotationId);
00073 DllExport AnchorId GetEndAnchor(AnnotationId annotationId);
00074 DllExport void SetStartAnchor(AnnotationId annotationId,AnchorId anchorId);
00075 DllExport void SetEndAnchor(AnnotationId annotationId,AnchorId anchorId);
00076 
00077 DllExport Offset GetStartOffset(AnnotationId annotationId);
00078 DllExport Offset GetEndOffset(AnnotationId annotationId);
00079 DllExport void SetStartOffset(AnnotationId annotationId,Offset offset);
00080 DllExport void SetEndOffset(AnnotationId annotationId,Offset offset);
00081 
00082 // Id may be AGSetId, AGId or AnnotationId
00083 DllExport set<AnnotationType> GetAnnotationTypes(Id id);
00084 DllExport set<FeatureName> GetAnnotationFeatureNames(Id id);
00085  
00086 // this might be necessary to package up an id into a durable reference
00087 DllExport AnnotationRef GetRef(Id id);
00088  
00089  
00091  
00092 // this is for both the content of an annotation, and for the metadata
00093 // associated with AGSets, AGs, Timelines and Signals.
00094  
00095 DllExport void SetFeature(Id id,FeatureName featureName,FeatureValue featureValue);
00096 DllExport bool ExistsFeature(Id id, FeatureName featureName);
00097 DllExport void DeleteFeature(Id id, FeatureName featureName);
00098 DllExport string GetFeature(Id id, FeatureName featureName);
00099 DllExport void UnsetFeature(Id id,FeatureName featureName);
00100 DllExport FeatureNames GetFeatureNames(Id id);
00101 DllExport void SetFeatures(Id id,Features features);
00102 DllExport Features GetFeatures(Id id);
00103 DllExport void UnsetFeatures(Id id);
00104  
00105  
00107  
00108 // ?? do we need to permit features to have list values?
00109  
00110  
00112  
00113  // Id may be AGId or AnchorId
00114 DllExport AnchorId CreateAnchor(Id id,Offset offset,Unit unit,SignalIds signalIds);
00115 DllExport AnchorId CreateAnchor(Id id,SignalIds signalIds="");
00116 DllExport bool ExistsAnchor(AnchorId anchorId);
00117 DllExport void DeleteAnchor(AnchorId anchorId);
00118 DllExport void SetAnchorOffset(AnchorId anchorId,Offset offset);
00119 DllExport Offset GetAnchorOffset(AnchorId anchorId);
00120 DllExport void SetOffsetUnit(AnchorId anchorId,Unit unit);
00121 DllExport Unit GetOffsetUnit(AnchorId anchorId);
00122 DllExport void SetAnchorSignalIds(AnchorId anchorId,SignalIds signalIds);
00123 DllExport SignalIds GetAnchorSignalIds(AnchorId anchorId);
00124 DllExport bool GetAnchored(AnchorId anchorId);
00125 DllExport void UnsetAnchorOffset(AnchorId anchorId);
00126 DllExport AnchorId SplitAnchor(AnchorId anchorId);
00127  
00128 DllExport AnnotationIds GetIncomingAnnotationSet(AnchorId anchorId);
00129 DllExport AnnotationIds GetOutgoingAnnotationSet(AnchorId anchorId);
00130 DllExport AnnotationIds GetIncomingAnnotationSetByType(AnchorId anchorId, AnnotationType type);
00131 DllExport AnnotationIds GetOutgoingAnnotationSetByType(AnchorId anchorId, AnnotationType type);
00132 
00134  
00135 DllExport AnchorIds GetAnchorSet(AGId agId);
00136 DllExport AnchorIds GetAnchorSetByOffset(AGId agId,Offset offset, double epsilon=0.0);
00137 DllExport AnchorIds GetAnchorSetNearestOffset(AGId agId,Offset offset);
00138 DllExport AnnotationIds GetAnnotationSetByFeature(AGId agId,FeatureName featureName, FeatureValue featureValue);
00147 DllExport AnnotationIds GetAnnotationSetByOffset(AGId agId,Offset offset);
00148 DllExport AnnotationIds GetAnnotationSetByType(AGId agId,AnnotationType annotationType);
00149 DllExport AnnotationIds GetAnnotationSeqByOffset(AGId agId, Offset begin=0.0, Offset end=0.0);
00150 DllExport AnnotationId GetAnnotationByOffset(AGId agId,Offset offset);
00151  
00153  
00154  // Id may be AGId, AnnotationId, AnchorId
00155 DllExport AGSetId GetAGSetId(Id id="");
00156 
00157 // Id may be AnnotationId or AnchorId
00158 DllExport AGId GetAGId(Id id);
00159 
00160 // Id may be AGId or SignalId
00161 DllExport TimelineId GetTimelineId(Id id);
00162 
00163 // Id maybe AGSetId or AGId
00164 DllExport string toXML(Id id);
00165 
00166 // load an AGSet from db, returns true if succeed, 
00167 // false if it cann't connect to the server
00168 DllExport bool LoadFromDB(string connStr, AGSetId agsetId);
00169 
00170 // Store the AGSet to db, returns true if succeed, 
00171 // false if it cann't connect to the server
00172 DllExport bool StoreToDB(string connStr, AGSetId agSetId);
00173 
00174 // Return SQL queries needed to store the kernel to the database server
00175 DllExport list<string> StoreSQLs(AGSetId agSetId);
00176 
00177 // structural precedes
00178 DllExport bool SPrecedes(const AnnotationId& x, const AnnotationId& y);
00179 
00180 // file io
00181 DllExport AGIds
00182 Load(const string&       format,
00183      const string&       annotationFile,
00184      const string&       id = "",
00185      map<string,string>* signalInfo = NULL,
00186      map<string,string>* options = NULL);
00187 
00188 DllExport void
00189 Store(const string&       format,
00190       const string&       filename,
00191       const string&       agIds = "",
00192       map<string,string>* options = NULL);
00193 
00194 // validation
00195 
00196 DllExport bool
00197 CheckAnchorOffsetTotal(Id agId,
00198                        AnnotationType type);
00199 DllExport bool
00200 CheckAnchorOffsetBounded(Id agId,
00201                        AnnotationType type);
00202 
00203 DllExport bool
00204 CheckFeatureExists(Id agId, AnnotationType type, FeatureName featureName);
00205 
00206 DllExport bool
00207 CheckFeatureIsAnnotationId(Id agId, AnnotationType type, FeatureName featureName);
00208 
00209 DllExport bool
00210 CheckLinear(Id agId, AnnotationType type);
00211 
00212 DllExport bool
00213 CheckConnected(Id agId, AnnotationType type);
00214 
00215 DllExport bool
00216 CheckCoextensive(Id agId, AnnotationType type1, AnnotationType type2);
00217 
00218 DllExport bool
00219 CheckSpan(Id agId, AnnotationType spanType, AnnotationType spannedType);
00220 
00221 #endif

Generated at Wed Jul 3 14:54:01 2002 for Annotation Graph API by doxygen1.2.7 written by Dimitri van Heesch, © 1997-2001