30 #include "../../common/Translator.h"
31 #include "../../common/StringUtils.h"
32 #include "../../dataaccess/dataset/DataSet.h"
33 #include "../../dataaccess/dataset/DataSetType.h"
34 #include "../../dataaccess/datasource/DataSource.h"
35 #include "../../dataaccess/query_h.h"
36 #include "../../datatype/AbstractData.h"
37 #include "../core/AbstractGraph.h"
38 #include "../core/Edge.h"
39 #include "../core/GraphCache.h"
40 #include "../core/EdgeProperty.h"
41 #include "../core/GraphData.h"
42 #include "../core/GraphMetadata.h"
43 #include "../core/Vertex.h"
44 #include "../core/VertexProperty.h"
45 #include "../Config.h"
46 #include "../Globals.h"
47 #include "../Exception.h"
62 if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
74 std::string vertexAttrTable = m_graphMetadata->getVertexTableName();
75 std::string edgeAttrTable = m_graphMetadata->getEdgeTableName();
90 from->push_back(fiEdge);
92 std::string vertexFrom =
"edge.";
95 std::string vertexTo =
"edge.";
98 std::string vId =
"vertex.";
127 ob->push_back(obItem);
133 std::auto_ptr<te::da::DataSet> dataset = m_graphMetadata->getDataSource()->query(select);
135 std::auto_ptr<te::da::DataSetType> vertexDsType = m_graphMetadata->getDataSource()->getDataSetType(vertexAttrTable);
137 int vertexProperties = vertexDsType->getProperties().size();
146 while(dataset->moveNext())
148 int vId = dataset->getInt32(0);
149 int eId = dataset->getInt32(vertexProperties);
150 int vFrom = dataset->getInt32(vertexProperties + 1);
162 for(
int i = 1; i < vertexProperties; ++i)
191 if(m_graphMetadata == 0 || m_graphMetadata->getDataSource() == 0 || g == 0)
203 std::string edgeTable = m_graphMetadata->getEdgeTableName();
215 from->push_back(fi1);
231 ob->push_back(obItem);
237 std::auto_ptr<te::da::DataSet> dataset = m_graphMetadata->getDataSource()->query(select);
239 std::auto_ptr<te::da::DataSetType> edgeDsType = m_graphMetadata->getDataSource()->getDataSetType(edgeTable);
241 int edgeProperties = edgeDsType->getProperties().size();
244 while(dataset->moveNext())
246 int edgeId = dataset->getInt32(0);
247 int vFromId = dataset->getInt32(1);
248 int vToId = dataset->getInt32(2);
257 for(
int i = 3; i < edgeProperties; ++i)
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...
This class define the main functions necessary to save and load the graph data and metadata informati...
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements.
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.
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements.
A Select models a query to be used when retrieving data from a DataSource.
virtual void loadDataByVertexId(int vertexId, te::graph::AbstractGraph *g, te::graph::GraphCache *gc=0)
Functio used to load a group of vertex elements given a base element.
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
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...
virtual te::graph::GraphMetadata * getMetadata()=0
Function used to access the graph metadata.
It models the inequality operator greater than or equal to (>=).
boost::ptr_vector< FromItem > From
It models the FROM clause for a query.
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
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.
#define TE_GRAPH_FACTORY_GRAPH_TYPE_BIDIRECTIONALGRAPH
Boolean logic operator: AND.
GraphData * checkCacheByEdgeId(int id)
This functions check in cache if the edge element with a given id was alredy in memory.
This class implements the main functions necessary to save and load the graph data and metadata infor...
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
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.
It models the inequality operator less than or equal to (<=).
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
std::set< int > & getPredecessors()
Returns the Predecessors vector.
virtual void add(Vertex *v)=0
Add a new vertex element to a graph.
virtual void loadDataByEdgeId(int edgeId, te::graph::AbstractGraph *g, te::graph::GraphCache *gc=0)
Functio used to load a group of edges elements given a base element.
static const std::string sm_tableEdgeModelAttrId
Attribute Id.
This is an abstract class that models a query expression.
GraphData * checkCacheByVertexId(int id)
This functions check in cache if the vertex element with a given id was alredy in memory...
std::string getType()
It returns the graph type (defined in Enums file)
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.
It models the comparison operator.
virtual ~SequenceLoaderStrategy()
Default destructor.
Class used to define the graph metadata informations.
A class that can be used to model a filter expression that can be applied to a query.
std::set< int > & getSuccessors()
Returns the Successors vector.
SequenceLoaderStrategy(te::graph::GraphMetadata *metadata)
Default constructor.