A central feature of the Wolfram Language is that it’s got immense amounts of real-world data built in. It’s got data on countries and animals and movies, and lots more. It gets all this from the Wolfram Knowledgebase, which is being updated all the time—and is what powers Wolfram|Alpha and services based on it.

But how can you talk about a country in the Wolfram Language? The easiest way is just to use plain English. You can tell the Wolfram Language you’re going to be giving it plain English by pressing (Key1[ctrl, =]) (hold down the Control key and press the = key), or on a touch device, by pressing the  button.

LinguisticAssistant

LinguisticAssistant

As soon as you press (Key0[return]) (or click away), the Wolfram Language will try to interpret what you typed. Assuming it succeeds, it’ll display a little yellow box that represents a Wolfram Language entity. In this case, it’s the entity corresponding to the United States.

LinguisticAssistant

(Entity["United States", Entity["Country","UnitedStates"], "Entity[\"Country\", \"UnitedStates\"]", "country"])

Now you can ask for lots of properties of this entity. Like you could ask for the US flag.

(Entity["United States", Entity["Country","UnitedStates"], "Entity[\"Country\", \"UnitedStates\"]", "country"])["Flag"]

The result you get is something you can go on doing computation with—like in this case image processing.

ColorNegate[]

If all you want to do is to get the US flag, you can just ask for it in English.

LinguisticAssistant

EntityValue is a more flexible way to ask for the values of properties.

EntityValue[(Entity["United States", Entity["Country","UnitedStates"], "Entity[\"Country\", \"UnitedStates\"]", "country"]),"Flag"]

EntityValue also works with lists of entities.

EntityValue[{(Entity["United States", Entity["Country","UnitedStates"], "Entity[\"Country\", \"UnitedStates\"]", "country"]),(Entity["Brazil", Entity["Country","Brazil"], "Entity[\"Country\", \"Brazil\"]", "country"]),(Entity["China", Entity["Country","China"], "Entity[\"Country\", \"China\"]", "country"])},"Flag"]

The Wolfram Language has deep knowledge about countries, as about many other things.

EntityValue[{(Entity["United States", Entity["Country","UnitedStates"], "Entity[\"Country\", \"UnitedStates\"]", "country"]),(Entity["Brazil", Entity["Country","Brazil"], "Entity[\"Country\", \"Brazil\"]", "country"]),(Entity["China", Entity["Country","China"], "Entity[\"Country\", \"China\"]", "country"])},"RadioStations"]

PieChart[EntityValue[{(Entity["United States", Entity["Country","UnitedStates"], "Entity[\"Country\", \"UnitedStates\"]", "country"]),(Entity["Brazil", Entity["Country","Brazil"], "Entity[\"Country\", \"Brazil\"]", "country"]),(Entity["China", Entity["Country","China"], "Entity[\"Country\", \"China\"]", "country"])},"RadioStations"]]

(Entity["Switzerland", Entity["Country","Switzerland"], "Entity[\"Country\", \"Switzerland\"]", "country"])["BorderingCountries"]

EntityValue[(Entity["Switzerland", Entity["Country","Switzerland"], "Entity[\"Country\", \"Switzerland\"]", "country"])["BorderingCountries"],"Flag"]

Sometimes you’ll want to talk about a class of entities—like, say, planets.

LinguisticAssistant

Classes of entities are indicated by . You can get a list of all entities in a class using EntityList.

EntityList[(EntityClass["planets", EntityClass["Planet",All], "EntityClass[\"Planet\", All]", "planets"])]

EntityValue[(EntityClass["planets", EntityClass["Planet",All], "EntityClass[\"Planet\", All]", "planets"]),"Image"]

EntityValue can actually handle entity classes directly, so you don’t need to use EntityList with it.

BarChart[EntityValue[(EntityClass["planets", EntityClass["Planet",All], "EntityClass[\"Planet\", All]", "planets"]),"Radius"]]

It’s very convenient to use plain English to describe things. But a downside is that it can be ambiguous. If you say “mercury”, do you mean the planet Mercury or the chemical element mercury or something else called “mercury”? When you use (Key1[ctrl, =]), it’ll always make an initial choice. But if you press the  you can change to another choice. Press the check mark  to accept a choice.

LinguisticAssistant

To see how the Wolfram Language internally represents entities you can use InputForm.

InputForm[LinguisticAssistant]

InputForm[LinguisticAssistant]

