[XESAM] Questions regarding Xesam Query Language
Mikkel Kamstrup Erlandsen
mikkel.kamstrup at gmail.com
Mon Sep 17 03:59:33 PDT 2007
2007/9/17, Anders Rune Jensen <anders at iola.dk>:
>
> Hi
>
> I've been reading the Xesam Query Language specification and I have a
> questions:
>
> 1) How do I get all tags for all files? Preferable as list<name,
> count>. The same is true for other attributes such as mime-types.
You are right that there is no obvious way to do this atm. I think the best
solution is to simply add a new selector called "any", and use it like the
following.
Firstly note that the ontology does not yet implement Tags as first class
objects, but this is on Evgenys todo I believe. Since this is not ready yet
consider the following an example only.
Assume that the Tag objects has a field xesam:tagName. The return type for
GetHits is controlled via the session property hit.fields, so if you set
this to [xesam:tagName] and do the query
<request xmlns="http://freedesktop.org/standards/xesam/1.0/query">
<query content="xesam:Tag">
<any/>
</query>
</request>
GetHits will give you all all known Tag names. If you want the count for
each tag I see two solutions. Either the ontology should define a field
xesam:memberCount or something like that, or you create a new search for
each tag like
<request xmlns="http://freedesktop.org/standards/xesam/1.0/query">
<query content="xesam:Tag">
<equals>
<field name="xesam:tagName"/>
<string>TAGNAME_HERE</string>
</equals>
</query>
</request>
and simply issue GetHitCount on each search and then close it. This should
actually be fairly efficient on most backends.
It should be noted that tagging and tag management as such might be hard to
implement completely in the search API. The search API is mainly targetted
at "search" :-) In XESAM iteration 2 we will focus on a metadata management
API where such things might be more natural.
2) How can I sort the output? Sorting is very important when you
> specify a maximum number of results one wants to have returned (btw.
> is this defined?).
Sorting is controlled via the session properties sort.order, sort.primaryand
sort.secondary. This should probably also be documented in the query lang
spec.
The XESAM query language is designed to only specify what to match and not
the contents and format of the output as well. Output and format is
controlled via session props.
3) I find the names fullText and contains and what they do a little
> strange. I would have thought that contains did what fullText does, so
> maybe renaming it to containsWord would help?
If the the value to the contains selector is <string>hello world</string>
the phrase "hello world" should be contained in one of the listed fields. So
it is really a generic this-field-contains.
I give you that fullText might not bew totally obvious, but I lack a better
alternative.
I will put an example in the contains selector. It is also on my todo to add
a better description to the fullText selector.
Cheers,
Mikkel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/xdg/attachments/20070917/a1cf7717/attachment.htm
More information about the xdg
mailing list