Skip to content

Commit

Permalink
Move default query back to faldo ontology
Browse files Browse the repository at this point in the history
  • Loading branch information
mboudet committed Aug 10, 2023
1 parent 2c1a4d6 commit 6312775
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -52,6 +52,7 @@ This changelog was started for release 4.2.0.
- 'Same strand' queries will now match 'BothStrand' with a forward or reverse strand
- Use '+', '-' and '.' for strand values in CSV instead of raw value (for homogenization)
- Now allows 'infinite' recursive blocks (ie, a Minus block inside a Union block, or the opposite)
- Overhaul faldo relation: add 'direct shortcut' triples between entities and values, to avoid using slow property paths when using faldo queries

### Security

Expand Down
6 changes: 3 additions & 3 deletions askomics/libaskomics/SparqlQuery.py
Expand Up @@ -1538,7 +1538,7 @@ def build_query_from_json(self, preview=False, for_editor=False):
if attribute["visible"] or Utils.check_key_in_list_of_dict(attribute["filters"], "filterValue") or attribute["id"] in start_end or attribute["id"] in linked_attributes:
subject = self.format_sparql_variable("{}{}_uri".format(attribute["entityLabel"], attribute["nodeId"]))
if attribute["faldo"]:
predicate = "askomics:{}".format("faldoBegin" if attribute["faldo"].endswith("faldoStart") else "faldoEnd")
predicate = "faldo:location/faldo:{}/faldo:position".format("begin" if attribute["faldo"].endswith("faldoStart") else "end")
else:
predicate = "<{}>".format(attribute["uri"])
obj = self.format_sparql_variable("{}{}_{}".format(attribute["entityLabel"], attribute["nodeId"], attribute["label"]))
Expand Down Expand Up @@ -1623,7 +1623,7 @@ def build_query_from_json(self, preview=False, for_editor=False):
category_value_uri = self.format_sparql_variable("{}{}_{}Category".format(attribute["entityLabel"], attribute["nodeId"], attribute["label"]))
category_label = self.format_sparql_variable("{}{}_{}".format(attribute["entityLabel"], attribute["humanNodeId"], attribute["label"]))
if attribute["faldo"] and attribute["faldo"].endswith("faldoReference"):
category_name = 'askomics:faldoReference'
category_name = 'faldo:location/faldo:begin/faldo:reference'
self.store_triple({
"subject": node_uri,
"predicate": category_name,
Expand All @@ -1640,7 +1640,7 @@ def build_query_from_json(self, preview=False, for_editor=False):
"nested_end": True if attribute["optional"] else False
}, block_id, sblock_id, pblock_ids, depth)
elif attribute["faldo"] and attribute["faldo"].endswith("faldoStrand"):
category_name = 'askomics:faldoStrand'
category_name = 'faldo:location/faldo:begin/rdf:type'
self.store_triple({
"subject": node_uri,
"predicate": category_name,
Expand Down
19 changes: 17 additions & 2 deletions docs/abstraction.md
Expand Up @@ -111,6 +111,19 @@ A FALDO entity have to be declared as FALDO on the abstraction. If attribute are

Four FALDO attributes are supported by AskOmics: reference, strand, start and end.

!!! warning
AskOmics expect faldo entities to follow the faldo ontology for triple definition. Ex:
```turtle
# Reference
:Entity faldo:location/faldo:begin/faldo:reference "value"
# strand
:Entity faldo:location/faldo:begin/rdf:type "value"
# Start
:Entity faldo:location/faldo:begin/faldo:position "value"
# Stop.
:Entity faldo:location/faldo:end/faldo:position "value"
```

### faldo:reference

A faldo:reference attribute derive from a Category attribute.
Expand Down Expand Up @@ -190,8 +203,10 @@ The default faldo ontology uses a chain of triple to describe the position (ex,
This make *faldo queries* (included_in/overlap_with/distant_from) extremely slow. To improve query time, AskOmics can use 'shortcut triples', direct relations between the Entity and the reference/strand, to quickly filter entities on the same reference/strand/both. For example:

```turtle
:EntityName faldo:reference reference_uri .
:EntityName faldo:strand strand_uri .
:EntityName askomics:faldoReference reference_uri .
:EntityName askomics:faldoBegin begin_value .
:EntityName askomics:faldoEnd end_value .
:EntityName askomics:faldoStrand strand_uri .
:EntityName askomics:referenceStrand reference_strand_uri .
```

Expand Down

0 comments on commit 6312775

Please sign in to comment.