27 #include "../../common/Translator.h"
28 #include "../../common/StringUtils.h"
29 #include "../../dataaccess/dataset/DataSet.h"
30 #include "../../dataaccess/dataset/DataSetType.h"
31 #include "../../dataaccess/datasource/DataSource.h"
32 #include "../../dataaccess/query_h.h"
33 #include "../core/GraphMetadata.h"
34 #include "../Config.h"
35 #include "../Exception.h"
36 #include "../Globals.h"
49 if(m_graph == 0 || m_graph->getMetadata() == 0)
51 throw Exception(
TR_GRAPH(
"Invalid graph pointer."));
54 if(m_vertexQuery.get())
56 if(m_vertexQuery->moveFirst())
60 return m_graph->getVertex(
id);
64 if(m_listIsolatedVertex)
67 std::string tableName = m_graph->getMetadata()->getVertexTableName();
79 ob->push_back(obItem);
83 m_vertexQuery.reset(0);
84 m_vertexQuery = m_graph->getMetadata()->getDataSource()->query(select);
89 std::string tableName = m_graph->getMetadata()->getVertexTableName();
90 std::string edgeAttrTable = m_graph->getMetadata()->getEdgeTableName();
102 from->push_back(fiEdge);
104 std::string vertexFrom =
"edge.";
107 std::string vertexTo =
"edge.";
110 std::string vId =
"vertex.";
127 gb->push_back(gbItem);
131 ob->push_back(obItem);
135 m_vertexQuery.reset(0);
136 m_vertexQuery = m_graph->getMetadata()->getDataSource()->query(select);
139 if(m_vertexQuery.get() == 0)
141 throw Exception(
TR_GRAPH(
"Iterator not initialized."));
146 if(m_vertexQuery->moveNext())
155 return m_graph->getVertex(
id);
160 if(m_graph == 0 || m_graph->getMetadata() == 0)
162 throw Exception(
TR_GRAPH(
"Invalid graph pointer."));
165 if(m_edgeQuery.get())
167 if(m_edgeQuery->moveFirst())
171 return m_graph->getEdge(
id);
176 std::string tableName = m_graph->getMetadata()->getEdgeTableName();
180 fields->push_back(f);
188 ob->push_back(obItem);
192 m_edgeQuery.reset(0);
193 m_edgeQuery = m_graph->getMetadata()->getDataSource()->query(select);
195 if(m_edgeQuery.get() == 0)
197 throw Exception(
TR_GRAPH(
"Iterator not initialized."));
202 if(m_edgeQuery->moveNext())
211 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.
This class defines a commun interface to represents a graph iterator class. The main diferency to ano...
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.
A class that models the name of any property of an object.
virtual ~SequenceIterator()
Virtual destructor.
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.
virtual te::graph::Vertex * getFirstVertex()
It returns a pointer to the first vertex element of a graph.
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.
A class that can be used in a GROUP BY clause.
boost::ptr_vector< GroupByItem > GroupBy
A class that can be used to model a GROUP BY clause.
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.
virtual te::graph::Edge * getFirstEdge()
It returns a pointer to the first edge element of a graph.
A class that can be used to model a filter expression that can be applied to a query.
SequenceIterator(te::graph::AbstractGraph *g)
Default constructor.