Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

relationships: Add warning/error when invalid predicates #680

Open
joeflack4 opened this issue Nov 15, 2023 · 2 comments
Open

relationships: Add warning/error when invalid predicates #680

joeflack4 opened this issue Nov 15, 2023 · 2 comments

Comments

@joeflack4
Copy link
Contributor

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 using relationships and mappings commands separately. I suggest that if invalid predicates are passed, a warning or error should occur

Current behavior

The behavior is inconsistent. In (1), the predicate invalid predicate is not returned, and in (2) they are.

  1. CLI: The invalid predicate I passed (oboInOwl:hasDbXref) is simply ignored and not returned.

  2. 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 the predicates 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 the predicates 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.

@cmungall
Copy link
Collaborator

cmungall commented Dec 5, 2023

The challenge here is that client code may need to be generic; for example:

  • using is-a and part-of (BFO:0000050) as defaults
  • using a certain set of mapping predicates (e.g. exactMatch, closeMatch) as defaults

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.

@joeflack4
Copy link
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants