Loading...
Searching...
No Matches
DataSourceGraphMetadata.h
Go to the documentation of this file.
1/* Copyright (C) 2008 National Institute For Space Research (INPE) - Brazil.
2
3 This file is part of the TerraLib - a Framework for building GIS enabled applications.
4
5 TerraLib is free software: you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as published by
7 the Free Software Foundation, either version 3 of the License,
8 or (at your option) any later version.
9
10 TerraLib is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public License
16 along with TerraLib. See COPYING. If not, write to
17 TerraLib Team at <terralib-team@terralib.org>.
18 */
19
20/*!
21 \file DataSourceGraphMetadata.h
22
23 \brief Class used to define the graph metadata informations
24 over a SGBD source
25*/
26
27#ifndef __TERRALIB_GRAPH_INTERNAL_DATASOURCEGRAPHMETADATA_H
28#define __TERRALIB_GRAPH_INTERNAL_DATASOURCEGRAPHMETADATA_H
29
30// Terralib Includes
31#include "../../core/GraphMetadata.h"
32#include "../../Config.h"
33
34
35// STL Includes
36#include <string>
37
38namespace te
39{
40 // Forward declarations
41 namespace da
42 {
43 class DataSource;
44 class DataSetType;
45 }
46
47 namespace gm { class Envelope; }
48
49 namespace graph
50 {
51 class GraphMetadata;
52
53 /*!
54 \class DataSourceGraphMetadata
55
56 \brief Class used to define the graph metadata informations
57 over a SGBD source
58
59 \sa GraphMetadata, Enums
60 */
61
63 {
64 public:
65
66 /*! \brief Default constructor. */
68
69 /*! \brief Default destructor. */
71
72 /*!
73 \brief Function used to load the graph information given a graph id
74
75 \param id The Graph identifier
76
77 \exception Exception It throws an exception if graph id equal -1
78 */
79 void load(int id);
80
81 /*!
82 \brief Function used to save the graph information
83
84 */
85 void save();
86
87 /*!
88 \brief Function used to update the graph information on a data source
89
90 \exception Exception It throws an exception if graph id equal -1
91 */
92 void update();
93
94 /*!
95 \brief Add a new property associated to the vertex element
96
97 param p New property to be associated with vertex elements.
98
99 \note It's important before using this function call the flush() function, its necessary
100 to force the memory clear and the elements will be loaded with the right size of
101 properties.
102 */
104
105 /*!
106 \brief Remove a property associated to the vertex element
107
108 \param idx Index of the property
109 */
110 virtual void removeVertexProperty(int idx);
111
112 /*!
113 \brief Add a new property associated to the edge element
114
115 param p New property to be associated with edge elements.
116
117 \note It's important before using this function call the flush() function, its necessary
118 to force the memory clear and the elements will be loaded with the right size of
119 properties.
120 */
122
123 /*!
124 \brief Remove a property associated to the edge element
125
126 \param idx Index of the property
127 */
128 virtual void removeEdgeProperty(int idx);
129
130
131 protected:
132
133 /*!
134 \brief Function used to create the graph metadata tables in a SGBD
135
136 \exception Exception It throws an exception if execution fails
137 */
139
140
141 /*!
142 \brief Function used to create the graph metadata attributes tables in a SGBD
143
144 \exception Exception It throws an exception if execution fails
145 */
147
148 /*!
149 \brief Function used to create the vertex model scheme of tables
150
151 \note NOT IN USE
152
153 \exception Exception It throws an exception if execution fails
154 */
156
157 /*!
158 \brief Function used to create the edge model scheme of tables
159
160 \exception Exception It throws an exception if execution fails
161 */
163
164 /*!
165 \brief Used when edge_model is selected and vertex objects has
166 attributes associated.
167
168 \exception Exception It throws an exception if execution fails
169 */
171
172 /*!
173 \brief Used when vertex_model is selected and edge objects has
174 attributes associated.
175
176 \exception Exception It throws an exception if execution fails
177 */
179
180 /*!
181 \brief Function used to create a table inside the SGBD
182
183 \param tableName String with the table name
184
185 \param dt Struct that defines each column of the table
186
187 \exception Exception It throws an exception if execution fails
188
189 */
190 void createTable(std::string tableName, te::da::DataSetType* dt);
191
192 /*!
193 \brief Verify if a graph name is valid
194 */
195 bool isValidGraphName(std::string graphName);
196
197 /*!
198 \brief Add a new graph metadata information into the SGBD
199
200 \exception Exception It throws an exception if execution fails
201 */
203
204 /*!
205 \brief Add a new graph attributes metadata information into the SGBD
206
207 \note Call the function saveGraphAttrTableNewEntry.
208
209 \exception Exception It throws an exception if execution fails
210 */
212
213 /*!
214 \brief Save each metadata attributes of vertex and eges into SGBD
215
216 \param graphId The graph id associated with this attribute
217
218 \param tableName The table name that contains this attribute
219
220 \param attrName The attribute name
221
222 \param linkColumn The link column name used to associate this attribute to the element (vertex or edge)
223
224 \param type The attribute type ( is vertex or edge attribute)
225
226 \exception Exception It throws an exception if execution fails
227 */
228 void saveGraphAttrTableNewEntry(int graphId, std::string tableName, std::string attrName, std::string linkColumn, te::graph::GraphAttrType type);
229
230 /*!
231 \brief Save a property into a table in SGBD
232
233 \param tableName The table name that will contains this property
234
235 \param p The property to be saved
236
237 \exception Exception It throws an exception if execution fails
238 */
239 void saveProperty(std::string tableName, te::dt::Property* p);
240
241 /*!
242 \brief Remove a property of a table in SGBD
243
244 \param tableName The table name that contains this property
245
246 \param propertyName The property name to be removed
247
248 \exception Exception It throws an exception if execution fails
249 */
250 void removeProperty(std::string tableName, std::string propertyName);
251
252 /*!
253 \brief Function used to load the graph information given a graph id
254
255 \param id The graph id
256
257 */
258 void loadGraphInfo(int id);
259
260 /*!
261 \brief Function used to load the graph attributes information given a graph id
262
263 \param id The graph id
264
265 */
266 void loadGraphAttrInfo(int id);
267
268 /*!
269 \brief Load the vertex attributes
270
271 \param tableName The table name that contains the vertex attributes
272
273 \param columnName The column name that contins the attribute information
274
275 */
276 void loadVertexAttr(std::string tableName, std::string columnName);
277
278 /*!
279 \brief Load the edge attributes
280
281 \param tableName The table name that contains the edge attributes
282
283 \param columnName The column name that contins the attribute information
284
285 */
286 void loadEdgeAttr(std::string tableName, std::string columnName);
287
288 /*!
289 \brief
290 */
292 };
293 } // end namespace graph
294} // end namespace te
295
296#endif // __TERRALIB_GRAPH_INTERNAL_DATASOURCEGRAPHMETADATA_H
A class that models the description of a dataset.
Definition: DataSetType.h:73
An abstract class for data providers like a DBMS, Web Services or a regular file.
Definition: DataSource.h:120
It models a property definition.
Definition: Property.h:60
Class used to define the graph metadata informations over a SGBD source.
void removeProperty(std::string tableName, std::string propertyName)
Remove a property of a table in SGBD.
void loadGraphInfo(int id)
Function used to load the graph information given a graph id.
void createGraphMetadataTable()
Function used to create the graph metadata tables in a SGBD.
void addGraphAttrTableNewEntry()
Add a new graph attributes metadata information into the SGBD.
~DataSourceGraphMetadata()
Default destructor.
void loadGraphAttrInfo(int id)
Function used to load the graph attributes information given a graph id.
DataSourceGraphMetadata(te::da::DataSource *ds)
Default constructor.
void createTable(std::string tableName, te::da::DataSetType *dt)
Function used to create a table inside the SGBD.
void addGraphTableNewEntry()
Add a new graph metadata information into the SGBD.
virtual void removeEdgeProperty(int idx)
Remove a property associated to the edge element.
void loadVertexAttr(std::string tableName, std::string columnName)
Load the vertex attributes.
bool isValidGraphName(std::string graphName)
Verify if a graph name is valid.
void loadEdgeAttr(std::string tableName, std::string columnName)
Load the edge attributes.
void createGraphAttributesTable()
Function used to create the graph metadata attributes tables in a SGBD.
virtual void removeVertexProperty(int idx)
Remove a property associated to the vertex element.
void createVertexAttrTable()
Used when edge_model is selected and vertex objects has attributes associated.
void createGraphTableEdgeModel()
Function used to create the edge model scheme of tables.
virtual void addEdgeProperty(te::dt::Property *p)
Add a new property associated to the edge element.
void createEdgeAttrTable()
Used when vertex_model is selected and edge objects has attributes associated.
virtual void addVertexProperty(te::dt::Property *p)
Add a new property associated to the vertex element.
void saveProperty(std::string tableName, te::dt::Property *p)
Save a property into a table in SGBD.
void update()
Function used to update the graph information on a data source.
void saveGraphAttrTableNewEntry(int graphId, std::string tableName, std::string attrName, std::string linkColumn, te::graph::GraphAttrType type)
Save each metadata attributes of vertex and eges into SGBD.
void save()
Function used to save the graph information.
void createGraphTableVertexModel()
Function used to create the vertex model scheme of tables.
void load(int id)
Function used to load the graph information given a graph id.
Class used to define the graph metadata informations.
Definition: GraphMetadata.h:57
GraphAttrType
Definition: Enums.h:62
TerraLib.
#define TEGRAPHEXPORT
You can use this macro in order to export/import classes and functions from this module.
Definition: Config.h:178