|
@@ -245,4 +245,17 @@ class LeDataSourceSQL(DummyDatasource):
|
245
|
245
|
# @param nature str|None : Search for relations with the given nature (if None rel2type)
|
246
|
246
|
# @param return an array of dict with keys [ id_sup, id_sub, rank, depth, nature ]
|
247
|
247
|
def get_relations(self, lodel_id, superior=True, nature=None):
|
248
|
|
- raise NotImplementedError()
|
|
248
|
+ select_params = {}
|
|
249
|
+ if superior is True:
|
|
250
|
+ select_params['id_sup'] = lodel_id
|
|
251
|
+ else:
|
|
252
|
+ select_params['id_sub'] = lodel_id
|
|
253
|
+
|
|
254
|
+ select_params['nature'] = nature
|
|
255
|
+
|
|
256
|
+ sql = select(self.datasource_utils.relations_table_name, select_params)
|
|
257
|
+
|
|
258
|
+ with self.connection as cur:
|
|
259
|
+ results = all_to_dicts(cur.execute(sql))
|
|
260
|
+
|
|
261
|
+ return results
|