I am trying to look up data of entities, but I imagine I'm not doing it right, or have misunderstood the structure.

Here, I try the extract the values of the new SI defining constants, which are embedded deeply in the structure of the Entity["PhysicalConstants"]. However, the structure is not real Associations, so you can "index" your way to the information, but I had to use Lookup. Also, not all entities in the list have the property/value I look for, so some filtering is necessary.

My best try is

siconstants = {#[[1]], Lookup[#[[2]], "Value"]} & 
/@ Cases[{#, Lookup[EntityValue[#, "Values"], "CODATA2017RecommendedRevisedSI"] } & 
/@ EntityList["PhysicalConstant"], {_, _List}]

but there must be a simpler and more correct way(?)

  • $\begingroup$ I am not familiar with the EntityStore specifications, so i am not entirely sure the significant of "CODATA2017RecommendedRevisedSI", but would the following work for you? Thread[#[[2]] -> #["Value"]] & /@ EntityList["PhysicalConstant"] work for you? It is throwing some errors on my computer, but may be in the ballpark of what you are looking for. I added the Thread to clearly show what constant it was returning. $\endgroup$ – kickert Nov 28 '18 at 22:08
  • $\begingroup$ @kickert Thanks, but it is unclear to me, which value is taken for "Value" - the one Wolfram thinks is most authoritative? If you look at EntityValue[<one of the constants>, "Values"] you'll see it is a list of values determined experimentally (or found from LSQ determinations e.g. by CODATA). My point is how to extract the value in a more direct or "elegant" way, but maybe there isn't one. $\endgroup$ – HJensen Nov 29 '18 at 6:43
  • $\begingroup$ @HJensen look at EntityProperty qualifiers (there were recently a few Q/A things on that here) and they're documented in the scope section of EntityValue. $\endgroup$ – b3m2a1 Nov 29 '18 at 6:45
  • $\begingroup$ @HJensen, This EntityClass has Value and Values as properties. Values includes multiple sources and results. Value appears to be the one Wolfram has determined is best. From looking at the output for Values it seems very few have "CODATA2017RecommendedRevisedSI" information, while most of some version of CODATA, although the year varies (and some have no CODATA values.) $\endgroup$ – kickert Nov 29 '18 at 10:28
  • $\begingroup$ @b3m2a1, I have looked at the QualifierValues options, but can't get it to work on my computer (in 11.3 or 12PR). Not just for this case, but even copying the example directly from the documentation (Agriculture production). Are you having any luck with it? $\endgroup$ – kickert Nov 29 '18 at 10:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.