Hello Peter, I've made a script with three trivial mappings that differs in option ( exclusive / soft exclusive / none ) and inspected results of various variants of queries with subselect. So far, it works as expected. The script is too long to fix into the mail list without additional actions, so I'm sending it to you as a separate mail. If you want some specific diagnostics I'll need your database schema, some sample data and the script that declares RDF Views, of course.
> Are there any potential issues with sort order - eg the sub-select returned data in a different order to what is expected? Indeed. No ORDER BY clause implies that the optimizer may do whatever with the order, including different order for different runs of same query on same data. Best Regards, Ivan Mikhailov OpenLink Software http://virtuoso.openlinksw.com On Mon, 2012-01-30 at 14:14 +1100, Peter Secomb wrote: > Hi everyone, > > We've recently run into an issue to do with pagination. In our triple > store we have rows of data represented by 200+ triples (over 200 > columns per row). When the data is queried we take the list of > triples and then pivot it to return it to row data. The information > was sourced from a traditional RDBMS system. > > The problem we have is that when queried we need to limit the amount > of data being returned so as not to swamp the servers on every > request. However a LIMIT/OFFSET combination returns only a subset of > a rows data (eg LIMIT 50 returns 50 attributes of the 200 attribute > row). > > To solve this problem we have embedded a sub query that uses > LIMIT/OFFSET but only operates over the primary key for each row. > Then using the primary key which fetch the rest of the data. > > Eg: > > SELECT ?pid ?p ?o ?dataset > FROM <graph_A> > FROM <graph_B> > WHERE > { > ?pid ?p ?o > {SELECT * WHERE { ?s attribute:primary_key ?pid} LIMIT 20 OFFSET 10} > graph ?dataset { ?s attribute:primary_key ?pid} > } > ORDER BY ?pid > > The original query uses the graph ?dataset to provide links to the > source data when viewed through our reporting tools. > The sub-select was added to enabled the limit/offset. It appears that > the sub-select cannot be embedded into the graph ?dataset. > > Is anyone aware of a cleaner way of doing this? Are there any > potential issues with sort order - eg the sub-select returned data in > a different order to what is expected? (we don't believe so but it > doesn't hurt to ask!) > > Many thanks for your input, > Peter Secomb > clearbluewater.com.au
