Queries
We recommend you to use Xquery for the queries.
Queries to implement
We expect you to implement the following queries as a minimum. All
resulting files should be well-formed XML.
- List all jounal names appearing in a XML-bib-file.
- List all titles of publications of author named 'X'.
- Sort entries according to year.
- All co-authors to author 'X', sorted according to lastname
followed by first name, and with duplicates removed.
- All entries where the same title appears several times (i.e., in
different entries).
- All authors who also appears as editors somewhere in the
bibliography.
- Count the number of publications for author 'X' during year 'Y'.
- Make a transformation that chooses all entries of type article, conference, and phdthesis and include only the fields author, title, and year.
XQuery documentation
We have not found any good documentation for XQuery, but you can start
with the following links, and if you find something good, please let
us know.
An XQuery tool
You may use the following XQuery tool to evaluate your XQuery expressions:
Directions for usage and how to install it can be found on the above page.
Some examples
Examples of queries from the lecture on XQuery. The queries can be
tested together with the xml-document recipes.xml
from the XML tutorial by Anders Møller and Michael
I. Schwartzbach.
Other things you may need when implementing the above queries
The following things are not illustrated in the example queries, but you may want to use them when you implement your queries:
- You can compare nodes in the xml-document. $x = $y
evaluates to true if x and y are both the same node.
- You can use and, or, and not in boolean
expressions. NB! use not ($x = $y) and not $x != $y.
- You can define strings by writing let $x := "string"
- name($x) returns the name of the node represented by x,
but not as the type string. You have to convert it to sting if you
want to compare it to a string: string($x)="step"
- let $x := $y/(title|comment) sets $x to the list of nodes
that are children to $y with name title or comment.