I realise this error has been posted several times on the website, but none of the solutions seem to work for my problem. I would like to invoke elements from my list (which consists of numbers between 0.0-1.0, and is called numbers) by index, originally owlready
allows me to get classes from an ontology, I had to convert them a few times to obtain a value which is considered a subclass in the ontology (for example, 0.6).
I would also like to ask if this approach in converting classes name to numbers is the correct way of doing things. The elements in the first list (values) look like this: melanoma_color.0.6 (where melanoma_color is the class and 0.6 is the subclass) I'm only interested in the subclass - 0.6.
from owlready import *
onto_path.append("C:/Users/Angelo/Desktop/Ontologia")
onto = get_ontology("http://localhost:8080/Melanoma_Names.owl").load()
values = list()
stringValues = list()
numbers = list()
test_melanoma = onto.Melanoma_Colors
for item in onto.subclasses_of(test_melanoma):
values.append(item)
for item in values:
stringValues.append(str(item))
del stringValues[-1:]
for x in stringValues:
numbers = [ float(x) for x in stringValues]
print(list(numbers[0]))