INCATools / INCATools/ontology-access-kit
Making retrieval of axiom annotations for synonyms faster
- Dominant language
- Python
- Stars
- 198
- Forks
- 35
- Avg merge
- 3d 4h
- Merged PRs (30d)
- 1
Description
I learned now that I can use some blazing fast built-in method for obtaining basic metadata for terms. However, some typical use cases are not covered, including synonym provenance.
For example:
```
for entity, spv in adapter.synonym_property_values(mondo_terms):
xrefs = "|".join(spv.xrefs)
synonym_type = spv.synonymType
synonym = spv.val
predicate = spv.pred
data_subsets.append({
"id": entity,
"synonym": synonym,
"synonym_type": synonym_type,
"xrefs": xrefs,
"predicate": predicate,
"group": mondo_group
})
```
takes an enormous amount of time, similar to
```
runoak -i sqlite:tmp/mondo_paper.db aliases MONDO:0000001 --obo-model
```
While not using the obo-model (and therefore not getting xrefs etc) is instant. I think this is not just about synonyms - one of the main arguments for oak is that it is faster than SPARQL/OWL because it is using an SQL backend, and this should be true for axiom annotations in general, not just the primary annotations.
EDIT: This SPARQL query takes less than 5 seconds to run, for example, and its a pretty standard for my work. Its unclear how I can replicate this in OAK.
```
SELECT ?entity ?label ?synonym ?xref ?st1 ?st2 WHERE {
?entity rdfs:label ?label .
?ax owl:annotatedSource ?entity ;
owl:annotatedProperty oboInOwl:hasExactSynonym ;
owl:annotatedTarget ?synonym ;
oboInOwl:hasDbXref ?xref .
OPTIONAL {
?ax oboInOwl:hasSynonymType ?st1 .
}
OPTIONAL {
?ax oboInOwl:hasSynonymType ?st2 .
FILTER(?st1!=?st2)
}
FILTER (isIRI(?entity) && STRSTARTS(str(?entity), "http://purl.obolibrary.org/obo/MONDO_"))
}
```
Contributor guide
Research direction
Start by tracing adapter.synonym_property_values and the runoak aliases command against the sqlite backend. Compare the existing axiom-annotation retrieval with the provided SPARQL query, preserving entity, label, synonym, xref, and synonym-type results. Done means standard synonym provenance retrieval is substantially faster and covers the listed annotation fields.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, sql
- Domain
- backend, databases, performance
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100