-
Notifications
You must be signed in to change notification settings - Fork 29
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
get_label*
issues
#212
Comments
Thanks @joeflack4! It looks like the problem here has nothing to do with |
@cmungall For 2 of these sub-issues, I agree with you that it is a DB connection issue. I just added this to the bottom of my issue. This is how I'm initializing my usage of OAK: from oaklib.resource import OntologyResource
from oaklib.implementations.sqldb.sql_implementation import SqlImplementation
resource = OntologyResource(slug='myOwlOntology.owl', local=True)
si = SqlImplementation(resource) I just noticed that the front page of the OAK GitHub seems to indicate that I should be passing a sqlite If a |
Thanks, this helps. We will work on improving the documentation for initialization of SqlImplementation. Yes, the canonical way to do this is to pass in a path to a ready-made sqlite database. See SqlImplementation. However, you are correct in that if you pass in an OWL file, it will build the sqlite database for you. There are a few caveats here.
I'm sorry, I missed the comment about iterators/generators before. This is indeed independent of the sqlite issues you are facing. The use of iterators is an intentional choice. We have a very preliminary FAQ entry about this, we will expand it. The reason to use iterators is because OAK is designed for ontologies large and small, for endpoints local and remote, for big queries and small queries. Using an iterator allows the client to start doing useful work on initial results before all results have been computed. There is indeed a tradeoff here, in that it requires slightly more defensive programming, and it's easy to make mistakes like I made a separate issue for this #221 |
Ok, sorry to take up your times w/ the iterators concern. I struck-through that part of the issue. Hmmm... no I haven't created a SQL DB in my Mondo work / from RDF or OWL yet, and I mostly have access to files in OWL, not RDF/XML. This will require a bit more work on my end. I'll converse with Nico and see how we want to use OAK in light of this. Just adding again that I think Thanks for your very detailed explanations. |
I partially agree - I think the principle here is that it should raise an error if the input is something that it is unable to handle, and error reporting should be more intuitive. I made a separate issue for this: #223 However, I don't think it's good to unwaveringly assume a relationship between suffix and format/model
So while it's good to guess-with-consent based on suffix, it must be forgiving of going against convention |
@cmungall I have updated this issue with another problem case. To make best use of your time, please look at new suggestions at the bottom of the original post. |
Summary
I have a list of terms and I'm trying to get their labels using, but I got errors in some cases, and no label in others.
1-3: Using
SqlImplementation
1. No
get_label_by_uri()
orget_labels_by_uris()
I appreciate the CURIE methods, and will likely use those more often; I'd imagine these URI ones are somewhere on the to-do list.
2.
get_label_by_curie()
errors outPython code:
Short err:
sqlalchemy.exc.DatabaseError: (sqlite3.DatabaseError) file is not a database
Long err:
3.
get_labels_for_curies()
errors out & prints out a lot tostderr
Code:
labels = [x for x in si.get_labels_for_curies(list(df_i['term_id']))]
Error:
It showed a lot more than this; more than my IDE's terminal could show. I couldn't see the actual stacktrace. Also looked like it printed the full list of terms in the ontology.
### 4. UX:get_labels_for_curies()
returns a generatorI think the documentation shows specifically how to use it, but I wonder if this is the best design. I may just not be sure about the various benefits, but I'd definitely prefer if this defaulted to a (a) flat list, or (b) dict of CURIE -> label.Edit: This is a design choice.
Additional information
How I'm initializing:
Relevant dependency versions:
All dependency versions: mondo-ingest-pip-freeze.txt
4. Using
ProntoImplementation
got no labels() when passing CURIEExample class
Code snippet
Suggestions
prefix_map
when initializing ontology. This may solve cases where it can't find on CURIE, because it can't expand CURIE properly.ProntoImplementation
def type definitions, e.g.label(self, curie: CURIE) -> str:
anddef _entity(self, curie: CURIE, strict=False):
toUnion[CURIE, URI]
. In my test case, URI worked successfully.The text was updated successfully, but these errors were encountered: