Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -532,8 +532,21 @@ generate-asciidoc-glossary:
OUTPUT_FOLDER_PATH=${OUTPUT_FOLDER_PATH} ; \
MODEL_DATA_JSON_PATH=$$(find "${OUTPUT_FOLDER_PATH}" -maxdepth 1 -name '*_respec.json' | head -n 1); \
GEN_MODEL_DATA_JSON=1; \
else \
echo "Creating temporary copy of existing model data JSON..."; \
tmp_file=$$(mktemp --suffix=".json"); \
cp "${MODEL_DATA_JSON_PATH}" "$$tmp_file"; \
MODEL_DATA_JSON_PATH="$$tmp_file"; \
fi; \
\
# generate a respec config JSON file \
echo "Generating a config JSON file ..."; \
$(MAKE) respec-cfg-json XMI_INPUT_FILE_PATH=${XMI_INPUT_FILE_PATH} OUTPUT_FOLDER_PATH=${OUTPUT_FOLDER_PATH} ; \
# merge the config and data JSON files into a single JSON file to be used \
# for generating the asciidoc document \
merged_json=$$(mktemp --suffix=".json"); \
$(JQ) -s 'reduce .[] as $$item ({}; . * $$item)' ${MODEL_DATA_JSON_PATH} ${RESPEC_CFG_JSON_PATH} > $$merged_json; \
\
## get value of a config parameter from the correct XSL config file \
generate_reused_concepts=$$( \
printf '%s\n' \
Expand All @@ -555,7 +568,7 @@ generate-asciidoc-glossary:
\
## run jinja to generate the respec document \
source model2owl-venv/bin/activate; \
jinja -d ${MODEL_DATA_JSON_PATH} \
jinja -d $$merged_json \
-D generate_reused_concepts $$generate_reused_concepts \
glossary-resources/asciidoc-glossary.j2 \
-o ${OUTPUT_GLOSSARY_PATH}/${XMI_INPUT_FILENAME_WITHOUT_EXTENSION}_glossary.adoc ; \
Expand Down
39 changes: 30 additions & 9 deletions glossary-resources/asciidoc-glossary.j2
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,26 @@ tables covering classes, datatype properties (attributes) and object properties


{# build helper structure for properties #}
{# Step 1: collect all properties in a flat list #}
{#- Step 1: collect properties that are not filtered out by status in a flat list -#}
{%- set all_props = [] -%}
{%- for cls in classes -%}
{%- for prop in cls.properties -%}
{%- set _ = all_props.append(prop) -%}
{%- endfor -%}
{%- set effective_cls_status =
cls.tags[config.statusProperty]
if config.statusProperty in cls.tags
else config.unspecifiedStatusInterpretation
-%}
{%- if effective_cls_status not in config.excludedElementStatusesList -%}
{%- for prop in cls.properties -%}
{%- set effective_prop_status =
prop.tags[config.statusProperty]
if config.statusProperty in prop.tags
else config.unspecifiedStatusInterpretation
-%}
{%- if effective_prop_status not in config.excludedElementStatusesList -%}
{%- set _ = all_props.append(prop) -%}
{%- endif -%}
{%- endfor -%}
{%- endif -%}
{%- endfor -%}
{# Step 2: get unique property names #}
{%- set prop_names = [] -%}
Expand Down Expand Up @@ -96,11 +110,18 @@ tables covering classes, datatype properties (attributes) and object properties
|===
| Class name | Definition
{% for cls in classes %}
{% if generate_reused_concepts_ or cls.rawTags['class-usage-scope'] == "main" %}
{% if cls.classType == "definition" %}
| {{ cls.name }} | {{ passthrough_if_external_concept(cls.description.en) }}
{% endif %}
{% endif %}
{%- set effective_elem_status =
cls.tags[config.statusProperty]
if config.statusProperty in cls.tags
else config.unspecifiedStatusInterpretation
-%}
{%- if effective_elem_status not in config.excludedElementStatusesList -%}
{% if generate_reused_concepts_ or cls.rawTags['class-usage-scope'] == "main" %}
{% if cls.classType == "definition" %}
| {{ cls.name }} | {{ passthrough_if_external_concept(cls.description.en) }}
{% endif %}
{% endif %}
{%- endif -%}
{% endfor %}
|===

Expand Down
5 changes: 4 additions & 1 deletion src/rspec-cfg-json-generate.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@
'classReferenceRespecLabel': string($classReferenceRespecLabel),
'showReferencesInRespec': boolean($showReferencesInRespec),
'mandatoryStatusTagName': string($mandatoryStatusTagName),
'usageNoteTagName': string($usageNoteTagName)
'usageNoteTagName': string($usageNoteTagName),
'statusProperty': string($statusProperty),
'unspecifiedStatusInterpretation': string($unspecifiedStatusInterpretation),
'excludedElementStatusesList': array { $excludedElementStatusesList }
}
}"/>

Expand Down