27 #include "../../common/Translator.h"
28 #include "../../common/StringUtils.h"
29 #include "../../dataaccess/dataset/DataSet.h"
30 #include "../../dataaccess/datasource/DataSource.h"
31 #include "../../dataaccess/query_h.h"
32 #include "../core/GraphMetadata.h"
33 #include "../Config.h"
34 #include "../Exception.h"
35 #include "../Globals.h"
56 if(m_graph == 0 || m_graph->getMetadata() == 0)
58 throw Exception(
TR_GRAPH(
"Invalid graph pointer."));
63 throw Exception(
TR_GRAPH(
"Expression not defined."));
66 if(m_vertexQuery.get())
68 if(m_vertexQuery->moveFirst())
72 return m_graph->getVertex(
id);
77 std::string tableName = m_graph->getMetadata()->getVertexTableName();
91 ob->push_back(obItem);
95 m_vertexQuery.reset(0);
96 m_vertexQuery = m_graph->getMetadata()->getDataSource()->query(select);
98 if(m_vertexQuery.get() == 0)
100 throw Exception(
TR_GRAPH(
"Iterator not initialized."));
105 if(m_vertexQuery->moveNext())
114 return m_graph->getVertex(
id);
119 if(m_graph == 0 || m_graph->getMetadata() == 0)
121 throw Exception(
TR_GRAPH(
"Invalid graph pointer."));
124 if(m_edgeQuery.get())
126 if(m_edgeQuery->moveFirst())
130 return m_graph->getEdge(
id);
135 std::string edgeTable = m_graph->getMetadata()->getEdgeTableName();
136 std::string vertexAttrTalbe = m_graph->getMetadata()->getVertexTableName();
140 fields->push_back(f);
146 from->push_back(fi1);
148 from->push_back(fi2);
150 from->push_back(fi3);
152 std::string edgeIdStr =
"edges.";
155 std::string vertexFrom =
"edges.";
158 std::string vertexTo =
"edges.";
161 std::string v1Id =
"v1.";
164 std::string v2Id =
"v2.";
184 ob->push_back(obItem);
188 m_edgeQuery.reset(0);
189 m_edgeQuery = m_graph->getMetadata()->getDataSource()->query(select);
191 if(m_edgeQuery.get() == 0)
193 throw Exception(
TR_GRAPH(
"Iterator not initialized."));
198 if(m_edgeQuery->moveNext())
207 return m_graph->getEdge(
id);
Abstract class used to define the main functions of graph struct. All graph implementations must used...
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
A class that models the name of a dataset used in a From clause.
Expression * getExpression() const
It returns the expression set for an output select query.
A Select models a query to be used when retrieving data from a DataSource.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
The Field class can be used to model an expression that takes part of the output items of a SELECT...
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
virtual ~QueryIterator()
Virtual destructor.
A class that models the name of any property of an object.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
#define TR_GRAPH(message)
It marks a string in order to get translated. This is a special mark used in the Graph module of Terr...
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
Boolean logic operator: AND.
An abstract class that models a source of data in a query.
static const std::string sm_tableEdgeModelAttrVFrom
Attribute Vertex From.
static const std::string sm_tableVertexModelAttrId
Attribute id.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
static const std::string sm_tableEdgeModelAttrId
Attribute Id.
This is an abstract class that models a query expression.
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.
It models the comparison operator.
QueryIterator(te::graph::AbstractGraph *g)
Default constructor.
A class that can be used to model a filter expression that can be applied to a query.
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...