About use and semantics of DISTINCT

Is it possible to return a list of elements which are distinct in value?
For example, consider the following query.
Given a list of books, where each book contains its title, the list
of its authors and its publisher, we want to obtain for each publisher
the list of the titles of the books he has written and the list of the authors
which have published something with the publisher:

 FOR $p IN document(bib.xml)//publisher
RETURN
  <result>
    <publisher> $p/text() </publisher>
    { FOR $b IN document(bib.xml)//book
          $p2 IN $b/publisher
      WHERE $p=$p2
      RETURN $b/title
    { FOR $b IN document(bib.xml)//book
          $p2 IN $b/publisher
      WHERE $p=$p2
      RETURN $b/author
    }
  </result>

The trouble is that list of authors may contain duplicates, since an author 
may have published more than one book with the same publisher.

I Hope  you can help me

Phil

Received on Wednesday, 26 September 2001 06:45:14 UTC