There are millions of entities in the Wolfram Language, each with a definite internal form. In principle you could enter any entity using its internal form. But unless you’re using the same entity over and over again, it’s much more practical just to use (Key1[ctrl, =]) and enter a name for the entity in plain English.

There are thousands of different types of entities in the Wolfram Language, covering all sorts of areas of knowledge. To find out about them, check out the Wolfram Language documentation, or the Wolfram|Alpha examples pages. Each type of entity then has a list of properties—often hundreds of them. One way to find this list is to use EntityProperties.

EntityProperties["AmusementPark"]

In practice, though, a good approach is to ask in plain English for a property of some entity, then to look at the interpretation that’s found, and re-use the property from it.

LinguisticAssistant

LinguisticAssistant

(Entity["Great Pyramid of Giza", Entity["Building","GreatPyramidOfGiza::jbm66"], "Entity[\"Building\", \"GreatPyramidOfGiza::jbm66\"]", "building"])["Height"]

Different types of entities have different properties. One common property for many types of entities is "Image".

(Entity["koala", Entity["Species","Species:PhascolarctosCinereus"], "Entity[\"Species\", \"Species:PhascolarctosCinereus\"]", "species specification"])["Image"]

(Entity["Eiffel Tower", Entity["Building","EiffelTower::5h9w8"], "Entity[\"Building\", \"EiffelTower::5h9w8\"]", "building"])["Image"]

(Entity["The Starry Night", Entity["Artwork","TheStarryNight::VincentVanGogh"], "Entity[\"Artwork\", \"TheStarryNight::VincentVanGogh\"]", "artwork"])["Image"]

(Entity["Stephen Wolfram", Entity["Person","StephenWolfram::j276d"], "Entity[\"Person\", \"StephenWolfram::j276d\"]", "person"])["Image"]

Other types of objects have other properties.

(Entity["caffeine", Entity["Chemical","Caffeine"], "Entity[\"Chemical\", \"Caffeine\"]", "chemical"])["MoleculePlot"]

(Entity["skull", Entity["AnatomicalStructure","Skull"], "Entity[\"AnatomicalStructure\", \"Skull\"]", "anatomical structure"])["Graphics3D"]

(Entity["rhombic hexecontahedron", Entity["Polyhedron","RhombicHexecontahedron"], "Entity[\"Polyhedron\", \"RhombicHexecontahedron\"]", "polyhedron"])["NetImage"]

Find the flag of Switzerland. »

Get an image of an elephant. »

Use the "Mass" property to generate a list of the masses of the planets. »

Make a bar chart of the masses of the planets. »

Make an image collage of images of the planets. »

Edge detect the flag of China. »

Find the height of the Empire State Building. »

Compute the height of the Empire State Building divided by the height of the Great Pyramid. »

Compute the elevation of Mount Everest divided by the height of the Empire State Building. »

Find the dominant colors in the painting The Starry Night. »

Find the dominant colors in an image collage of the flag images of all countries in Europe. »

Make a pie chart of the GDP of countries in Europe. »

Add an image of a koala to an image of the Australian flag. »

Make an image collage of the flags of all countries in Europe, using the "FlagImage" property. »

Edge detect an image of the painting The Starry Night. »

Color negate the Mona Lisa painting. »

Where does the Wolfram Language get its real-world data?

It’s all from the central Wolfram Knowledgebase. We’ve been building this knowledgebase for many years, carefully curating data from thousands of primary sources.

Is the data in the Wolfram Language regularly updated?

Yes. We put a lot of effort into keeping it all up to date. And in fact there’s new data flowing in every second—about market prices, weather, earthquakes, aircraft positions and lots more.

How accurate is the data in the Wolfram Language?

We go to a lot of trouble to make it as accurate as possible, and we check it extensively. But ultimately we often have to rely on what governments and other outside organizations report.

What is the relation to Wolfram|Alpha?

Wolfram|Alpha uses the same knowledgebase as the Wolfram Language.

How should I refer to a particular entity?

However you want to. The Wolfram Language is set up to understand all common ways to refer to entities. (“New York City”, “NYC”, “the big apple”, etc., all work.)

How can I find all properties and values for a given entity?

Use entity["Dataset"] or entity["PropertyAssociation"].

What does it mean if EntityValue gives Missing[...]?

It means the value you’ve asked for isn’t known, or at least isn’t in the Wolfram Knowledgebase. Use DeleteMissing to delete Missing[...] elements in a list.

Can I set up my own entities, and put in my own data about them?

Yes, using EntityStore.

Tech Notes