From this page, I want to click through each sub-node of the tree, and print out all of the terminal child nodes (i.e. a list of all the kits/systems available) (e.g. so in the case below, I would click assay bioassay componant -> assay kit -> print out all the child nodes which are a list of kits):
I wrote this code:
from owlready2 import *
onto = get_ontology('http://www.bioassayontology.org/bao/bao_complete.owl').load()
print(list(onto.classes()))
onto.save(file = 'onto.test',format='rdfxml')
But it doesn't print out the names, it prints out other info to json, e.g.:
<owl:Class rdf:about="http://purl.obolibrary.org/obo/GO_0009372">
<rdfs:subClassOf rdf:resource="http://www.bioassayontology.org/bao#BAO_0000264"/>
<obo:IAO_0000412 rdf:resource="http://purl.obolibrary.org/obo/go.owl"/>
<oboI:inSubset rdf:resource="http://purl.obolibrary.org/obo/go#goslim_pir"/>
<oboI:inSubset rdf:resource="http://purl.obolibrary.org/obo/go#gosubset_prok"/>
I also tried pronto:
import pronto
from pronto import Ontology
ont = Ontology.from_obo_library('/bao.owl')
print(ont)
My ideal output is a list of all the terminal child nodes in this tree; or if not possible, just a clear example of how to extract this data to .json so I can then use an XML parser, but in particular, ensuring that the actual names of the kits are in the json file, and not just codes as I got above, if someone could help I'd appreciate it.
