def returnResult(self, select):
        if len(self.children) > 0:

            # combine all the results of all the kids into one array
            retval = []
            for c in self.children:
                res = c.returnResult(select)
                # res is a list of dictionaries, so each tuple should be taken
                # out and added to the result
                for t in res:
                    retval.append(t)
            return retval

        else:
            retval = []
            if self.bound == True and self.clash == False:
                # This node should be able to contribute to the final results
                # if it doesn't have any OPTIONAL proxies:
                result = {}

                #Determine if this node has an OPTIONAL 'proxy'
                proxies = []
                if self.optionalTrees:
                    proxies = reduce(lambda x,y: x+y,[list(_fetchBoundLeaves(o))
                                                for o in self.optionalTrees],[])
                # This where the essential happens: the binding values are
                # used to construct the selection result
                # sparql-p fix: A node with valid optional expansion trees
                # should not contribute to bindings (the OPTIONAL expansion
                # trees already account for its bindings)
                # see: http://chatlogs.planetrdf.com/swig/2007-06-07.html#T19-28-43
                if not proxies:
                    # @@FIXME: unused code
                    # prevBound = reduce(lambda x,y: x+y,
                    #            [list(_fetchBoundLeaves(o,previousBind=True))
                    #                             for o in self.optionalTrees],[])
                    if self.optionalTrees \
                          and reduce(lambda x,y: x+y,
                               [list(_fetchBoundLeaves(o, previousBind=True))
                                                for o in self.optionalTrees],[]):
                        pass

                    elif select:
                        for a in select:
                            if a in self.bindings:
                                result[a] = self.bindings[a]

                    else :
                        result = self.bindings.copy()

                    # Initial return block. If there is no optional processing,
                    # that is the result, in fact, because the for cycle below
                    # will not happen
                    retval = [result]

                else:
                    retval = reduce(lambda x,y: x+y,[
                                o.returnResult(select) for o in proxies]
                                )

            return retval
Parse a single log line
dataset/ETHPy150Open RDFLib/rdfextras/rdfextras/sparql/query.py/_SPARQLNode.returnResult--crossover with--dataset/ETHPy150Open pmrowla/pysrcds/srcds/logparser.py/SourceLogParser.parse_line