Mov GP 0 wrote:
> Hello,
> I think the problem with sorting this is that the lines are not
> atomar. Instead of having a table of the form
>
> |-
> | Property1 || Property2.1, Property2.2, Property2.3, Property2.4
> |-
>
> the output should be rather
>
> |-
> | Property1 || Property2.1
> |-
> | Property1 || Property2.2
> |-
> | Property1 || Property2.3
> |-
> | Property1 || Property2.4
> |-
>
> this would allow proper sorting. To not break anything, I suggest a
> new parameter ie. called "group":
>
> {{#ask:
>  [[Author::+]]
>  |?Author
>  |sort=Author
>  |group= false
> }}
>
> or, more familar to SQL, "groupby":
>
> {{#ask:
>  [[Author::+]]
>  |?Author
>  |sort=Author
>  |groupby= Author
> }}
>
> This syntax could resolve the sorting problem.

This does not resolve the sorting problem, since you're still left
with the question of how to handle sorting when grouping multiple
values into a single entry.  As well, it opens a new can of worms in
bringing up the question of whether a given page should be reported
once, or once for every value that it has in a given property.  It's a
fascinating question that deserves discussion; but it has consequences
well beyond the issue of sorting.

For instance, take the following query:

  {{#ask:
  [[Category:Book]]
  |  sort=Author
  }}

Note that this query does not display the author for each book found;
indeed, it doesn't even guarantee that a given book will name the
author(s).  Note also that I did not include any sort of grouping or
degrouping parameter.  What sort of result should this query produce?

As written, I believe that it should list each book on the wiki
exactly once.  The question at hand is the order in which the books
should be presented.  There are actually two issues at hand here: what
to do with multiple values of a property on a page, and what to do
with the absence of values for a property on a page.  I've already
stated my proposal for resolving the first issue; for the second
issue, Pages without the sorted property should probably be listed
after pages with it, unless you explicitly state otherwise.

--

Now, let's look at "grouping":

  {{#ask:
  [[Category:Book]]
  | ?Author
  | duplicate=Author
  }}

My proposal here is that "duplicate" causes the page to show up in the
results once if it has zero or one Author, and once per Author if it
has more than one, treating each entry as if it only had one Author.
Note that I'm not sorting by Author in this query; you don't have to
sort by a property in order to duplicate on it.  Conversely, while I
_am_ having it list the Author for each result, you don't have to do
that, either.  This is why I say that the subject should be addressed
separately: it's largely orthogonal to the sorting problem, with the
sole exception that for the case where you're willing to duplicate on
the property that you're sorting on, the multiple values issue goes
away.

-- 
Jonathan "Dataweaver" Lang

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Semediawiki-devel mailing list
Semediawiki-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/semediawiki-devel

Reply via email to