def __repr__(self):
        # from pprint import pformat
        if self.constraints:
            # return "Filter(.. a filter ..,BGP(%s))"%(','.join([pformat(p[:3]) for p in self.patterns]))
            return "Filter(.. a filter ..,BGP(%s))" % (
                ','.join([','.join([
                        self.canonicalTerm(pat[0]),
                        self.canonicalTerm(pat[1]),
                        self.canonicalTerm(pat[2])]
                        )
                            for pat in self.patterns]))

        else:
            # return "BGP(%s)"%(','.join([repr(p[:3]) for p in self.patterns]))
            return "BGP(%s)" % (
                    ','.join(['('+','.join([
                        self.canonicalTerm(s),
                        self.canonicalTerm(p),
                        self.canonicalTerm(o)]
                        )+')'
                            for s,p,o,f in self.patterns]))
        retval =  "   Patterns:    %s\n" % self.patterns
        retval += "   Constraints: %s\n" % self.constraints
        retval += "   Unbounds:    %s\n" % self.unbounds

        return retval
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/graph.py/BasicGraphPattern.__repr__/original