Hi all, in Jmol 14.2 an SQL-like syntax was introduced for queries using 'getProperty' and 'within'. The documentation states that it can also be used for user-defined associative arrays. But I couldn't find any examples of it. So I am not sure if it is actually possible to query a two-dimensinal associative array on the second level. Searching a one-dimensional associative array with a "SELECT ... WHERE ..."-like statement doesn't seem to offer much benefit. So I hope it is possible.
I could figure out how to query an array of associative arrays in the following example (not making much sense without additional associative array content): --- Example Query 1 ------------------------- y = [{"type": "a"}, {"type": "b"}, {"type": "a"}]; z = getProperty(y, "[SELECT * WHERE type='a']"); print "y: type=" + z.type + " size=" + z.size; show z; y: type=array size=2 z = [ { "type":"a" },{ "type":"a" } ] --------------------------------------------- But I usually need direct access to any array element by a predictable key. So I need a two-dimensional associative array like in the following two examples. I tried the same syntax and another one inspired from the "Array drilling" section in the documentation. But both didn't work: --- Example Query 2 ------------------------- x = {"key_1": {"type": "a"}, "key_2": {"type": "b"}, "key_3": {"type": "a"}}; z = getProperty(x, "[SELECT * WHERE type='a']"); print "x: type=" + z.type + " size=" + z.size; show z; x: type=string size=0 z = "" --- Example Query 3 ------------------------- x = {"key_1": {"type": "a"}, "key_2": {"type": "b"}, "key_3": {"type": "a"}}; z = getProperty(x, "[SELECT *][SELECT * WHERE key1='a']"); print "x: type=" + z.type + " size=" + z.size; show z; x: type=string size=0 z = "" --------------------------------------------- Q: Is it possible to query a two-dimensional associative array on the second level and if yes how is the syntax? Regards, Rolf -- Rolf Huehne Postdoc Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI) Beutenbergstrasse 11 07745 Jena, Germany Phone: +49 3641 65 6205 Fax: +49 3641 65 6210 E-Mail: rhue...@fli-leibniz.de Website: http://www.fli-leibniz.de Scientific Director: Prof. Dr. K. Lenhard Rudolph Head of Administration: Dr. Daniele Barthel Chairman of Board of Trustees: Dennys Klein VAT No: DE 153 925 464 Register of Associations: No. 230296, Amtsgericht Jena Tax Number: 162/141/08228 ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Jmol-users mailing list Jmol-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-users