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)
64 throw Exception(
TE_TR(
""));
70 throw Exception(
TE_TR(
"TO DO"));
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)
193 throw Exception(
TE_TR(
""));
199 throw Exception(
TE_TR(
"TO DO"));
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)
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the vertex elements.
void setAttributeVecSize(int size)
This function is used to set the number of attributes associated with the edge elements.
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.
It models the inequality operator less than or equal to (<=).
A class that models the name of a dataset used in a From clause.
virtual ~SequenceLoaderStrategy()
Default destructor.
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.
std::set< int > & getPredecessors()
Returns the Predecessors vector.
boost::ptr_vector< OrderByItem > OrderBy
A class that can be used to model an ORDER BY clause.
It models the inequality operator greater than or equal to (>=).
#define TE_TR(message)
It marks a string in order to get translated.
GraphData * checkCacheByVertexId(int id)
This functions check in cache if the vertex element with a given id was alredy in memory...
virtual void add(Vertex *v)=0
Add a new vertex element to 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...
virtual te::graph::GraphMetadata * getMetadata()=0
Function used to access the graph metadata.
Class used to define the edge struct of a graph. Its compose with a identifier, the vertex origin and...
static const std::string sm_tableEdgeModelAttrId
Attribute Id.
Abstract class used to define the main functions of graph struct. All graph implementations must used...
SequenceLoaderStrategy(te::graph::GraphMetadata *metadata)
Default constructor.
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.
boost::ptr_vector< Field > Fields
Fields is just a boost::ptr_vector of Field pointers.
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.
A class that can be used to model a filter expression that can be applied to a query.
This class define the main functions necessary to save and load the graph data and metadata informati...
std::set< int > & getSuccessors()
Returns the Successors vector.
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.
Class used to manager the graph data elements. This class uses a cache policy to control the elements...
GraphData * checkCacheByEdgeId(int id)
This functions check in cache if the edge element with a given id was alredy in memory.
It models the comparison operator.
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
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.
void addAttribute(int idx, te::dt::AbstractData *ad)
Add a new attribute to this element.
#define TE_GRAPH_FACTORY_GRAPH_TYPE_BIDIRECTIONALGRAPH
static const std::string sm_tableEdgeModelAttrVTo
Attribute Vertex To.
This class implements the main functions necessary to save and load the graph data and metadata infor...