RE: Limiting a query by setting a maximum number of distinct values for a given variable.

-----Original Message-----
From: semantic-web-request@w3.org [mailto:semantic-web-request@w3.org] On
Behalf Of Steve Harris
Sent: Tuesday, October 19, 2010 8:56 AM
To: Olivier Rossel
Cc: Alexandre Passant; Damian Steer; Semantic Web
Subject: Re: Limiting a query by setting a maximum number of distinct values
for a given variable.

On 2010-10-19, at 10:31, Olivier Rossel wrote:

>> Thanks for all your comments.
>> I am now wondering about a few things and would appreciate your feedback:
>> 
>> the use case I present is, in my opinion, very classic.
>> Most UIs dealing with a big set of data display them in a page-based
manner.
>> 
>> Steve proposes the application layer to handle the mismatch between
>> the LIMIT/OFFSET
>> queries and the page-based UI.
>> 
>> If the only usage of the application layer is to refactor result
>> sets'rows into page-based UIs, then
>> an interesting alternative is to include the page-based query feature
>> in the SPARQL spec.
>> Any opinion?

> I think it would be hard to specify. That doesn't mean it shouldn't be
done of course.
>
> (Arguably) the most obvious fix would be to have some way of writing a
top-down subquery, but that has issues around the 
> execution complexity of the resulting query, as I understand it.

We do something this in our extended version of sparql [1] - it looks like
this in action:

	set <mysub> = (select ?s from <...> where {?s a ex:Something} limit
100)

	describe ?s from <...> where {mysub(?s)}

We essentially allow a result set from a prior query to be used as a
relation in a later query. In general we support relations within the graph
pattern - a relation may bind to an earlier resultset, to the head of a
rule, or to a user-defined relation. E.g. we have a mechanism that lets the
user change what describe does. The default behavior is to just return all
direct properties of subject, but you could change to instead return CBDs by
adding a rule like:

	set <mysub> = (select ?s from <...> where {?s a ex:Something} limit
100)

	rulebase (
		select ?s ?p ?o ?r where {?r ?x ?y. <description>(?s, ?p,
?o, ?y). filter(isblank(?y))} as <description>
	)

	describe ?s from <...> where {mysub(?s)}

This works because the default implementation of describe makes use of a
relation called <decription> which can be augmented with additional rules.

-Geoff

[1] http://www.intellidimension.com/

Received on Tuesday, 19 October 2010 13:35:46 UTC