10#ifndef LIMA_LINGUISTICPROCESSING_LINGUISTICANALYSISSTRUCTUREANALYSISGRAPH_H
11#define LIMA_LINGUISTICPROCESSING_LINGUISTICANALYSISSTRUCTUREANALYSISGRAPH_H
23namespace AnnotationGraphs
28namespace LinguisticProcessing
36namespace LinguisticProcessing
39namespace LinguisticAnalysisStructure
51 bool deleteTokenWhenDestroyed,
52 bool deleteDataWhenDestroyed);
55 bool deleteTokenWhenDestroyed,
56 bool deleteDataWhenDestroyed,
81 const std::string&
getGraphId(
void)
const {
return m_graphId; }
93 const std::list<LinguisticCode> microFilters,
124 void populateAnnotationGraph(
126 const std::string& src);
128 inline bool ownsTokens()
const {
return m_deleteTokenWhenDestroyed;}
165 bool m_deleteTokenWhenDestroyed;
169 bool m_deleteDataWhenDestroyed;
172 std::string m_graphId;
176template<
class T>
inline
182 boost::tie (outEdge,outEdge_end)=out_edges(v,*(graph.
getGraph()));
183 for (; outEdge!=outEdge_end; outEdge++)
185 output_container.insert(target(*outEdge,*(graph.
getGraph())));
189template<
class T>
inline
194 getFollowingNodes<T>(graph, v, followingNodes);
195 return followingNodes;
203 boost::tie (outEdge,outEdge_end)=out_edges(v,*(graph.
getGraph()));
205 while (outEdge!=outEdge_end)
207 result=target(*outEdge,*(graph.
getGraph()));
209 if (outEdge!=outEdge_end)
211 throw std::logic_error(
"getOneFollowingNode assumes that there is one and only one following node. Multiple nodes detected.");
216 throw std::logic_error(
"getOneFollowingNode assumes that there is one and only one following node. No preceding nodes found.");
219template<
class T>
inline
225 boost::tie (inEdge,inEdge_end)=in_edges(v,*(graph.
getGraph()));
226 for (; inEdge!=inEdge_end; inEdge++)
228 output_container.insert(source(*inEdge,*(graph.
getGraph())));
232template<
class T>
inline
237 getPrecedingNodes<T>(graph, v, precedingNodes);
238 return precedingNodes;
246 boost::tie (inEdge,inEdge_end)=in_edges(v,*(graph.
getGraph()));
248 while (inEdge!=inEdge_end)
250 result=source(*inEdge,*(graph.
getGraph()));
252 if (inEdge!=inEdge_end)
254 throw std::logic_error(
"getOnePrecedingNode assumes that there is one and only one preceding node. Multiple nodes detected.");
259 throw std::logic_error(
"getOnePrecedingNode assumes that there is one and only one preceding node. No preceding nodes found.");
#define LIMA_LINGUISTICANALYSISSTRUCTURE_EXPORT
A graph structure for linguistic analysis.
LinguisticGraph::in_edge_iterator LinguisticGraphInEdgeIt
LinguisticGraph::vertex_descriptor LinguisticGraphVertex
LinguisticGraph::out_edge_iterator LinguisticGraphOutEdgeIt
boost::adjacency_list< boost::vecS, boost::vecS, boost::bidirectionalS, LinguisticVertexProperties > LinguisticGraph
Property to identify the chains in the graph.
just for semantics: base class for analysisData
Holds an annotation graph and gives an API to manipulate it.
Provide function to read write and check a property.
An AnalysisData containing a LinguisticGraph with a language and an id.
const std::string & getGraphId(void) const
LinguisticGraph * getGraph(void)
Returns the underlying graph structure.
const LinguisticGraphVertex & lastVertex(void) const
Returns the last vertex of the graph.
const LinguisticGraph * getGraph(void) const
Returns the underlying graph structure.
bool ownsMorphData() const
const LinguisticGraphVertex & firstVertex(void) const
Returns the first vertex of the graph.
LinguisticGraphVertex getOnePrecedingNode(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex v)
void getPrecedingNodes(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex &v, T &output_container)
void getFollowingNodes(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex v, T &output_container)
LinguisticGraphVertex getOneFollowingNode(const LinguisticAnalysisStructure::AnalysisGraph &graph, const LinguisticGraphVertex v)