Message Boards Message Boards

3
|
6647 Views
|
3 Replies
|
11 Total Likes
View groups...
Share
Share this post:

How can you obtain a list of available qualifiers values for EntityProperty

Posted 11 years ago

I was checking out this week's Wolfram Blog - Which is closer: Local Beer or Whiskey?

The question, how can you obtain a list of available qualifiers and valueswithin a specific EntityProperty.?

In the example For Beer Consumption, the underlying code is

EntityProperty["Country", "AgricultureConsumptionPerCapita", 
   {"AgricultureProduct" -> "Beer"}]

So,

1)how can I know that the underlying qualifiers are available? (in this example "AgricultureProduct")
2) What are the values available for a given key (eg "Beer")

POSTED BY: Diego Zviovich
3 Replies

Excellent!

EntityValue["Marco's Response"]:= Infinity

POSTED BY: David Reiss

Hi Diego,

I suppose that the procedure could be like this: There are four main levels: Entities, Properties, Quantifiers and QuantifierValues.

You create an entity with an inline freeform input shift+ =; you then type in what you are interested in, e.g. United Kingdom.

enter image description here

That creates an entity. Alternatively, you can look at all Entities by typing

EntityValue[]

which gives

{"AdministrativeDivision", "Aircraft", "Airline", "Airport", \n    "AmusementPark", "AmusementParkRide", "Artwork", \n    "AstronomicalObservatory", "AtmosphericLayer", "Beach", "BoardGame", \n    "Book", "Bridge", "BroadcastStation", \n    "BroadcastStationClassification", "Building", "Canal", "Castle", \n    "CatBreed", "Cave", "Cemetery", "Character", "Chemical", "City", \n    "Cloud", "Color", "Comet", "Company", "ComputationalComplexityClass", \n    "Constellation", "ContinuedFraction", "Country", "CrystalFamily", \n    "CrystallographicSpaceGroup", "CrystalSystem", \n    "CurrencyDenomination", "Dam", "DeepSpaceProbe", "Desert", \n    "Dinosaur", "Disease", "DisplayFormat", "DistrictCourt", "DogBreed", \n    "EarthImpact", "Element", "Exoplanet", "FamousAlgorithm", \n    "FamousChemistryProblem", "FamousGem", "FamousMathGame", \n    "FamousMathProblem", "FamousPhysicsProblem", "FictionalCharacter", \n    "FileFormat", "Financial", "FiniteGroup", "Forest", \n    "FrequencyAllocation", "Galaxy", "Gene", "GeologicalLayer", \n    "GeologicalPeriod", "GivenName", "Glacier", "Graph", \n    "HistoricalCountry", "HistoricalEvent", "HistoricalPeriod", \n    "HistoricalSite", "IntegerSequence", "InternetDomain", "IPAddress", \n    "Island", "Isotope", "Knot", "Lake", "Lamina", "Language", "Lattice", \n    "LatticeSystem", "MannedSpaceMission", "MathWorld", "MedicalTest", \n    "MeteorShower", "MetropolitanArea", "Mine", "Mineral", "MinorPlanet", \n    "Mountain", "Movie", "Museum", "MusicAct", "MusicAlbum", \n    "MusicAlbumRelease", "MusicalInstrument", "MusicWork", \n    "MusicWorkRecording", "Mythology", "Nebula", "Neighborhood", \n    "NotableComputer", "NuclearExplosion", "NuclearReactor", \n    "NuclearTestSite", "Ocean", "OilField", "Park", "Particle", \n    "ParticleAccelerator", "Periodical", "PeriodicTiling", "Person", \n    "PhysicalSystem", "PlaneCurve", "Planet", "PlanetaryMoon", "Plant", \n    "Pokemon", "Polyhedron", "PopularCurve", "PreservationStatus", \n    "PrivateSchool", "Protein", "PublicSchool", "Pulsar", "Reef", \n    "Religion", "ReserveLand", "River", "Rocket", "Satellite", \n    "SchoolDistrict", "Ship", "Shipwreck", "SNP", "SolarSystemFeature", \n    "Solid", "Source", "SpaceCurve", "Species", "SportObject", "Stadium", \n    "Star", "StarCluster", "Supernova", "Surface", "Surname", "TimeZone", \n    "TropicalStorm", "Tunnel", "UnderseaFeature", "University", \n    "USCongressionalDistrict", "Volcano", "Waterfall", "WeatherStation", \n    "Word", "ZIPCode"}

You hover over it with the mouse and see its input form, which you can also get by wrapping that into InputForm. You get something like:

Entity["Country", "UnitedKingdom"]

That tells you that the overarching structure is "Country". To see all possible properties of that you can type

EntityValue["Country","Properties"]

That gives a very long list of properties. You choose the one you like and copy it and wrap it into InputForm and get:

  EntityProperty["Country", "AgriculturalConsumptionPerCapita"]

Note that the outermost function has changed from EntityValue to EntityProperty.

Use the "Qualifiers" option in EntityValue (!), to see all possible "options". In this case

EntityValue["Country", "AgricultureConsumptionPerCapita", "Qualifiers"]

gives

   {"AgricultureProduct", "Date"}

These are the alternatives for the next level. If you use

EntityValue["Country", "AgricultureConsumptionPerCapita", "QualifierValues"]

it shows all possible items you might want to look for:

{"AgricultureProduct" -> {"Apple", "AquaticPlant", "Banana", "Barley",
    "Bean", "Beer", "BovineMeat", "Cassava", "Cephalopod", "Cheese", 
   "CoconutOil", "Coffee", "CottonseedOil", "Cream", "Crustacean", 
   "Date", "DemersalFish", "EdibleOffal", "Egg", "FreshwaterFish", 
   "Grape", "Grapefruit", "GroundnutOil", "Honey", "LemonAndLime", 
   "Maize", "Milk", "Millet", "MuttonAndGoatMeat", "Nuts", "Oats", 
   "Olive", "OliveOil", "Onion", "OrangeAndMandarine", 
   "PalmkernelOil", "PalmOil", "Pea", "PelagicFish", "Pepper", 
   "Pigmeat", "Pimento", "Pineapple", "Plantain", "Potato", 
   "PoultryMeat", "RapeAndMustardOil", "RiceMilledEquivalent", 
   "RicePaddyEquivalent", "Rye", "SesameseedOil", "Soybean", 
   "SoybeanOil", "Spices", "SugarAndSweeteners", "SunflowerseedOil", 
   "SweetPotato", "Tea", "Tomato", "Wheat", "Whey", "Wine", "Yam"}, 
 "Date" -> {}}

You first see all possible QuantifierValues for "AgricultureProduct". That then leads to the command

EntityProperties["Country","AgricultureConsumptionPerCapita", {"AgricultureProduct"-> "Beer"}]

Hence,

EntityValue[Entity["Country", "UnitedKingdom"], EntityProperty["Country", "AgricultureConsumptionPerCapita", {"AgricultureProduct" -> "Beer"}]]

or

enter image description here

gives the result.

I hope that this helps,

Marco

PS: This command is nice:

TableForm[{#, EntityValue[Entity["Country", "UnitedKingdom"], EntityProperty["Country", "AgricultureConsumptionPerCapita", {"AgricultureProduct" -> #}]]} & /@ EntityValue["Country", "AgricultureConsumptionPerCapita", "QualifierValues"][[1, 2]]]

It gives

enter image description here

POSTED BY: Marco Thiel
Posted 11 years ago

Thank you Marco!

POSTED BY: Diego Zviovich
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract