@@ -121,7 +121,7 @@ def evalUnion(ctx, union):
121
121
122
122
123
123
def evalMinus (ctx , minus ):
124
- a = set ( evalPart (ctx , minus .p1 ) )
124
+ a = evalPart (ctx , minus .p1 )
125
125
b = set (evalPart (ctx , minus .p2 ))
126
126
return _minus (a , b )
127
127
@@ -164,7 +164,7 @@ def evalGraph(ctx, part):
164
164
ctx = ctx .clone ()
165
165
graph = ctx [part .term ]
166
166
if graph is None :
167
- res = []
167
+
168
168
for graph in ctx .dataset .contexts ():
169
169
170
170
# in SPARQL the default graph is NOT a named graph
@@ -174,12 +174,13 @@ def evalGraph(ctx, part):
174
174
c = ctx .pushGraph (graph )
175
175
c = c .push ()
176
176
graphSolution = [{part .term : graph .identifier }]
177
- res += _join (evalPart (c , part .p ), graphSolution )
177
+ for x in _join (evalPart (c , part .p ), graphSolution ):
178
+ yield x
178
179
179
- return res
180
180
else :
181
181
c = ctx .pushGraph (ctx .dataset .get_context (graph ))
182
- return evalPart (c , part .p )
182
+ for x in evalPart (c , part .p ):
183
+ yield x
183
184
184
185
185
186
def evalValues (ctx , part ):
@@ -287,17 +288,16 @@ def evalAggregateJoin(ctx, agg):
287
288
p = evalPart (ctx , agg .p )
288
289
# p is always a Group, we always get a dict back
289
290
290
- res = []
291
291
for row in p :
292
292
bindings = {}
293
293
for a in agg .A :
294
294
evalAgg (a , p [row ], bindings )
295
295
296
- res . append ( FrozenBindings (ctx , bindings ) )
296
+ yield FrozenBindings (ctx , bindings )
297
297
298
298
if len (p ) == 0 :
299
- res . append ( FrozenBindings (ctx ) )
300
- return res
299
+ yield FrozenBindings (ctx )
300
+
301
301
302
302
303
303
def evalOrderBy (ctx , part ):
@@ -431,7 +431,7 @@ def evalQuery(graph, query, initBindings, base=None):
431
431
if firstDefault :
432
432
# replace current default graph
433
433
dg = ctx .dataset .get_context (BNode ())
434
- ctx = c .pushGraph (dg )
434
+ ctx = ctx .pushGraph (dg )
435
435
firstDefault = True
436
436
437
437
ctx .load (d .default , default = True )
0 commit comments