I have a SPARQL CONSTRUCT like:
CONSTRUCT
{
?address
schema:addressLocality ?city;
schema:addressCountry ?country;
schema:streetAddress ?addressLine;
schema:postalCode ?zip;
schema:addressRegion ?region.
}
WHERE
{
?address
schema:addressLocality ?city;
schema:addressCountry ?country.
OPTIONAL { ?address schema:streetAddress ?addressLine }
OPTIONAL { ?address schema:postalCode ?zip }
OPTIONAL { ?address schema:addressRegion ?region }
}
I'm getting fewer triples this way, than when the CONSTRUCT lists all the triple patterns explicitly, without omitting the subject for variables that are optional (ie, possibly unbounded):
CONSTRUCT
{
?address
schema:addressLocality ?city;
schema:addressCountry ?country.
?address schema:streetAddress ?addressLine.
?address schema:postalCode ?zip.
?address schema:addressRegion ?region.
}
...
I was assuming that the two forms can't influence the result, but now I'm gathering that instead the implicit subject syntax actually means something like "I want all the graph rooted on this subject or nothing at all for it". Is it like that? Is this behaviour specified by SPARQL, or is it the way it's implemented in certain engines (I'm on top of Virtuoso)?