Skip to content

How to use Multi Typed Entities or MTEs

Thad Guidry edited this page Jul 16, 2018 · 17 revisions

Note: the topic of Multi Typed Entities (MTEs) routinely generates questions. We will continue to add information to this page as questions arise, or developments happen.

What are MTEs?

An MTE or Multi-Typed Entity is used when a single entity is defined by more than one type. That is, the data publisher can indicate two or more entity types to describe the entity. A simple non-working example would be classifying a Cat as a type of Pet and a Mammal. A working example would be a ComedyEvent that is broadcast and so is also a BroadcastEvent.

How do MTEs differ from multiple inheritance?

The data model of schema.org supports a multiple inheritance hierarchy where each type may be a sub-class of multiple types.

For example, the LocalBusiness entity type belongs to both the Place and Organization entity types. It inherits properties from both types.

MTEs extend the concept of multiple inheritance by allowing data publishers to specify more than one entity type.

When should you use MTEs?

Case 1: When there is an overlap in the types of entities involved

Example: A Book can also be a Product. Not every Book has an offer associated with it. But a Book that has an offer would be a Product as well. When the publisher needs to use properties associated with another schema.org entity type, they can use the MTE pattern.

Case 2: When you want to indicate more specialized types

Example: An Asiatic lion is a Thing, but also an animal. However, schema.org doesn't have a distinct entity type for animals. To indicate that an Asiatic lion is a type of animal, it is necessary to use another vocabulary, such as Wikidata. The online publisher can indicate that the entity is Thing in schema.org with a property of "name": "Asiatic lion", and also indicate it is an type of animal or a type of lion using Wikidata or some other vocabulary.

How does one specify MTEs?

In many cases, specifying MTEs is straightforward. Instead of listing just one entity type, the data publisher lists two or more. They can then use properties from any of the properties listed. The schema.org official documentation provides an extensive example of MTEs for Hotels.

How MTEs are specified varies according to the syntax used.

There are 2 forms that an MTE can have, either internal or external.

Internal MTE

An example of an internal MTE would be using multiple Schema.org Types designated with @type In JSON-LD, create an array and list the Types in the array:

"@context": "http://schema.org/",
"@type": ["HotelRoom","Product"]

External MTE

An example of an external MTE would be using the property additionalType.

For example, to indicate in JSON-LD that a Product is also sushi using Wikidata with 3 additional types:

{ 
    "@context":"http://schema.org",
    "@type":"Product",
    "name":"Sushi",
    "additionalType":["https://www.wikidata.org/wiki/Q192935","https://www.wikidata.org/wiki/Q46383","https://www.wikidata.org/wiki/Q44480854"],
    "url":"https://www.pfchangs.com/menu/main/sushi",
    "brand":{
      "@id":"https://www.pfchangs.com",
      "@type":"Organization",
      "name":"P.F. Chang's"
      }
    }

In RDFa, include the types in the typeof property :

<div vocab="http://schema.org/" typeof="HotelRoom Product">

In Microdata, the types are indicated with URLs separated by a space and listed within the itemtype property:

<div itemscope itemtype="http://schema.org/HotelRoom http://schema.org/Product">

Microdata also provides a special property called additionalType to specify additional types. Its use is optional.

Are there other ways to indicate MTEs?

Yes, but they can be more complex. When more than one entity type occurs, they can sometimes cross-reference one another. Data publishers can use IDs to accommodate such cross-references. An example of how to use IDs is provided in an example of a LocalBusiness.

  • In microdata, by using the itemid property
  • In RDFa, by using the resource property
  • In JSON-LD, by using "@id"

Are there any problems with using MTEs?

Some tools will not validate MTE data properly, but your schema might be perfectly valid and acceptable by data consumers. MTEs do introduce some parsing complexity that some tools don't yet support. Microdata support for MTEs is considered improper for various reasons.

The use of vocabularies other than Schema.org in MTEs may not be recognized by some tools.

Currently, MTEs expressed in JSON-LD seem to enjoy widest support.

As a general rule, only use an MTE when you need to describe properties of different entity types together.

I don't know which entity type is best to use to describe an event, which could be classified more than one way. Should I include all of them?

Incorrectly adding extra Types that are not applicable to the data will cause consumers to typically consider your data as providing lower quality. "not a good thing". So its better to avoid spamming MTE's since it hurts everyone rather than helping. For example, avoid adding a Festival Type to an Event Type when you are not sure it was a Festival or not, but sure that it was an Event. Ask on our mailing list when you have questions like this.

Be careful where/when you need to use the MTE pattern. For instance, instead of saying an Event is also a type of Opera, you might not want to say the Event itself is an opera, but instead that an Opera is being shown at the Event gathering itself. Its fine to do either usually, but think about the data you have or what you want to say or present to data consumers does need some thought. You can always ask others what they think on our Schema.org mailing list!

An alternative way to handle classifying is actually through more use of Properties, rather than classifying with more Types, for instance, saying the performance at an Event is a type of genre by using the Property workPerformed , rather than multi-typing the Event with "MusicEvent" or "http://vocab.getty.edu/aat/300054147", you can just say the performance is an Opera genre, like so:

{ 
  "@context":"http://schema.org", 
  "@type":"BroadcastEvent", 
  "url":"https://www.example.com/Opera/2018-7-12/The_Magic_Flute",
  "isLiveBroadcast":"True",
  "videoFormat":"HD",
  "broadcastOfEvent":{
    "@type":"Event",
    "name":"The Magic Flute @ The MET",
    "about":"https://en.wikipedia.org/wiki/The_Magic_Flute",
    "startDate":"2018-07-12",
    "location":"The Metropolitan Opera, Broadway, New York"
    },
  "workPerformed":{
    "@type":"CreativeWork",
    "name":"The Magic Flute",
    "genre":["https://www.wikidata.org/wiki/Q1344", "http://vocab.getty.edu/aat/300054147"],
    "sameAs":"https://en.wikipedia.org/wiki/The_Magic_Flute"
    }
}

or you can go the simple route and just use "about", but WARNING, the context might not always be completely understood by machines or data consuming parsers:

{ 
  "@context":"http://schema.org", 
  "@type":"Event",
  "name":"The Magic Flute @ The MET",
  "about":"https://en.wikipedia.org/wiki/The_Magic_Flute",
  "startDate":"2018-07-12",
  "location":"The Metropolitan Opera, Broadway, New York"
}

Is the above some kind of Event about "The Magic Flute", or is "The Magic Flute" Opera being performed at The Met ?

It kinda hard to tell now, since we used a simple form, giving much less information to consumers.

The more you can say, the better others will understand

The Hotel example uses the Product entity type, not the Offer type. Why?

...(Answer pending)

You can’t perform that action at this time.