An Elementary Introduction to the Wolfram Language
16RealWorld Data
Click for copyable input
Enter the plain English united states:
Click for copyable input
Click for copyable input
Press the check mark to confirm thats what you want:
Click for copyable input
Ask for the flag property of the United States:
In[1]:=
Click for copyable input
Out[1]=
The result you get is something you can go on doing computation withlike in this case image processing.
Color-negate the US flag:
In[2]:=
Click for copyable input
Out[2]=
If all you want to do is to get the US flag, you can just ask for it in English.
In[3]:=
Click for copyable input
Out[3]=
EntityValue is a more flexible way to ask for the values of properties.
Use EntityValue to get the US flag:
In[4]:=
Click for copyable input
Out[4]=
EntityValue also works with lists of entities.
Get flags for a list of countries:
In[5]:=
Click for copyable input
Out[5]=
The Wolfram Language has deep knowledge about countries, as about many other things.
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=
Find their flags:
In[9]:=
Click for copyable input
Out[9]=
Ask for planets, and get the class of entities corresponding to planets:
In[10]:=
Click for copyable input
Out[10]=
Get the list of planets:
In[11]:=
Click for copyable input
Out[11]=
In[12]:=
Click for copyable input
Out[12]=
EntityValue can actually handle entity classes directly, so you dont need to use EntityList with it.
In[13]:=
Click for copyable input
Out[13]=
Click for copyable input
Click for copyable input
Show the internal form of the entity that represents the United States:
In[14]:=
Click for copyable input
Out[14]=
In[15]:=
Click for copyable input
Out[15]=
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 youre using the same entity over and over again, its much more practical just to use ctrl+= and enter a name for the entity in plain English.
In[16]:=
Click for copyable input
Out[16]=
In practice, though, a good approach is to ask in plain English for a property of some entity, then to look at the interpretation thats found, and re-use the property from it.
Click for copyable input
In[17]:=
Click for copyable input
Out[17]=
In[18]:=
Click for copyable input
Out[18]=
Different types of entities have different properties. One common property for many types of entities is "Image".
In[19]:=
Click for copyable input
Out[19]=
In[20]:=
Click for copyable input
Out[20]=
In[21]:=
Click for copyable input
Out[21]=
In[22]:=
Click for copyable input
Out[22]=
Other types of objects have other properties.
In[23]:=
Click for copyable input
Out[23]=
In[24]:=
Click for copyable input
Out[24]=
In[25]:=
Click for copyable input
Out[25]=
ctrl+= plain English input
EntityList[class] entities in a class
EntityValue[entities,property] value of a property of an entity
EntityProperties[type] list of properties for an entity type
InputForm[entity] internal Wolfram Language representation of an entity
16.1Find the flag of Switzerland. »
Expected output:
Out[]=
16.2Get an image of an elephant. »
Sample expected output:
Out[]=
16.3Use the "Mass" property to generate a list of the masses of the planets. »
Expected output:
Out[]=
16.4Make a bar chart of the masses of the planets. »
Expected output:
Out[]=
16.5Make an image collage of images of the planets. »
Expected output:
Out[]=
16.6Edge detect the flag of China. »
Expected output:
Out[]=
16.7Find the height of the Empire State Building. »
Expected output:
Out[]=
16.8Compute the height of the Empire State Building divided by the height of the Great Pyramid. »
Expected output:
Out[]=
16.9Compute the elevation of Mount Everest divided by the height of the Empire State Building. »
Expected output:
Out[]=
16.10Find the dominant colors in the painting The Starry Night»
Expected output:
Out[]=
16.11Find the dominant colors in an image collage of the flag images of all countries in Europe. »
Expected output:
Out[]=
16.12Make a pie chart of the GDP of countries in Europe. »
Sample expected output:
Out[]=
Sample expected output:
Out[]=
+16.1Make an image collage of the flags of all countries in Europe, using the "FlagImage" property. »
Sample expected output:
Out[]=
+16.2Edge detect an image of the painting The Starry Night»
Expected output:
Out[]=
+16.3Color negate the Mona Lisa painting. »
Expected output:
Out[]=
Where does the Wolfram Language get its real-world data?
Its all from the central Wolfram Knowledgebase. Weve been building this knowledgebase for many years, carefully curating data from thousands of primary sources.
Is the data in the Wolfram Language regularly updated?
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.
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"].
It means the value youve asked for isnt known, or at least isnt in the Wolfram Knowledgebase. Use DeleteMissing to delete Missing[...] elements in a list.
 
Download Notebook Version