1. Knowledge Base
  2. Semantic Data Modelling

What traits (subdocuments) are and how to leverage them

Traits are composable multi-property data structures with multiplicity and cardinalities, reusable across your data model.

When you're challenged with messy data and a complex taxonomy, you might want to leverage reusable data structures. Don't worry, traits are here to help you do exactly that! The video below explains why traits (TerminusDB subdocuments) are important, what they are, and how to use them effectively.

HubSpot Video

In just over 2 minutes, you'll get to know how to leverage reusable multi-property data structures in JSON-LD documents with real-life examples. From flying capabilities of birds (sorry, penguins!) and airplanes; to creating reusable flexible postal address data structures for websites and logistics data. 

One of the challenges you might face when building your data taxonomy is property inheritance. DFRNT allows you to model your data structures separately and reuse them as properties for different types.

It's like using composable data structures in modern programming languages like Rust, but you don't need to be a programmer or a semantic data engineer to leverage them. To recap, the DFRNT "traits" are known as subdocuments in the TerminusDB data products.

The video also shows how you can add cardinalities and multiplicity constraints to your properties for even more flexibility.