1
$\begingroup$

Why is the following interpreter restriction on City failing?

Interpreter[Restricted["City",Entity["AdministrativeDivision",{"Washington","UnitedStates"}]]]["Shoreline"]
Interpreter["City"]["Shoreline"]
Entity["City",{"Shoreline","Washington","UnitedStates"}]["AdministrativeDivision"]

Failure["RestrictionFailure", Association[ "MessageTemplate" :> MessageName[Interpreter, "geomember1"], "MessageParameters" -> Association[ "Polygon" -> "Washington, United States", "Input" -> "Shoreline"], "Region" -> Entity[ "AdministrativeDivision", {"Washington", "UnitedStates"}], "Input" -> "Shoreline"]]

Entity["City", {"Shoreline", "Washington", "UnitedStates"}]

Entity["AdministrativeDivision", {"Washington", "UnitedStates"}]

I am trying to Semantically Import a dataset and some of the interpreters when restricted don't seem to be capturing the required regions.


Another example:

Interpreter[Restricted["ZIPCode",Entity["AdministrativeDivision",{"Washington","UnitedStates"}]]]["98119"]
Interpreter["ZIPCode"]["98119"]
Entity["ZIPCode","98119"]["USStates"]

Failure["RestrictionFailure", Association[ "MessageTemplate" :> MessageName[Interpreter, "geomember1"], "MessageParameters" -> Association[ "Polygon" -> "Washington, United States", "Input" -> "98119"], "Region" -> Entity[ "AdministrativeDivision", {"Washington", "UnitedStates"}], "Input" -> "98119"]]

Entity["ZIPCode", "98119"]

{Entity["AdministrativeDivision", {"Washington", "UnitedStates"}]}


Using @ciao technique to give an explicit list of cities in the required region to Interpreter makes the above cases work but now I found another issue:

Interpreter["City"]["Preston"]
Interpreter[Restricted["City",Entity["AdministrativeDivision",{"Washington","UnitedStates"}]]]["Preston"]
Interpreter[Restricted["City",{GeoEntities[Entity["AdministrativeDivision",{"Washington","UnitedStates"}],"City"]}]]["Preston"]

Entity["City", {"Preston", "Lancashire", "UnitedKingdom"}]

Failure["RestrictionFailure", Association[ "MessageTemplate" :> MessageName[Interpreter, "geomember1"], "MessageParameters" -> Association[ "Polygon" -> "Washington, United States", "Input" -> "Preston"], "Region" -> Entity[ "AdministrativeDivision", {"Washington", "UnitedStates"}], "Input" -> "Preston"]]

Failure["RestrictionFailure", <|"MessageTemplate" :> Interpreter::choice, "MessageParameters" -> <|"Choices" -> "Aberdeen Gardens, Aberdeen, Acme, Ahtanum, Airway Heights, ..., Zillah", "Value" -> "Preston", "Input" -> "Preston"|>, "Choices" -> {Entity["City",{"AberdeenGardens","Washington","UnitedStates"}],...,Entity["City",{"Zillah","Washington","UnitedStates"}]}, "Value" -> Entity["City",{"Preston","Lancashire","UnitedKingdom"}],
"Input" -> "Preston"|>]

Is there a way to get Preston in Wolfram's GeoEntities?

$\endgroup$
2
  • 1
    $\begingroup$ Interpreter[ Restricted[ "City", {GeoEntities[ Entity["AdministrativeDivision", {"Washington", "UnitedStates"}], "City"]}]]["Shoreline"] $\endgroup$
    – ciao
    Mar 16 '20 at 1:01
  • $\begingroup$ @ciao Thank you your technique works in the above cases but this is still a workaround right because AdministrativeDivision should have worked directly on the Restricted Interpreter? Also please see my updated question about not being able to find another location (a town in Washington State). $\endgroup$
    – user13892
    Mar 16 '20 at 11:45

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.