2007/9/17, Mikkel Kamstrup Erlandsen <<a href="mailto:mikkel.kamstrup@gmail.com">mikkel.kamstrup@gmail.com</a>>:<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 <<a href="mailto:anders@iola.dk" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">anders@iola.dk</a>>:<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'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<name,<br>count>. 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 "any", 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 you set this to [xesam:tagName] and do the query<br><br><request xmlns="
<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>"><br> <query content="xesam:Tag">
<br> <any/><br> </query><br></request>
<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><request xmlns="<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>">
<br>
<query content="xesam:Tag"><br>
<equals><br> <field name="xesam:tagName"/><br> <string>TAGNAME_HERE</string><br> </equals><br>
</query><br>
</request><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 "search" :-) 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'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'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'm thinking some clustered browsing or something...
<br></div><br></div>Cheers,<br>Mikkel<br>