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

TypeError: '<' not supported between instances of 'str' and 'int' #34

Open
JordanTStrong opened this issue Jan 30, 2023 · 0 comments
Open

Comments

@JordanTStrong
Copy link

JordanTStrong commented Jan 30, 2023

I am attempting to save dynamically created classes and subclasses to a rdfxml file. I got the class data from a csv that I managed with pandas df. When I try running onto.save(file = 'onto.rdfxml', format = 'rdfxml') the following error is returned:

'''TypeError: '<' not supported between instances of 'str' and 'int' on line 464 of driver.py'''

At first I thought that it had to do with special characters and ints being in the strings used in the class names. But, after removing all special characters and whitespaces and replacing all ints with their spelt out names (ie 1 = one), the same TypeError was returned.

Next, I tried seeing if the ontology was being saved as expected. Using the docs, I ran the code below, and it showed that the classes and subclasses were being successfully added. So, the issue was clearly with saving the file.

class_list = list(onto.classes())
for i in class_list:
    print(i, "is a subclass of: ", end='')
    for j in i.is_a:
        print(j, end=', ')
    print("\n")

Then, I tried to see if saving the ontology to a different file type would work. I tried turtle, xml, own, and omn, and while the onto.save line ran successfully, it never stored any data. The file size stayed at 0 bytes.

Again, the error is '''TypeError: '<' not supported between instances of 'str' and 'int' on line 464 of driver.py''' found at:
File /opt/anaconda3/lib/python3.8/site-packages/owlready2/driver.py:466, in _save(f, format, graph, filter)

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

1 participant