It would be cool to see this working in owlready2. Here's what I've been doing with just rdflib:
from rdflib.plugins.sparql import prepareQuery
from rdflib import URIRef
onto = get_ontology("file://../Ontology/newOnto.owl").load()
graph = default_world.as_rdflib_graph()
UC = URIRef('
http://www.semanticweb.org/myonto#')
q = prepareQuery('''SELECT ?UseCase
WHERE {
?UseCase UC:hasBoundary 'D' .}""", initNs={'UC':UC} )
for row in graph.query(q):
print(row)