code: def displayTriples(triples, qname=qname):
      
      [print(*(e[:5]
               if isinstance(e, rdflib.BNode) else
               qname(e)
               for e in t), '.')
               for t in sorted(triples)]
docs: triples can also be an rdflib Graph instance