2
$\begingroup$

Bug in 12.1.1 and possibly earlier versions


Acknowledged by WRI as an issue CASE:4617646.

$Version
(* "12.1.1 for Mac OS X x86 (64-bit) (June 19, 2020)" *)

Entity["BasicFoodGroup", "Vegetables"]["Foods"];

Fails with

EntityValue::ctimeout : A computation timed out.

This works

Entity["BasicFoodGroup", "Dairy"]["Foods"];

Any workarounds? WRI was not able to provide one.

$\endgroup$

1 Answer 1

1
$\begingroup$

Since EntityValue determines the foods by finding the associated food types, and then finding the foods associated with each type, you can mimic this with:

dairy1 = Entity["BasicFoodGroup", "Dairy"]["Foods"];
dairy2 = Union @ Flatten @ EntityValue[
    Entity["BasicFoodGroup", "Dairy"]["FoodTypes"],
    "Foods"
];

Union @ dairy1 === dairy2

True

So, you can obtain the foods associated with "Vegetables" using:

vegetables = Union @ Flatten @ EntityValue[
    Entity["BasicFoodGroup", "Vegetables"]["FoodTypes"],
    "Foods"
];
$\endgroup$
1
  • $\begingroup$ Thanks for the explanation Carl. $\endgroup$ Sep 5, 2020 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.