{% if diagram_type == "er_diagram" %}
```{{ gen.mermaid_directive() }}
{{ gen.mermaid_diagram([element.name]) }}
```
{% else %}
{% if schemaview.class_parents(element.name) and schemaview.class_children(element.name) %}
```{{ gen.mermaid_directive() }}
 classDiagram
    class {{ gen.name(element) }}
      {% for s in schemaview.class_parents(element.name)|sort(attribute='name') -%}
        {{ gen.name(schemaview.get_element(s)) }} <|-- {{ gen.name(element) }}
      {% endfor %}

      {% for s in schemaview.class_children(element.name)|sort(attribute='name') -%}
        {{ gen.name(element) }} <|-- {{ gen.name(schemaview.get_element(s)) }}
      {% endfor %}
      
      {% for s in schemaview.class_induced_slots(element.name)|sort(attribute='name') -%}
        {{ gen.name(element) }} : {{gen.name(s)}}
        {% if s.range not in gen.all_type_object_names() %}
          {{ gen.name(element) }} ..> {{ s.range }} : {{ gen.name(s) }}
        {% endif %}
      {% endfor %}
```
{% elif schemaview.class_parents(element.name) %}
```{{ gen.mermaid_directive() }}
 classDiagram
    class {{ gen.name(element) }}
      {% for s in schemaview.class_parents(element.name)|sort(attribute='name') -%}
        {{ gen.name(schemaview.get_element(s)) }} <|-- {{ gen.name(element) }}
      {% endfor %}
      {% for s in schemaview.class_induced_slots(element.name)|sort(attribute='name') -%}
        {{ gen.name(element) }} : {{gen.name(s)}}
        {% if s.range not in gen.all_type_object_names() %}
          {{ gen.name(element) }} ..> {{ s.range }} : {{ gen.name(s) }}
        {% endif %}
      {% endfor %}
```
{% elif schemaview.class_children(element.name)  %}
```{{ gen.mermaid_directive() }}
 classDiagram
    class {{ gen.name(element) }}
      {% for s in schemaview.class_children(element.name)|sort(attribute='name') -%}
        {{ gen.name(element) }} <|-- {{ gen.name(schemaview.get_element(s)) }}
      {% endfor %}
      {% for s in schemaview.class_induced_slots(element.name)|sort(attribute='name') -%}
        {{ gen.name(element) }} : {{gen.name(s)}}
        {% if s.range not in gen.all_type_object_names() %}
          {{ gen.name(element) }} ..> {{ s.range }} : {{ gen.name(s) }}
        {% endif %}
      {% endfor %}
```
{% else %}
```{{ gen.mermaid_directive() }}
 classDiagram
    class {{ gen.name(element) }}
      {% for s in schemaview.class_induced_slots(element.name)|sort(attribute='name') -%}
        {{ gen.name(element) }} : {{gen.name(s)}}
        {% if s.range not in gen.all_type_object_names() %}
          {{ gen.name(element) }} ..> {{ s.range }} : {{ gen.name(s) }}
        {% endif %}
      {% endfor %}
```
{% endif %}
{% endif %}