Message Boards Message Boards


Entities and Knowledge Representation

Posted 9 years ago
8 Replies
1 Total Likes

I'm trying to understand Wolfram's knowledge representation capabilities. I know that Wolfram has numerous kinds of builtin "Entities". I've read all that I can find about these, and end up with numerous questions:

  1. As far as I can tell, one can create a new entity via the "ToEntity" function. But the "scope" of this function is listed as "Character", "Color", and "Graph". Does that mean that you cannot create entities of other types in the Wolfram language?
  2. The documentation of the "EntityClassList" function seems to distinguish between "class" and "type": "Find all entity classes for different entity types". I can't find anything that explains this distinction. Is "type" just the name of a "class"?
  3. Is it possible to create new entity classes/types? I don't see a function for that.
  4. How does one build an Interpreter for a (new) Entity type?
POSTED BY: Mark Linehan
8 Replies

Within the Wolfram Language facilities, what is the best alternative to creating one's own interactive data base of knowledge on some subject?

That's a very large question. If you can provide more specifics, that would help. I would again ask that you post this as a new question. It is in a sense most certainly related to this one, but you'd be better served by new thread and it would help keep this thread on focused on the original topic should more questions arise about using the Entity framework, esp with respect to finding Entities. This thread has already addressed many topics as it is and your question is a very broad one.

"Interactive Base of Knowledge" is a very vague term that could mean lots of things. Are you looking to make a framework that's like parts of the Entity Framework? If so which parts? It's a very large framework. You of course have to pay attention to how you structure the relationships between kinds of objects.

Any symbolic program is an interactive base of knowledge about the symbols it uses. The key of course is how to best structure these programs. That depends very heavily on what you want to do. Having a small and specific case will help someone answer your question.

POSTED BY: Sean Clarke

Sean Clarke - Well, in my first reply I did give an example of the type of things I might want to do. But I'll try to start a separate discussion.

Sean Clarke - I rather think my question does belong here. My question was not specifically about differential geometry, it was about how one could best construct an interactive data base centered around some specific subject. Mark Linehan was asking about "Knowledge Representation" and this is in the "Wolfram Language" Group. He wanted to approach it using Entities but the answer seems to be that Entities can only be consumed by users and not created by users. So then, my question is: Within the Wolfram Language facilities, what is the best alternative to creating one's own interactive data base of knowledge on some subject?

David J M Park Jr - This is a thread about discovering new entities in the Wolfram Entity Framework. Your question is a more general programming question, and you would probably get the best answer by posting it as a separate thread so that people who do differential geometry with Mathematica will be able to find it. Please post this as a new thread.

Mark Linehan - Sorry about the wait. I thought I had posted a response on Friday.

You don't really add entities onto the entity framework. You could create your own framework of course and use it side-by-side with the existing one.

No, EntityClasses are not like a subtype of a type. They are really nothing more than a list of entities. I think you might be trying to think of the entity framework like it was a type system or a object hierarchy in OOP. The EntityClass for European countries is just a list of Countries that are all in Europe. In most uses of the word "Subtype", if A is a Subtype of B, then you can use A wherever you'd use B. That's certainly not the case here. An Entity type is an abstract category, like a bridge or a person. An EntityClass is a list of entities of a certain type. They are fundamentally different kinds of objects.

"ctrl =" is meant to be useful in general. It's a natural language query tool. It won't be perfect."ctrl =" can return many different kinds of things - Not just Entities.

  • Portrait of Titus defaults to a query for the picture of the person named "Titus"
  • "Great Fish Market" returns an Entity for "Great Fish Market". An Entity and the picture associated with an Entity are different things. The predictive interface (the grey bar appearing after your output), will show you different properties you can query from your Entity.
  • "The Bride" by default gives a movie and a couple of other options. No, the list of options is not exhaustive. It cannot be exhaustive over every possible interpretation of the word. You can use Interpreter or SemanticInterpretation to get an interpretation for "The Bride" that corresponds to an artwork like this:

    Interpreter["Artwork"]["The Bride"] Interpreter["ComputedArtwork"]["The Bride"] SemanticInterpretation["The Bride", Entity["Artwork", _]]

I am not familiar with the piece of art that this refers to. Searching online didn't make it clear either. So it's probably unlikely that the system will be able to infer it too.

POSTED BY: Sean Clarke

