2007/9/17, Mikkel Kamstrup Erlandsen &lt;<a href="mailto:mikkel.kamstrup@gmail.com">mikkel.kamstrup@gmail.com</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;">
2007/9/17, Anders Rune Jensen &lt;<a href="mailto:anders@iola.dk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">anders@iola.dk</a>&gt;:<div><span class="q"><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></span><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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">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.
</div></blockquote><div><br>I just realised that my answer above does not answer your question about mime types and other similar things you might want to list.<br><br>I think what you ask for is a way to request all different values for a given field. I&#39;m not 100% sure that all implementations can support this effectively. Lucene does not support this AFAIK.
<br><br>Another thing is the use case... In the case of mime types why can&#39;t you use the conventional ways to get a list of known mime types? Why would you generally want to list all known values of a field? I&#39;m thinking some clustered browsing or something...
<br></div><br></div>Cheers,<br>Mikkel<br>