2006/12/24, Jean-Francois Dockes &lt;<a href="mailto:jean-francois.dockes@wanadoo.fr" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">jean-francois.dockes@wanadoo.fr</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;">
&quot;James \&quot;Doc\&quot; Livingston&quot; writes:<br> &gt; On Thu, 2006-12-21 at 19:07 +0100, Jean-Francois Dockes wrote:<br> &gt; &gt; About 2), URI *is* an appropriate handle, and probably the best as long as<br> &gt; &gt; we can&#39;t guarantee the stability of the result set (that is: *if* we need
<br> &gt; &gt; separate Query() and GetSnippets() calls, *then* the URI is probably the<br> &gt; &gt; best identifier to ensure consistency).<br> &gt;<br> &gt; What if the URI of a given item can change? I&#39;m think in particular of
<br> &gt; the backends which handle &quot;file got moved&quot; in ways other the simple<br> &gt; &quot;remove old and add new&quot; method.<br> &gt;<br> &gt; If you had to retrieve the URI as a property rather than it being a
<br> &gt; unique identifier there would still obviously be some issues for things<br> &gt; that are using the simple non-live interface, but potentially having<br> &gt; stale data is what you get from using a non-live query.
<br> &gt;<br> &gt; Using an old URI as the unique identifier to retrieve other data (like<br> &gt; snippets or something) could lead to some&nbsp;&nbsp;odd situations.</blockquote><div><br><br>Which odd situations? If we are just talking about apps trying to get metadata for non-existing files I think this should be something that the app should cope with.
<br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Oops, yes, you&#39;re right the URI can change too.</blockquote><div><br>
<br>
Whether an uri can &quot;change&quot; or not is merely a matter of definition. If an object changes uri it might as well be regarded as another object all together. The end user will see it as a rename/move but in the api I think we should go for the delete-create metafor. Meaning that the is a one-to-one correspondence between objects and uris. 
<br><br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Lacking stable item identifiers, the only solution I can see is to have the
<br>initial query create and return a unique query identifier.</blockquote><div><br>I&#39;m not sure I understand what you mean here...<br>&nbsp;</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

We would then rely on the database/index manager to ensure that all<br>activity related to this query identifier is either consistent or resulting<br>in errors.<br><br>The query string can&#39;t be used as a query identifier, except if we strictly
<br>renounce relating data from different calls. Well, at least we now know why<br>it didn&#39;t look right :)</blockquote><div><br><br>I really think that it is important that we use the same data structures in the simple and the live apis (in this case the query responses).
More than that reusing the same data structures as many places as possible is a thing I think will pay off.<br><br>The live api needs to be able to add and remove hits dynamically. The bare minimum needed for this is unique object identifiers with respect to each Query object. Better would be unique identifiers relative to the Session, and the best would be globally unique identifiers (that would be uris).
<br></div><br>I think the most intuitive query response structure in the live api is a map like:<br><br>{<br>&nbsp; object1_id : { prop1 : [values...], prop2 : [values...] }<br>&nbsp; object2_id : { prop1 : [values...], prop2 : [values...] }
<br>}<br><br>the simple api is more straight forward with the return structure being a _sorted_ list like:<br><br>[<br>&nbsp; {&quot;uri&quot;: [object1_uri], prop1: [values...], prop2: [values]}<br>&nbsp; {&quot;uri&quot;: [object2_uri], prop1: [values...], prop2: [values]}
<br>]<br><br>There are a few cases to consider. Fx. the GetMetadata(in as uris, in as properties) method in both interfaces. If we use the list-type query response it will be necessary that the response is ordered identical to the original requested uri list. This introduces some complexity for async requests where the app will have to keep track the list of requested uris until it gets a response and then pair the results up.
<br><br>To get around this bookkeeping we could make the uri field mandatory in the GetMetadata response, but then we&#39;d actually be using the uris as doc ids, and might as well have used a map in the first place.<br><br>
I still tend heavily toward the a{sa{sas}} structure (map-like) since it seems the most flexible of the two. It is also easily reusable for different purposes (fx. metadata retrieval) which should make coding easier for the client apps or bindings.
<br><br>Cheers,<br>Mikkel<br><br>PS: Happy new year everybody.<br></div><br>