What is the difference between ?g1 and ?g2? You use different triple patterns within graph blocks, but based on your xyz:good predicates, it could be that ?g1 == ?g2. In that case, do you even need two graph patterns?
Maybe start with explaining your use case instead of explaining your query? On Mon, Aug 22, 2016 at 3:40 PM, Chris Jones <[email protected]> wrote: > On 8/22/2016 7:33 AM, Jean-Marc Vanel wrote: >> >> Try a FILTER clause involving ?g1 and ?g2 . > > > I don't see how that would be any better; I'd still be specifying two > separate graphs ?g1 and ?g2, instead of a union graph ?g. Is there something > I don't understand? > >> there is also the unionGraph but it takes everything in all named graphs . > > > Thanks, but that's definitely not what I want. I want a way to take only > some of the named graphs. > > Is there a way to do a CONSTRUCT as a subquery, and perform my select > against the results of that subquery? > > Chris > > >> >> 2016-08-22 15:21 GMT+02:00 Chris Jones <[email protected]>: >> >>> Hi All, >>> >>> Is it possible to run a query against the union of a bunch of named >>> graphs, where each named graph is selected by some logic? As an example, >>> I >>> have something like this: >>> >>> select ?attr ?value ?attrName where { >>> graph ?g1 { >>> ?subj ?attr ?value . >>> } >>> graph ?g2 { >>> ?attr rdfs:label ?attrName . >>> } >>> ?g1 xyz:good true . >>> ?g2 xyz:good true . >>> } >>> >>> ...so I'm grabbing data from g1, and metadata from g2. Both g1 and g2 are >>> selected using some kind of logic; and they might be the same graph. You >>> can imagine a larger query, expressed in this style, could get very >>> complex. Is there instead a way to specify a union graph made up of all >>> the >>> graphs for which a predicate is true, and then perform a query against >>> that >>> union graph? >>> >>> Chris >>> >> >> >
