Group Abstract Group Abstract

Message Boards Message Boards

1
|
4.6K Views
|
7 Replies
|
2 Total Likes
View groups...
Share
Share this post:

How do I work out the correct name for an entity property?

Posted 5 years ago

Given that the following:

AirportsData["Properties"] 

returns a list containing a property called "city". I was expecting to then be able to say

AirportsData[<name of airport>, "city"]

However, it turns out that the property is actually called "Cities".

So, my question is how could I have known that without actually having to grab the property and do a //FullForm? I feel I must be missing something obvious. Or, to put it another way, why does MMA return "city" instead of "cities"?

POSTED BY: Andrew Burnett
7 Replies
Posted 2 days ago

I’m a bit late to the party but in addition to what has already been suggested, another way to tell is that if you hover over a property in the output, you will see a tooltip with its input form, e.g. EntityProperty["Airport", "Cities"].

POSTED BY: Sami Boukortt

Thanks Sami, I hadn't noticed that before. Very helpful

Cheers Andy

POSTED BY: Andrew Burnett
Posted 5 years ago

Looking into this a bit more, I am now both intrigued and confused.

Building on Rohit's advice, I tried using //CanonicalName on some other *Data objects such as WordData. To my surprise Mathematica returns

CanonicalName: AmericanSpelling is not an entity

... So, there is clearly something different about AirportData and WordData. It seems as though AirportData is a proxy object for Airport, but I am not sure how I would know that, and what that implies. I am curious to understand.

POSTED BY: Andrew Burnett

I concur that here we have a usability problem. Suppose I enter

AirportData["Properties"]

Somehow I would expect that if I copy the boxed "city" and paste it into the input, everything should just work:

AirportData[**boxed city***]

Instead, I get a very unhelpful error message

AirportData::notent: city is not a known entity, class, or tag for AirportData. Use AirportData[] for a list of entities.

The autocompletion helps only if I somehow guess the beginning of the property.

POSTED BY: Gianluca Gorni
Posted 5 years ago

Trying to retrieve all of the properties also generates an unhelpful message, but at least it does return the values for all of the properties.

AirportData["KATL", #] & /@ (AirportData["Properties"] // CanonicalName)

EntityClassList::noent: Hartsfield-Jackson Atlanta International Airport is not an entity type.

POSTED BY: Rohit Namjoshi
Posted 5 years ago

Thanks Rohit. Your answers are always so helpful.

However, I still feel I am missing something. What is the benefit of Mathematica returning "city", when I can't actually use it to access the property?

Cheers. Andy

POSTED BY: Andrew Burnett
Posted 5 years ago

Hi Andrew,

AirportData["Properties"] // CanonicalName

(*
{"AlternateNames", "Cities", "Coordinates", "Countries", "Elevation",
"EntityClasses", "FAACode", "IATACode", "ICAOCode", "Latitude",
"LongestRunwayLength", "LongestRunwayWidth", "Longitude", "Name",
"NumberRunways", "OfficialName", "Position", "Uses"}
*)
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard