FoodOn Parsing problem in Python

25 views
Skip to first unread message

Anuja Tayal

unread,
Oct 7, 2022, 4:01:59 PM10/7/22
to FoodOn Farm-to-Fork Food Ontology Consortium
Hi
While parsing FoodOn through rdflib in python, I am getting following error

ValueError: day is out of range for month
<Graph identifier=Na3e430e5169b4b638aa47e9b4f20f991 (<class 'rdflib.graph.Graph'>)>

Can you help with the error?

Thanks and Regards
Anuja

Damion Dooley

unread,
Oct 12, 2022, 2:01:20 PM10/12/22
to FoodOn Farm-to-Fork Food Ontology Consortium
If you can post a simple python script for me to run, that would be appreciated!  Unfortunately I don't have a tool at hand to spot malformed dates (protege seems to be accepting them on load/save).

Thanks,
Damion

Damion Dooley

unread,
Oct 20, 2022, 9:03:13 AM10/20/22
to FoodOn Farm-to-Fork Food Ontology Consortium
Thanks for sending me the parsing script:

import rdflib
g=rdflib.Graph()
g.parse("foodon.owl",format='application/rdf+xml')


So it looks like this parses the foodon.owl file (with a few minor errors) if I load it directly from https://github.com/FoodOntology/foodon/ , the best place to get the source.  Can you load it from there please?

I'll check with Bioportal about updating their version of it.  It may require a release from our end.

Anuja Tayal

unread,
Oct 21, 2022, 12:48:10 PM10/21/22
to Damion Dooley, FoodOn Farm-to-Fork Food Ontology Consortium
After uploading foodon file from GitHub, I am getting different errors

File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/xml/sax/handler.py", line 38, in fatalError

    raise exception

xml.sax._exceptions.SAXParseException: file:///Users/anujatayal/Downloads/uic-courses/food/foodon.owl:16:75: not well-formed (invalid token)


Thanks and Regards
Anuja Tayal


--
You received this message because you are subscribed to the Google Groups "FoodOn Farm-to-Fork Food Ontology Consortium" group.
To unsubscribe from this group and stop receiving emails from it, send an email to foodon-consort...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/foodon-consortium/9af32b3c-cf7d-47f9-8c76-5fe6d3c978f1n%40googlegroups.com.

Damion Dooley

unread,
Dec 7, 2022, 5:52:34 PM12/7/22
to FoodOn Farm-to-Fork Food Ontology Consortium
We've made some other edits to the foodon file that might solve issues for you, if you want to try reloading foodon.owl from github?!
Reply all
Reply to author
Forward
0 new messages