I am using RDFLib to query on the Semantic Dicom Ontology. I am querying for owl:Class in the graph constructed from the above ontology. RDFLib returns results which contain bla
from rdflib import Graph g = Graph() g.parse('dicom.owl') q = """SELECT ?c WHERE { ?c rdf:type owl:Class . FILTER (!isBlank(?c)) }""" qres = g.query(q)
Take a look at this family of SPARQL functions: