Re: limit per resource rethought...

On 2010-08-11, at 10:56, Axel Polleres wrote:

> Hi all again,
> in the course of my last mail, I also thought about adding another example:
> E)  "Give me all persons and the first 3 (alphabetically by name) of their friends"
> but I couldn't find any way to write this in an intuitive manner... ideas anyone? 
> I am afraid, that - by the scoping we have imposed for subqueries - that one might be difficult/impossible? 
> The following naive writing  does't work obviously:
>  { ?P a :Person . 
>    {SELECT ?P ?F { ?P :knows ?F . ?F name ?N } ORDER BY ?N LIMIT 3 }
>  }
> I also think I recall that we had this discussion already some time back in some other form,
> but I can't recall the outcome :-| 

This doesn't work because bindings happen bottom up, so the subSELECT is bound before the outer SELECT, I find this counter-intuative, but there are technical reasons why it has to be that way round, as I understand it.

Another thing that also doesn't quite work is:

SELECT ?p (SAMPLE(?f) AS ?f1) (SAMPLE(?f) AS ?f2) (SAMPLE(?f) AS ?f3)
   ?p a :Person .
   ?p :knows ?f .

The problem is that by the definition of the Sample set function, you get the same binding of ?f each time.

We could have a form of SAMPLE() like SAMPLE(?var ; offset=N), which takes the Nth value, rather than the 0th. 

- Steve

PS look, no commas :)

Steve Harris, CTO, Garlik Limited
1-3 Halford Road, Richmond, TW10 6AW, UK
+44 20 8439 8203
Registered in England and Wales 535 7233 VAT # 849 0517 11
Registered office: Thames House, Portsmouth Road, Esher, Surrey, KT10 9AD

Received on Wednesday, 11 August 2010 10:23:50 UTC