Source:
<code>public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(final BindingSet bindings) throws QueryEvaluationException { final List<BindingSet> list = new ArrayList<>(); try { final Collection<Event> searchEvents; final String subj; if(subjectIsConstant) { subj = subjectConstant.get(); searchEvents = eventStore.search(Optional.of(new RyaURI(subj)), Optional.of(geoFilters), Optional.of(temporalFilters)); } else { searchEvents = eventStore.search(Optional.empty(), Optional.of(geoFilters), Optional.of(temporalFilters)); } for(final Event event : searchEvents) { final MapBindingSet resultSet = new MapBindingSet(); if(event.getGeometry().isPresent()) { final Geometry geo = event.getGeometry().get(); final Value geoValue = ValueFactoryImpl.getInstance().createLiteral(geo.toText()); final Var geoObj = geoPattern.getObjectVar(); resultSet.addBinding(geoObj.getName(), geoValue); } final Value temporalValue; if(event.isInstant() && event.getInstant().isPresent()) { temporalValue = ValueFactoryImpl.getInstance().createLiteral(event.getInstant().get().getAsDateTime().toString(TemporalInstantRfc3339.FORMATTER)); } else if(event.getInterval().isPresent()) { temporalValue = ValueFactoryImpl.getInstance().createLiteral(event.getInterval().get().getAsPair()); } else { temporalValue = null; } if(temporalValue != null) { final Var temporalObj = temporalPattern.getObjectVar(); resultSet.addBinding(temporalObj.getName(), temporalValue); } list.add(resultSet); } } catch (final ObjectStorageException e) { throw new QueryEvaluationException("Failed to evaluate the binding set", e); } if(bindings.size() != 0) { list.add(bindings); <START> } <END> return new CollectionIteration<>(list); }</code><technical_language>need careful here. is incoming BindingSet a Binding assigns a subject variable of StatementPattern constraints. In this case, need include subject a constraint in query. code in evaluation method needs iteration checks if incoming BindingSet assigns a subject variable</technical_language>

Target:
public CloseableIteration<BindingSet, QueryEvaluationException> evaluate(final BindingSet bindings) throws QueryEvaluationException { final List<BindingSet> list = new ArrayList<>(); try { final Collection<Event> searchEvents; final String subj; if(!subjectConstant.isPresent() && bindings.hasBinding(subjectVar.get())) { subjectConstant = Optional.of(bindings.getValue(subjectVar.get()).stringValue()); } else if(bindings.size() != 0) { list.add(bindings); } if(subjectConstant.isPresent()) { subj = subjectConstant.get(); searchEvents = eventStore.search(Optional.of(new RyaURI(subj)), Optional.of(geoFilters), Optional.of(temporalFilters)); } else { searchEvents = eventStore.search(Optional.empty(), Optional.of(geoFilters), Optional.of(temporalFilters)); } for(final Event event : searchEvents) { final MapBindingSet resultSet = new MapBindingSet(); if(event.getGeometry().isPresent()) { final Geometry geo = event.getGeometry().get(); final Value geoValue = ValueFactoryImpl.getInstance().createLiteral(geo.toText()); final Var geoObj = geoPattern.getObjectVar(); resultSet.addBinding(geoObj.getName(), geoValue); } final Value temporalValue; if(event.isInstant() && event.getInstant().isPresent()) { final Optional<TemporalInstant> opt = event.getInstant(); DateTime dt = opt.get().getAsDateTime(); dt = dt.toDateTime(DateTimeZone.UTC); final String str = dt.toString(TemporalInstantRfc3339.FORMATTER); temporalValue = ValueFactoryImpl.getInstance().createLiteral(str); } else if(event.getInterval().isPresent()) { temporalValue = ValueFactoryImpl.getInstance().createLiteral(event.getInterval().get().getAsPair()); } else { temporalValue = null; } if(temporalValue != null) { final Var temporalObj = temporalPattern.getObjectVar(); resultSet.addBinding(temporalObj.getName(), temporalValue); } list.add(resultSet); } } catch (final ObjectStorageException e) { throw new QueryEvaluationException("Failed to evaluate the binding set", e); } return new CollectionIteration<>(list); }