Open joeflack4 opened 10 months ago
The challenge here is that client code may need to be generic; for example:
Not every ontology instantiates every one of these, so if we use lookups to determine validity, this will yield false positive errors.
We could do some hardcoding (e.g hardcode a set of RO IDs as never being mapping predicates, hardcode skos to never be a relationship predicate), but this would only catch a subset of errors, and would not be very generic.
What is the algorithm for determining if something is a valid predicate? Unfortunately there are a large number of different ontologies out there that represent things in different ways.
We could simply look up the predicate in the existing ontology.
Oh, I didn't realize that this could be a difficult thing. I actually thought that (though I see how that is naive) the same predicate would be used in the same way for any ontology. And I also thought that OAK was already doing hard-coding of such 'invalid' predicates.
Overview
Both in the CLI and in the Python API, I've mistakenly used
relationships
to try to access a number of edges at once which include mappings, rather than usingrelationships
andmappings
commands separately. I suggest that if invalid predicates are passed, a warning or error should occurCurrent behavior
The behavior is inconsistent. In (1), the predicate invalid predicate is not returned, and in (2) they are.
CLI: The invalid predicate I passed (
oboInOwl:hasDbXref
) is simply ignored and not returned.Python API: The invalid predicates I passed (
skos:exactMatch
,skos:narrowMatch
) were returned. Additional info: They are not returned when.relationships()
is used without passing thepredicates
flag, which is a logical inconsistency and in conflict with what the docstring says (:param predicates: constrain search to these predicates
). That is to say, any relationship returned when passing thepredicates
flag should also be present if not passing the flag.Expected behavior
The command/method should show a warning or throw an error, and possibly also detect if these are mapping predicates and suggest to use that method instead.