I use RDFLib to query the semantic Dicom ontology . I am querying for owl: Class in a graph built from the above ontology. RDFLib returns results containing empty nodes, and I want to exclude such queries. My request is
from rdflib import Graph g = Graph() g.parse('dicom.owl') q = """SELECT ?c WHERE {?c rdf:type owl:Class}""" qres = g.query(q)
dicom.owl is the Semantic Dicom Ontology downloaded on my machine.
Some results that I get are 
How can I modify my query to exclude all empty nodes?
source share