if ( elt instanceof ElementTriplesBlock )
{
if ( prev2 != null )
throw new ARQInternalErrorException("Mixed ElementTriplesBlock and ElementPathBlock (case 1)") ;
ElementTriplesBlock etb = (ElementTriplesBlock)elt ;
if ( prev != null )
{
// Previous was an ElementTriplesBlock.
// Merge because they were adjacent in a group
// in syntax, so it must have been BGP, Filter, BGP.
// Or someone constructed a non-serializable query.
prev.addAll(etb.getPattern()) ;
continue ;
}
// New BGP.
// Copy - so that any later mergings do not change the original query.
ElementTriplesBlock etb2 = new ElementTriplesBlock() ;
etb2.getPattern().addAll(etb.getPattern()) ;
prev = etb2.getPattern() ;
groupElts.add(etb2) ;
continue ;
}
// TIDY UP - grr this is duplication.