10
$\begingroup$

What procedures are there to find entities ? I understand little about entities. I use free form input or wolfram alpha as a cry for help. What systematic procedures are there for narrowing down a search ? Maybe some sort of iterative procedure starting from big classes and then narrowing down the search ? I wish I could assist the free form syntax in figuring out what I want by figuring out part of the query manually/interactively.

Examples (I don't actually need them at the moment):

  • I want an image of a giraffe

  • I want the list of countries in the pacific ocean

  • I want a list of approximations of Bessel functions

  • common words in a specific language

$\endgroup$
0

2 Answers 2

8
$\begingroup$

Edits: cleaning and added a function under the EntityClassList section to search for classes.


I will add stuff here as I learn to use entities.

Outline

  • Practical theoretical guide to the structure of entities

  • Practical stuff for searching that requires minimal understanding of entities

Practical theoretical guide to entities

Again, I am still learning so it will be basic.

The entity framework seems to follow a hierarchy. The following lists layers of decreasing levels of abstraction. That is, the list starts with broad categories and ends with more concrete objects.

  • Entity types

There are many entity types that encompass broad categories.

Examples :

  • Country

  • ExoPlanet

  • Movie

  • Chemical

For more examples there is the guide of entity types in the documentation with a categorized list of types. One may also just type Entity[" or EntityClassList[" or EntityClass[" and a list of entity types will appear as suggestions.

As an example, consider the type : "Chemical"

  • EntityClassList

Next we type :

EntityClassList["Chemical"]

A list of entity classes appear. Each class is an abstract object that represents a category or set of entities. For the chemical type here is an extract:

  • alloys

  • acids

  • amino acids

Notice these are still broad terms. No H2O or Zinc or anything specific. Just groups that can contain other stuff.

  • EntityClass

Edit

To search in an entity class list one may use the function below:

Note: ⎵=\[UnderBracket]

search⎵type[type_, query_] := 
 Quiet@Cases[EntityClassList[type], 
   EntityClass[type, _?(StringMatchQ[#, "*" <> query <> "*"] &)]]

Example:

search⎵type["MathematicalFunction", "Int"]

enter image description here


Ok let's pick an entity class:

"alloys"

or in the wolfram syntax:

EntityClass["Chemical", "Alloys"]

which appears as

enter image description here

that one reads as the alloys class with type chemicals

  • EntityList

Ok so what is in the alloys entity class ?

EntityList[EntityClass["Chemical", "Alloys"]] (* looks nicer in a notebook *)

Output:

enter image description here

Each element of that list is an entity. The resource function EntityToolTip allows one to see information about each entity by hovering (it does not seem to work on entity classes). Maybe see also InformationPopup but I only recently saw that and have not yet tried it.

  • Entity

Finally we reached to the main object of interest. I am a beginner so I am not sure what all we can do with these objects. What you can do is use ??entity, entity["Properties"] and EntityValue[entity,"Dataset"] to gain information from an entity.

example:

enter image description here

enter image description here

enter image description here

Practical stuff that require minimal understanding of entities

Free form syntax and wolfram alpha are your friends and seem to be recommended in the documentation for entities even to search for a specific entity. I am not an expert on free form syntax but it often works well with entities when asking simple direct requests. The sections that follow are in the event that:

  • We do not know what we want yet, just strolling/ window shopping

  • We are lost with too many entities or possible interpretations

  • What we want is long, complex and specific and free form syntax, wolfram alpha and the wolfram data repository did not work.

List all possibly related interpretations

SemanticInterpretation["thing you want to search for ", AmbiguityFunction -> All]

lists all possible interpretations of a string. However, the list of interpretations seem to be the same as in free form syntax (with three dots on the right when there are alternative interpretations). The documentation

also if in the middle of a search and you find an entity class object, you can list all of the entities it contains with EntityList.

Specification/Clarification

For clarifying what you want : ("I want the location of the eiffel tower")

 Interpreter["Location"]["eiffel tower"]

For the list of possible specifications of what we could mean see the documentation.

Filtering

For filtering entities: SemanticInterpretation and FilteredEntityClass. A quick introduction to FilteredEntityClass here

Quickly view the information content of an entity

EntityToolTip is a resource function that allows you to see information about an entity in a large list by just hovering (instead of having to evaluate ??entity in a separate cell for each entity).

The related resources suggestion InformationPopup might be a more general alternative as it displays information about a symbol by just selecting it also without having to evaluate ??symbol (I just saw it I have not tried it yet).

$\endgroup$
4
$\begingroup$

Plain language input works pretty well

enter image description here

For mathematical functions

Entity["MathematicalFunction", "BesselI"]["Dataset"] // Quiet

enter image description here

Don't know why the above is pink when pasted here. It is normal in the notebook.

For listed properties, use camel case with no spaces, e.g.,

Entity["MathematicalFunction", "BesselI"]["AsymptoticExpansions"] // 
  Column // TraditionalForm

enter image description here

$\endgroup$
1
  • $\begingroup$ Thank you. I think I read a post here some time ago that used Entity["MathematicalFunction"] but I could not remember the name and I could not find it with free form syntax (although I think i managed to get it before). Now I can just search here if I forget again thanks . $\endgroup$ Nov 21, 2022 at 19:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.