2007/9/17, Anders Rune Jensen &lt;<a href="mailto:anders@iola.dk">anders@iola.dk</a>&gt;:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi<br><br>I&#39;ve been reading the Xesam Query Language specification and I have a questions:<br><br>1) How do I get all tags for all files? Preferable as list&lt;name,<br>count&gt;. The same is true for other attributes such as mime-types.
</blockquote><div><br>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 &quot;any&quot;, and use it like the following.<br><br>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.
<br><br>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&nbsp; you set this to [xesam:tagName] and do the query<br><br>&lt;request xmlns=&quot;
<a href="http://freedesktop.org/standards/xesam/1.0/query">http://freedesktop.org/standards/xesam/1.0/query</a>&quot;&gt;<br>&nbsp; &lt;query content=&quot;xesam:Tag&quot;&gt;<br>&nbsp;&nbsp;&nbsp; &lt;any/&gt;<br>&nbsp; &lt;/query&gt;<br>&lt;/request&gt;
<br></div><br>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
<br><br>&lt;request xmlns=&quot;<a href="http://freedesktop.org/standards/xesam/1.0/query">http://freedesktop.org/standards/xesam/1.0/query</a>&quot;&gt;<br>
&nbsp; &lt;query content=&quot;xesam:Tag&quot;&gt;<br>
&nbsp;&nbsp;&nbsp; &lt;equals&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;field name=&quot;xesam:tagName&quot;/&gt;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &lt;string&gt;TAGNAME_HERE&lt;/string&gt;<br>&nbsp;&nbsp;&nbsp; &lt;/equals&gt;<br>
&nbsp; &lt;/query&gt;<br>
&lt;/request&gt;<br><br>and simply issue GetHitCount on each search and then close it. This should actually be fairly efficient on most backends.<br><br>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 &quot;search&quot; :-) In XESAM iteration 2 we will focus on a metadata management API where such things might be more natural.
<br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2) How can I sort the output? Sorting is very important when you<br>specify a maximum number of results one wants to have returned (btw.
<br>is this defined?).</blockquote><div><br>Sorting is controlled via the session properties sort.order, sort.primary and sort.secondary. This should probably also be documented in the query lang spec.<br></div><br>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.
<br><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">3) I find the names fullText and contains and what they do a little<br>strange. I would have thought that contains did what fullText does, so
<br>maybe renaming it to containsWord would help?</blockquote><div><br>If the the value to the contains selector is &lt;string&gt;hello world&lt;/string&gt; the phrase &quot;hello world&quot; should be contained in one of the listed fields. So it is really a generic this-field-contains.
<br></div><br>I give you that fullText might not bew totally obvious, but I lack a better alternative.<br><br>I will put an example in the contains selector. It is also on my todo to add a better description to the fullText selector.
<br><br>Cheers,<br>Mikkel<br></div><br>