One would assume that if you do unions and subqueries, you should also have a better idea about what kind of graph structure you want returned.. :-)
You can't construct GRAPHs in CONSTRUCT, for instance (at least not according to the standard). In the CONSTRUCT you can reference optional variables, for instance, and those triples would simply be skipped it that variable is missing in a particular binding. I don't think you can do conditional branches or property paths etc. in the CONSTRUCT bit - so you have to simplify those in the constructed graph (e.g. use a superproperty) or do multiple queries. Or do you intend to get something like "all nquads required to match my WHERE clause"? On 6 February 2015 at 11:05, Kamalraj Jairam <[email protected]> wrote: > This looks good for simple queries, > > In case of Queries with Unions and Subqueries etc, not sure what the > construct graph would look like > > > >> On 6 Feb 2015, at 9:58 pm, Andy Seaborne <[email protected]> wrote: >> >> On 06/02/15 09:54, Stian Soiland-Reyes wrote: >>> Or use CONSTRUCT WHERE {} shorthand: >>> >>> http://www.w3.org/TR/sparql11-query/#constructWhere >>> >>> I must admit I didn't check if this works in Jena, but given that Andy >>> cowrote the spec... :-) >> >> Yes, it works. >> >> It's syntactic sugar the parser sorts out. It's not even in the abstract >> syntax tree. >> >> arq.qparse 'CONSTRUCT WHERE {?s ?p ?o}' >> ==> >> CONSTRUCT >> { ?s ?p ?o .} >> WHERE >> { ?s ?p ?o} >> >> Andy >> >>> On 6 Feb 2015 09:39, "Andy Seaborne" <[email protected]> wrote: >>> >>>> On 06/02/15 02:32, Kamalraj Jairam wrote: >>>> >>>>> Hello All, >>>>> >>>>> How do i convert a sparql resultset to a model ? >>>>> >>>>> Is it possible without transforming the spraql select query to a >>>>> construct query? >>>>> >>>>> Thanks >>>>> Kamalraj >>>>> >>>> >>>> What are you trying to do? >>>> >>>> You can convert a ResultSet to a model with ResultSetFormatter.toModel. >>>> It's really left-over code from the days when SPARQL testing looked like it >>>> would be model based. >>>> >>>> It is encoding the result set, and it's not related to the vocabulary of >>>> the model queried. Try it out to see the vocabulary used. >>>> >>>> Andy >>>> >>>> >>> >> > -- Stian Soiland-Reyes Apache Taverna (incubating) http://orcid.org/0000-0001-9842-9718
