-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsubset.md.jinja2
110 lines (83 loc) · 2.84 KB
/
subset.md.jinja2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!-- Jinja2 template based on https://github.com/linkml/linkml/blob/main/linkml/generators/docgen/subset.md.jinja2 -->
<!-- This file should be periodically checked against the original source -->
<!-- Last check 25 August 2023 -->
# Subset: {{ gen.name(element) }}
{%- if header -%}
{{ header }}
{%- endif -%}
{% if element.description %}
{% set element_description_lines = element.description.split('\n') %}
{% for element_description_line in element_description_lines %}
_{{ element_description_line }}_
{% endfor %}
{% endif %}
URI: {{ gen.uri_link(element) }}
{% include "common_metadata.md.jinja2" %}
{% set classes_in_subset = [] %}
{% set slots_in_subset = [] %}
{% set enums_in_subset = [] %}
{# Collect classes, slots, and enumerations in subset #}
{% for c in gen.all_class_objects()|sort(attribute=sort_by) %}
{%- if element.name in c.in_subset %}
{% set _ = classes_in_subset.append(c) %}
{%- endif %}
{% endfor %}
{% for s in gen.all_slot_objects()|sort(attribute=sort_by) %}
{%- if element.name in s.in_subset %}
{% set _ = slots_in_subset.append(s) %}
{%- endif %}
{% endfor %}
{% for e in schemaview.all_enums().values() %}
{%- if element.name in e.in_subset %}
{% set _ = enums_in_subset.append(e) %}
{%- endif %}
{% endfor %}
{% if classes_in_subset %}
## Classes in subset
| Class | Description |
| --- | --- |
{% for c in gen.all_class_objects()|sort(attribute=sort_by) -%}
{%- if element.name in c.in_subset -%}
| {{gen.link(c)}} | {{c.description|enshorten}} |
{% endif -%}
{% endfor %}
{% for c in gen.all_class_objects()|sort(attribute=sort_by) -%}
{%- if element.name in c.in_subset -%}
### {{ gen.name(c) }}
{{c.description}}
{%- set filtered_slots = [] -%}
{%- for s in induced_slots|sort(attribute=sort_by) -%}
{%- if element.name in s.in_subset or element.name in schemaview.get_slot(s.name).in_subset -%}
{% set _ = filtered_slots.append(s) %}
{%- endif -%}
{%- endfor %}
{%- if filtered_slots|length > 0 -%}
| Name | Cardinality and Range | Description |
| --- | --- | --- |
{% for s in filtered_slots -%}
| {{gen.link(s)}} | {{ gen.cardinality(s) }} <br/> {{gen.link(s.range)}} | {{s.description|enshorten}} {% if s.identifier %}**identifier**{% endif %} |
{% endfor %}
{%- endif %}
{%- endif %}
{% endfor %}
{%- endif %}
{% if slots_in_subset %}
## Properties in subset
| Property | Description |
| --- | --- |
{% for s in slots_in_subset|sort(attribute=sort_by) -%}
{%- if element.name in s.in_subset -%}
| {{ gen.link(s) }} | {{ s.description|enshorten }} |
{%- endif %}
{% endfor %}
{%- endif %}
{% if enums_in_subset %}
## Enumerations in subset
| Enumeration | Description |
| --- | --- |
{% for e in enums_in_subset|sort(attribute='name') -%}
{%- if element.name in e.in_subset %}
| {{ gen.link(e) }} | {{ e.description|enshorten }} |
{%- endif %}
{% endfor %}
{%- endif %}