Skip to content

Commit f2658a9

Browse files
authored
Release 4.3.1 (#247)
1 parent d8a0916 commit f2658a9

6 files changed

Lines changed: 60 additions & 20 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
This changelog was started for release 4.2.0.
99

10+
11+
## [4.3.1] - 2021-06-16
12+
13+
### Fixed
14+
15+
- Fixed an issue with categories
16+
- Fixed an issue with GFF import
17+
1018
## [4.3.0] - 2021-06-10
1119

1220
### Added
@@ -26,7 +34,6 @@ This changelog was started for release 4.2.0.
2634
- Now return the created file id (instead of celery task id) in the create file endpoint
2735
- Fixed Flask version to < 2.0.0 due to compatibility issues
2836

29-
3037
### Fixed
3138

3239
- Fixed the console restriction to admin/users (was not fully functional)

askomics/libaskomics/GffFile.py

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,8 @@ def generate_rdf_content(self):
162162

163163
total_lines = sum(1 for line in open(self.path))
164164
row_number = 0
165+
feature_dict = {}
166+
delayed_link = []
165167

166168
for rec in GFF.parse(handle, limit_info=limit, target_lines=1):
167169

@@ -196,9 +198,11 @@ def generate_rdf_content(self):
196198
else:
197199
entity = self.namespace_entity[self.format_uri(self.format_gff_entity(feature.qualifiers["ID"][0]))]
198200
entity_label = self.format_gff_entity(feature.qualifiers["ID"][0])
201+
feature_dict[self.format_gff_entity(feature.qualifiers["ID"][0])] = feature.type
199202
else:
200203
entity = self.namespace_entity[self.format_uri(self.format_gff_entity(feature.id))]
201204
entity_label = self.format_gff_entity(feature.id)
205+
feature_dict[self.format_gff_entity(feature.id)] = feature.type
202206

203207
self.graph_chunk.add((entity, rdflib.RDF.type, entity_type))
204208
self.graph_chunk.add((entity, rdflib.RDFS.label, rdflib.Literal(entity_label)))
@@ -298,19 +302,41 @@ def generate_rdf_content(self):
298302
for qualifier_key, qualifier_value in feature.qualifiers.items():
299303

300304
for value in qualifier_value:
305+
skip = False
301306

302307
if qualifier_key in ("Parent", "Derives_from"):
308+
if len(value.split(":")) == 1:
309+
# The entity is not in the value, try to detect it
310+
if value in feature_dict:
311+
related_type = feature_dict[value]
312+
related_qualifier_key = qualifier_key + "_" + related_type
313+
else:
314+
# Do this later
315+
delayed_link.append({
316+
"uri": self.namespace_data[self.format_uri(qualifier_key)],
317+
"label": rdflib.Literal(qualifier_key),
318+
"type": [rdflib.OWL.ObjectProperty, self.namespace_internal[self.format_uri("AskomicsRelation")]],
319+
"domain": entity_type,
320+
"range": value,
321+
"qualifier_key": qualifier_key,
322+
"feature_type": feature.type
323+
})
324+
skip = True
325+
else:
326+
related_type = value.split(":")[0]
327+
related_qualifier_key = qualifier_key + "_" + related_type
328+
303329
relation = self.namespace_data[self.format_uri(qualifier_key)]
304330
attribute = self.namespace_data[self.format_uri(self.format_gff_entity(value))]
305331

306-
if (feature.type, qualifier_key) not in attribute_list:
307-
attribute_list.append((feature.type, qualifier_key))
332+
if not skip and (feature.type, related_qualifier_key) not in attribute_list:
333+
attribute_list.append((feature.type, related_qualifier_key))
308334
self.attribute_abstraction.append({
309335
"uri": self.namespace_data[self.format_uri(qualifier_key)],
310336
"label": rdflib.Literal(qualifier_key),
311337
"type": [rdflib.OWL.ObjectProperty, self.namespace_internal[self.format_uri("AskomicsRelation")]],
312338
"domain": entity_type,
313-
"range": self.namespace_data[self.format_uri(value.split(":")[0])]
339+
"range": self.namespace_data[self.format_uri(related_type)]
314340
})
315341

316342
else:
@@ -363,3 +389,13 @@ def generate_rdf_content(self):
363389
self.graph_chunk.add((entity, self.namespace_internal["includeInReference"], block_reference))
364390

365391
yield
392+
393+
# Add missing abstractions
394+
for link in delayed_link:
395+
if link["range"] in feature_dict:
396+
entity_type = feature_dict[link['range']]
397+
related_qualifier_key = link.pop("qualifier_key") + "_" + entity_type
398+
feature_type = link.pop("feature_type")
399+
if (feature_type, related_qualifier_key) not in attribute_list:
400+
link['range'] = self.namespace_data[self.format_uri(entity_type)]
401+
self.attribute_abstraction.append(link)

askomics/libaskomics/SparqlQuery.py

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,20 +1280,17 @@ def build_query_from_json(self, preview=False, for_editor=False):
12801280
# values
12811281
if attribute["filterSelectedValues"] != [] and not attribute["optional"] and not attribute["linked"]:
12821282
uri_val_list = []
1283-
for value in attribute["filterSelectedValues"]:
1284-
if attribute["faldo"] and attribute["faldo"].endswith("faldoStrand"):
1285-
value_var = faldo_strand
1286-
uri_val_list.append("<{}>".format(value))
1283+
if attribute["faldo"] and attribute["faldo"].endswith("faldoStrand"):
1284+
value_var = faldo_strand
1285+
else:
1286+
value_var = category_value_uri
1287+
uri_val_list = ["<{}>".format(value) for value in attribute["filterSelectedValues"]]
1288+
if uri_val_list:
1289+
if attribute["exclude"]:
1290+
filter_string = "FILTER ( {} NOT IN ( {} ) ) .".format(value_var, " ,".join(uri_val_list))
1291+
self.store_filter(filter_string, block_id, sblock_id, pblock_ids)
12871292
else:
1288-
value_var = category_value_uri
1289-
uri_val_list.append("<{}>".format(value))
1290-
1291-
if uri_val_list:
1292-
if attribute["exclude"]:
1293-
filter_string = "FILTER ( {} NOT IN ( {} ) ) .".format(value_var, " ,".join(uri_val_list))
1294-
self.store_filter(filter_string, block_id, sblock_id, pblock_ids)
1295-
else:
1296-
self.store_value("VALUES {} {{ {} }}".format(value_var, ' '.join(uri_val_list)), block_id, sblock_id, pblock_ids)
1293+
self.store_value("VALUES {} {{ {} }}".format(value_var, ' '.join(uri_val_list)), block_id, sblock_id, pblock_ids)
12971294

12981295
if attribute["linked"]:
12991296
var_2 = self.format_sparql_variable("{}{}_{}Category".format(

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"ontology"
99
],
1010
"name": "AskOmics",
11-
"version": "4.3.0",
11+
"version": "4.3.1",
1212
"description": "Visual SPARQL query builder",
1313
"author": "Xavier Garnier",
1414
"license": "AGPL-3.0",

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name='askomics',
8-
version='4.3.0',
8+
version='4.3.1',
99
description='''
1010
AskOmics is a visual SPARQL query interface supporting both intuitive
1111
data integration and querying while shielding the user from most of the

0 commit comments

Comments
 (0)