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(
TE_TR(
"Invalid graph pointer."));
63 throw Exception(
TE_TR(
"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(
TE_TR(
"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(
TE_TR(
"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(
TE_TR(
"Iterator not initialized."));
198 if(m_edgeQuery->moveNext())
207 return m_graph->getEdge(
id);
An abstract class that models a source of data in a query.
The Field class can be used to model an expression that takes part of the output items of a SELECT...
static const std::string sm_tableVertexModelAttrId
Attribute id.
A class that models the name of a dataset used in a From clause.
A class that models the name of any property of an object.
Expression * getExpression() const
It returns the expression set for an output select query.
virtual ~QueryIterator()
Virtual destructor.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
#define TE_TR(message)
It marks a string in order to get translated.
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
Boolean logic operator: AND.
This is an abstract class that models a query expression.
From the point of view of graph theory, vertices are treated as featureless and indivisible objects...
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
QueryIterator(te::graph::AbstractGraph *g)
Default constructor.
static const std::string sm_tableEdgeModelAttrId
Attribute Id.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
A class that can be used to model a filter expression that can be applied to a query.
A Select models a query to be used when retrieving data from a DataSource.
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
It models the comparison operator.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
static const std::string sm_tableEdgeModelAttrVFrom
Attribute Vertex From.
A class that can be used in an ORDER BY clause to sort the items of a resulting query.
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...