# Lesson 11: Advanced modeling

## [](#_using_dependent_types)[Using dependent types](../11.1-using-dependent-types/index.md)

*   Entity and relation types can be treated as implementations of **object types** with a zero or non-zero number of **dependencies** respectively.
    
*   In the **entity-centric framework** of the PERA model, application classes are represented by entity types, and references between classes are represented by relation types.
    
*   In the **type-theoretic framework** of the PERA model, application classes are represented by object types, and references between classes are represented by interface types.
    
*   Entity types are used to represent application types composed only of primitive types. Relation types are used to represent application types composed of both primitive and composite types.
    

 

OOP

PERA

**Primitive type**

**Attribute type**

**Composite type**  
(of primitive types only)

**Object type**  
(entity type)

**Composite type**  
(of primitive and composites types)

**Object type**  
(relation type)

**Reference**  
(to primitive type)

**Interface type**  
(ownership type)

**Reference**  
(to composite type)

**Interface type**  
(role type)

## [](#_using_type_theoretic_relations)[Using type theoretic relations](../11.2-using-type-theoretic-relations/index.md)

*   A database type hierarchy can be used to represent an application class hierarchy, with interfaces and their implementations applied at different levels to represent the capabilities of the constituent classes.
    
*   When representing a common capability across different relation types in the type-theoretic PERA framework, the roles representing the capability should have the same name.
    
*   The PERA model does not permit the mixing of entity and relation types into a single hierarchy. If an application class hierarchy includes some classes composed only of primitives and some composed of primitives and composites, then a suitable workaround must be selected to model it.
    

## [](#_reifying_interfaces)[Reifying interfaces](../11.3-reifying-interfaces/index.md)

*   **Reification** is the process of replacing a role type with a relation type. A type-theoretic data model can be transformed into an entity-centric one by reifying any nested relations.
    
*   **De-reification** is the process of replacing a relation type with a role type. An entity-centric data model can be transformed into a type-theoretic one by de-reifying any binary relation types.
    
*   While **nested relations** should be avoided in the entity-centric PERA framework, they are a common feature in the type-theoretic PERA framework.
    
*   Interface implementations can be freely relocated between two object types that have a [one-to-one mapping](https://en.wikipedia.org/wiki/Bijection). A binary relation type can be losslessly de-reified by first relocating interface implementations it has (if any) to a roleplayer with which it has a one-to-one mapping.
    
*   A binary relation type cannot be losslessly de-reified if it implements interface types and does not have one-to-one mapping to any of its role players. Similarly, a hierarchy of binary relation types cannot be losslessly de-reified.
    

## [](#_further_learning)Further learning

[Lecture: The polymorphic data model with types](https://typedb.com/lectures/polymorphic-data-model)

Learn about the conceptual PERA model that backs TypeDB, and how it subsumes and surpasses previous database models.

[Lecture: The unifying foundation for databases](https://typedb.com/lectures/type-theory)

Learn about the unification of paradigms backed by modern type-theoretic mathematics, laying a novel foundation for modern databases.

[Paper: TypeQL formalism](https://typedb.com/papers/typeql-theory)

Read the preprint of the paradigm-defining paper behind TypeQL, due to be published in Proceedings of the ACM on Management of Data.

[Reifying interfaces](../11.3-reifying-interfaces/index.md)

[Edit on GitHub](https://github.com/typedb/typedb-docs/edit/3.x-development/academy/modules/ROOT/pages/11-advanced-modeling/summary.adoc) Edit this page on GitHub.