Thanks for your help. It seems the first solution is the simplest. However, I do not get a ResultSet object as result.
Regarding the second solution, I have taken a look at the ResultSetStream constructor and it seems we need 3 parameters: * the first one is a lists of variable: we just have to append the variables from the two result sets * the second is a Model: it seems we can create a new model that is the concatenation of the two models ModelFactory.createDefaultModel().add(...) * the third is a QueryIterator: I can create a QueryIterConcat but we need to specify a parameter which is an ExecutionContext, what is the value to use for it? It seems it is not really easy and efficient (due to the concatenation of models). Moreover, It would be nice if the solution works for any kind of ResultSet. I have proposed a small patch for it. See https://issues.apache.org/jira/browse/JENA-66. Laurent >> Does Jena provide a means to create a new ResultSet which is the union >> of two ResultSets? Especially in the case where the two result sets >> have the same variables. > > No - there isn't specifically. > > UNION is concatenation and results are Iterator<QuerySolution>. You could > use Iter.concat or your favourite way to concatenate iterators. > >> Or is there a means to create a ResultSet by >> using a list of variables and a QuerySolution/Binding? > > You could create a QueryIterator and use ResultSetStream > > There are lots QueryIterator including QueryIterConcat > > Internally, everything is done in QueryIterator - ResultSets are the final > step of presentation. > >> I have take a look at ResultSetUtils and ResultSetMem but it seems >> there is nothing to do it :S >> >> Kind Regards, >> >> Laurent > > Andy >