Let's pick an example that is closely aligned to mathematics.

Suppose I want to study some particular subject such as smooth manifold theory. I want to study it, work examples, do calculations, write tutorial notebooks. I would like to justify various steps by referring to various theorems, form various sources, that pertain to the subject . I would like to have a data set of the theorems and the ability to call up a display of particular theorems when writing didactic examples. The display might be in a separate window or embedded in a dynamic structure. I might even want to be able to substitute generic symbols in the theorem with specific symbols used in a particular example. Each theorem might refer to various concepts: open/closed sets, boundary, maps, differentials, etc. I would like to have the ability to easily add new concepts as the data set is developed. And finally the ability to search the data set for theorems that relate to specific concepts.

What would be the most appropriate Wolfram Language facilities to use for such a project?

This is a very helpful thread. Thank you.

POSTED BY: David Reiss
Posted 9 years ago

Thanks for the response. I think what I get from it is that the current knowledge representation framework (i.e. the "entity framework") is not extensible, either to create new Types or new instances (Entities). For example, there is an existing "Artwork" Type with many Entities, but there is no way to add another Artwork Entity. Much less a new Type, such as, say, "Event".

It sounds like "EntityClass" is what is usually called a "sub-type" of "Type". Is that right? Can "EntityClasses" be further categorized into other "EntityClasses". For example, I could imagine a Type "Event" that has classes such as "SportsEvent" and "MusicEvent", where "MusicEvent" has its own classes such as "RockMusicEvent" and "FolkMusicEvent" and "ClassicalMusicEvent". Does the design support that kind of thing (even if in practice you have to be "inside" to create a Type or an Class.)

When I do: "EntityValue["Artwork", "SampleEntities"]", I get a list of art works, include "The Bride". But when I do ctrl= and then enter "The Bride", it proposes "movie" and does not list "art work" as an alternative. If I do ctrl= and enter "Portrait of Titus", it replaces what I type with "EntityValue[Titus(person), image]" (I guess because it interprets the word "portrait"??). When I evaluate that, I get the image. If I do ctrl= and enter "Great Fish Market", it proposes "Great Fish Market (artwork)", which is what I expect. But if I evaluate the cell, I get just the "Great Fish Market" entity, rather than the image. Overall, the varying behavior is quite confusing. The ctrl= method does not appear to be a reliable way to identify Entities.

POSTED BY: Mark Linehan
  1. Ignore the existence of "ToEntity" for right now. It only handles a select class of objects. These are the objects which have concrete representations in Mathematica and in the entity framework, which is a tiny, tiny fraction of the total number of entities.
  • You can get Entities in many different ways. One way is through the curated lists of Entities called Entity Classes. See an explanation of them below.

  • You can also get specific Entities using "Ctrl" + "=" for free-form input. For example if I wanted Chicago as a City I would type:

"Ctrl" + "=" Followed by Chicago

If instead I wanted Chicago as a Movie, I click the ellipsis just to the right of the result and a menu with alternate interpretations appears. Movie is one of the options available.

  • You can use Interpreter:

  • You can use SemanticInterpretation:


    This gives the default interpretation for "Chicago" which is as a City. Instead you might as for every possible interpretation of Chicago:

    SemanticInterpretation["Chicago", AmbiguityFunction -> All]

  1. Types and Classes are different. A type is fundamental kind of a thing such as a "Country", or a "Movie", or a "Person". An Entity expression has two arguments. The first argument is a string of what type it is. The second argument is a string which uniquely identifies a specific instance of that type. For example the Entity expression for Elvis Presley is:

Entity["Person", "ElvisPresley::2kzg4"]

There could be multiple Elvis Presleys, so there's a unique tag added to the end of the second string. An EntityClass is a curated list of a specific kind of Entity. For example, EntityClass["Country", "Europe"] is a curated list of Entities of type "Country" that are located in Europe. And EntityClass can be turned into a list of Entities using EntityList. There is no Entity type specifically for countries in Europe. There is only a Entity type for countries in general. However there is an EntityClass which lists which countries are in Europe.

  1. Basically, No. The inner workings of entities are really complex and you don't want to have to reimplement all that. If you want to incorporate outside data sources, it's best to do so alongside the framework, not using it.

  2. You don't. You could write your own function to do the essentially the same thing but it wouldn't integrate with the entire framework.

POSTED BY: Sean Clarke
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract