Defining custom semantic types
You may find that the semantic types supplied do not contain a semantic type that is appropriate for your data. In this case, you can define custom entity, link, and property semantic types.
About this task
When you define a semantic type, it inherits some of the properties of the parent, but not its name or synonyms.
Never define a custom semantic type when the Semantic Type Library in use at your site already contains an appropriate semantic type. If you do, you will end up with duplicate types (such as Football Match, Football Match_001, Football Match_002) and the information retrieved from your database cannot be aligned with information retrieved from other data sources that has the correct semantic type assigned. This will limit your users' ability to analyze data from different sources.
A custom semantic type has a globally unique, internal identifier which is derived from the database in which it is created. Therefore an entity semantic type called Football Match created in one database is distinct from an entity semantic type of the same name created in a different database. To avoid the problems that this will cause, make sure to share the custom semantic types with other users in your organization.
In order to avoid the creation of duplicates, you should do only create custom semantic types in the database that holds the Semantic Type Library for your organization.
- When to define custom semantic types
-
You may decide to define custom semantic types for a variety of reasons.
For example, consider if your data contains different kinds of sporting events. The Semantic Type Library contains an Event entity semantic type, but it does not contain entity semantic types for distinguishing between different kinds of sporting events. To ensure that appropriate semantic types for sporting events are added to your Semantic Type Library, you must define custom semantic types that are derived from the Event entity semantic type.
If it is not necessary to distinguish between different specializations of an entity, then you can simply assign the appropriate generalized entity semantic type to your data. For example, suppose your data contains a list of people who have attended an annual convention. The library does not contain a Convention entity semantic type, but you can assign the Event entity semantic type to your Convention data field because your data contains records for only one kind of event.
You may want to define a custom property semantic type if you want to assign multiple values for the same property to a single entity or link. For example, suppose your database contains a list of a person's bank account numbers, and you have decided to represent each bank account as a field on the entity type, rather than use bank account entities with links to the person that owns them. Since a property semantic type can only be added once to each entity semantic type or link semantic type in a Semantic Type Library, you can create specializations of the Account Number property semantic type so that each occurrence has a unique property semantic type assignment.
- Deriving the custom semantic type from the correct parent
- Choosing the correct semantic type to derive your new custom semantic type from is a critical decision because the custom semantic type inherits characteristics and behaviors from its parent. In the sporting event example (given above in When to define custom semantic types), it would be inappropriate to derive the custom semantic types from the Document entity semantic type, for example, because a sporting event is not a special type of document.
- Sharing and reusing custom semantic types
- If others in your organization are also assigning semantic types to data, you should share your
custom semantic types so that all databases use the same Semantic Type Library. If two people define
custom semantic types of the same name, they are not identical because the semantic type name does
not uniquely identify the semantic type— its unique identity is determined by the database in which
it is created.
For more information about duplicate names and sharing your custom semantic types with others, see Maintaining the semantic type library.
- Backing up the Semantic Type Library
- After adding custom semantic types to your library, save them to file so that you can:
- Distribute the new semantic types to others in your organization.
- Restore deleted custom types (you cannot recreate custom semantic types by adding a new one of the same name).
To do this, click Save in the Semantic Types dialog. The Semantic Type Library is saved in a file with an .mtc file extension. For further information, see Maintaining the semantic type library.