I mentioned a few years ago when arrays first were introduced that there ought 
to be an engine based way to seach arrays for values, returning matching key 
references (not just one but ALL). If you are only interested in certain keys 
you could then filter the results. 

To make this fast for large arrays, you might have to have a way to index the 
arrays, but now we are talking about a memory based database system, and I am 
not sure Livecode arrays are the way to go. It may be enough to be able to do a 
kind of full text search on an array in memory. 

I suppose thinking about it you could arrayencode an array then do a search on 
it, but I am not sure how you would discern the array keys. I'll have to look 
at the encoded format. At that point if that approach worked, the only 
advantage to searching a memory based array is you would be skipping the 
encoding step, and searching the actual array in memory with the engine might 
be considerably faster than having LC search a text variable. 

I'll play around with it to see what I can come up with. 

Bob S


> On Aug 24, 2017, at 09:00 , Richard Gaskin via use-livecode 
> <use-livecode@lists.runrev.com> wrote:
> 
> At my local Linux User Group last year a fella from NASA gave a presentation 
> about a system he'd developed for querying planetary data via URLs.
> 
> The data is huge (basically everything every interplanetary satellite/robot 
> delivers to JPL) and his choice of HDF (Hierarchical Data Format) as the 
> storage base was interesting in itself (imagine a large encoded array but 
> designed for traversal on disk).
> 
> But even more so was his query API.  A thing of beauty.  One-line URLs could 
> be entered in a browser to locate just about anything in the massive HDF 
> store.
> 
> Ultimately it could be seen as a simplified form of XQuery, every bit as 
> elegant and flexible but without the XML-specific cruft (having to account 
> for the mix of elements and attributes).
> 
> Of course this led me to thinking of ways to use this for LC arrays.
> 
> It should be possible to craft a library to allow XQuery-like one-liners to 
> locate anything anywhere in any array.
> 
> It should also be possible to do this in the engine with blindingly-faster 
> efficiency.
> 
> But as a starting point, fleshing out the API in script seemed at least a 
> good first step.
> 
> I do not have the time to pursue it in earnest.  But XQuery is well 
> documented, and a sufficiently-inspired person may be able to come up with a 
> pretty great query system given sufficient time to explore the 
> possibilities...
> 
> -- 
> Richard Gaskin
> Fourth World Systems
> Software Design and Development for the Desktop, Mobile, and the Web


_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to