def _generatePattern(self, tupl):
        """
        Append a tuple to the local patterns. Possible type literals
        are converted to real literals on the fly.  Each tuple should
        be contain either 3 elements (for an RDF Triplet pattern) or
        four, where the fourth element is a per-pattern constraint
        (filter). (The general constraint of SPARQL can be optimized
        by assigning a constraint to a specific pattern; because it
        stops the graph expansion, its usage might be much more
        optimal than the the 'global' constraint).

        :param tupl: either a three- or four-element tuple

        """

        if type(tupl) != tuple:
            raise SPARQLError(
                "illegal argument, pattern must be a tuple, got %s" % type(tupl))

        if len(tupl) != 3 and len(tupl) != 4:
            raise SPARQLError(
                "illegal argument, pattern must be a tuple of 3 or 4 element, got %s" % len(tupl))

        if len(tupl) == 3:
            (s,p,o) = tupl
            f = None
        else:
            (s,p,o,f) = tupl

        final = []
        for c in (s,p,o):

            if _isResQuest(c):
                if not self.unbounds in c:
                    self.unbounds.append(c)
                final.append(c)

            elif isinstance(c, BNode):
                # Do nothing - BNode name management is handled by SPARQL parser
                # if not c in self.bnodes:
                #     self.bnodes[c] = BNode()
                final.append(c)

            else:
                final.append(_createResource(c))

        final.append(f)

        return tuple(final)
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/graph.py/GraphPattern._generatePattern/swapped operands of `in`