When there are different parts of pattern going to make up different
parts of the CONSTRUCT template, splitting it up into UNION makes sense.
It is using the fact that in a CONSTRUCT template, if variables are
unbound, the triple pattern isn't substantiated but the rest of the
triples from the template are still generated.
Following on from Richard, usin UNION turns a expontial growth into
linear growth.
A better solution is to support the idiom better.
That is have: a single request that is
CONSTRUCT { template1 } WHERE { pattern1 } ;
CONSTRUCT { template2 } WHERE { pattern2 } ;
CONSTRUCT { template3 } WHERE { pattern3 }
...
(c.f SPARQL Update).
to form one single result graph.
Andy
On 07/10/2021 11:57, Élie Roux wrote:
Thanks a lot for your very informative answer Richard, it's really
helpful to know when writing queries!
It seems this is a case where some optimizations might be implemented?
(I'm afraid this isn't something I could contribute though, sorry)
Best,