@linked.archi/kernel 0.0.0-stage → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/NOTICE +11 -0
- package/README.md +96 -2
- package/assets/arch-decision/arch-decision-metamodel.ttl +44 -0
- package/assets/arch-decision/arch-decision-onto.ttl +1566 -0
- package/assets/arch-decision/arch-decision-shapes.ttl +582 -0
- package/assets/arch-decision/arch-decision-tax.ttl +129 -0
- package/assets/arch-processes/arch-processes-metamodel.ttl +42 -0
- package/assets/arch-processes/arch-processes-tax.ttl +136 -0
- package/assets/arch-processes/archProcesses-shapes.ttl +189 -0
- package/assets/arch-processes/archProcesses.ttl +953 -0
- package/assets/archimate3/archimate3.2-element-shapes.ttl +379 -0
- package/assets/archimate3/archimate3.2-metamodel.ttl +205 -0
- package/assets/archimate3/archimate3.2-notation.ttl +1503 -0
- package/assets/archimate3/archimate3.2-onto.ttl +1579 -0
- package/assets/archimate3/archimate3.2-presentation-contexts.ttl +90 -0
- package/assets/archimate3/archimate3.2-principle-shapes.ttl +923 -0
- package/assets/archimate3/archimate3.2-questions.ttl +1125 -0
- package/assets/archimate3/archimate3.2-reference-data.ttl +74 -0
- package/assets/archimate3/archimate3.2-relationship-shapes.ttl +30956 -0
- package/assets/archimate3/archimate3.2-relationship-tables.ttl +5992 -0
- package/assets/archimate3/archimate3.2-tax.ttl +724 -0
- package/assets/archimate3/archimate3.2-viewpoint-shapes.ttl +59 -0
- package/assets/archimate3/archimate3.2-viewpoints.ttl +793 -0
- package/assets/archimate3/icons/and-junction.svg +3 -0
- package/assets/archimate3/icons/application-collaboration.svg +22 -0
- package/assets/archimate3/icons/application-component.svg +18 -0
- package/assets/archimate3/icons/application-event.svg +15 -0
- package/assets/archimate3/icons/application-function.svg +14 -0
- package/assets/archimate3/icons/application-interaction.svg +17 -0
- package/assets/archimate3/icons/application-interface.svg +16 -0
- package/assets/archimate3/icons/application-process.svg +14 -0
- package/assets/archimate3/icons/application-service.svg +14 -0
- package/assets/archimate3/icons/artifact.svg +16 -0
- package/assets/archimate3/icons/assessment.svg +17 -0
- package/assets/archimate3/icons/business-actor.svg +22 -0
- package/assets/archimate3/icons/business-collaboration.svg +21 -0
- package/assets/archimate3/icons/business-event.svg +15 -0
- package/assets/archimate3/icons/business-function.svg +14 -0
- package/assets/archimate3/icons/business-interaction.svg +18 -0
- package/assets/archimate3/icons/business-interface.svg +16 -0
- package/assets/archimate3/icons/business-object.svg +14 -0
- package/assets/archimate3/icons/business-process.svg +15 -0
- package/assets/archimate3/icons/business-role.svg +16 -0
- package/assets/archimate3/icons/business-service.svg +14 -0
- package/assets/archimate3/icons/capability.svg +40 -0
- package/assets/archimate3/icons/communication-network.svg +18 -0
- package/assets/archimate3/icons/constraint.svg +18 -0
- package/assets/archimate3/icons/contract.svg +13 -0
- package/assets/archimate3/icons/course-of-action.svg +20 -0
- package/assets/archimate3/icons/data-object.svg +14 -0
- package/assets/archimate3/icons/deliverable.svg +11 -0
- package/assets/archimate3/icons/device.svg +18 -0
- package/assets/archimate3/icons/distribution-network.svg +19 -0
- package/assets/archimate3/icons/driver.svg +24 -0
- package/assets/archimate3/icons/equipment.svg +31 -0
- package/assets/archimate3/icons/facility.svg +16 -0
- package/assets/archimate3/icons/gap.svg +22 -0
- package/assets/archimate3/icons/glyphs/activity.svg +3 -0
- package/assets/archimate3/icons/glyphs/actor.svg +14 -0
- package/assets/archimate3/icons/glyphs/application-component.svg +12 -0
- package/assets/archimate3/icons/glyphs/artifact.svg +9 -0
- package/assets/archimate3/icons/glyphs/assessment.svg +9 -0
- package/assets/archimate3/icons/glyphs/capability.svg +32 -0
- package/assets/archimate3/icons/glyphs/cloud-gear.svg +3 -0
- package/assets/archimate3/icons/glyphs/collaboration.svg +15 -0
- package/assets/archimate3/icons/glyphs/communication-network.svg +12 -0
- package/assets/archimate3/icons/glyphs/constraint.svg +10 -0
- package/assets/archimate3/icons/glyphs/contract.svg +5 -0
- package/assets/archimate3/icons/glyphs/course-of-action.svg +12 -0
- package/assets/archimate3/icons/glyphs/data-object.svg +4 -0
- package/assets/archimate3/icons/glyphs/deliverable.svg +3 -0
- package/assets/archimate3/icons/glyphs/device.svg +10 -0
- package/assets/archimate3/icons/glyphs/distribution-network.svg +11 -0
- package/assets/archimate3/icons/glyphs/driver.svg +16 -0
- package/assets/archimate3/icons/glyphs/equipment.svg +22 -0
- package/assets/archimate3/icons/glyphs/event.svg +6 -0
- package/assets/archimate3/icons/glyphs/facility.svg +7 -0
- package/assets/archimate3/icons/glyphs/function.svg +6 -0
- package/assets/archimate3/icons/glyphs/gap.svg +14 -0
- package/assets/archimate3/icons/glyphs/goal.svg +10 -0
- package/assets/archimate3/icons/glyphs/grouping.svg +4 -0
- package/assets/archimate3/icons/glyphs/interaction.svg +10 -0
- package/assets/archimate3/icons/glyphs/interface.svg +8 -0
- package/assets/archimate3/icons/glyphs/location.svg +6 -0
- package/assets/archimate3/icons/glyphs/material.svg +12 -0
- package/assets/archimate3/icons/glyphs/meaning.svg +3 -0
- package/assets/archimate3/icons/glyphs/node.svg +8 -0
- package/assets/archimate3/icons/glyphs/object.svg +4 -0
- package/assets/archimate3/icons/glyphs/outcome.svg +16 -0
- package/assets/archimate3/icons/glyphs/path.svg +10 -0
- package/assets/archimate3/icons/glyphs/person-silhouette.svg +3 -0
- package/assets/archimate3/icons/glyphs/plateau.svg +8 -0
- package/assets/archimate3/icons/glyphs/principle.svg +12 -0
- package/assets/archimate3/icons/glyphs/process.svg +6 -0
- package/assets/archimate3/icons/glyphs/product.svg +4 -0
- package/assets/archimate3/icons/glyphs/representation.svg +4 -0
- package/assets/archimate3/icons/glyphs/requirement.svg +6 -0
- package/assets/archimate3/icons/glyphs/resource.svg +14 -0
- package/assets/archimate3/icons/glyphs/role.svg +6 -0
- package/assets/archimate3/icons/glyphs/service.svg +6 -0
- package/assets/archimate3/icons/glyphs/stakeholder.svg +6 -0
- package/assets/archimate3/icons/glyphs/system-software.svg +14 -0
- package/assets/archimate3/icons/glyphs/value-stream.svg +3 -0
- package/assets/archimate3/icons/glyphs/value.svg +3 -0
- package/assets/archimate3/icons/glyphs/work-package.svg +4 -0
- package/assets/archimate3/icons/goal.svg +18 -0
- package/assets/archimate3/icons/grouping.svg +12 -0
- package/assets/archimate3/icons/implementation-event.svg +15 -0
- package/assets/archimate3/icons/location.svg +14 -0
- package/assets/archimate3/icons/material.svg +21 -0
- package/assets/archimate3/icons/meaning.svg +11 -0
- package/assets/archimate3/icons/node.svg +14 -0
- package/assets/archimate3/icons/or-junction.svg +3 -0
- package/assets/archimate3/icons/outcome.svg +25 -0
- package/assets/archimate3/icons/path.svg +18 -0
- package/assets/archimate3/icons/plateau.svg +16 -0
- package/assets/archimate3/icons/principle.svg +21 -0
- package/assets/archimate3/icons/product.svg +12 -0
- package/assets/archimate3/icons/representation.svg +12 -0
- package/assets/archimate3/icons/requirement.svg +14 -0
- package/assets/archimate3/icons/resource.svg +23 -0
- package/assets/archimate3/icons/stakeholder.svg +15 -0
- package/assets/archimate3/icons/system-software.svg +22 -0
- package/assets/archimate3/icons/technology-collaboration.svg +22 -0
- package/assets/archimate3/icons/technology-event.svg +15 -0
- package/assets/archimate3/icons/technology-function.svg +14 -0
- package/assets/archimate3/icons/technology-interaction.svg +18 -0
- package/assets/archimate3/icons/technology-interface.svg +16 -0
- package/assets/archimate3/icons/technology-process.svg +14 -0
- package/assets/archimate3/icons/technology-service.svg +14 -0
- package/assets/archimate3/icons/value-stream.svg +11 -0
- package/assets/archimate3/icons/value.svg +11 -0
- package/assets/archimate3/icons/work-package.svg +12 -0
- package/assets/archimate4/archimate4-element-shapes.ttl +404 -0
- package/assets/archimate4/archimate4-metamodel.ttl +179 -0
- package/assets/archimate4/archimate4-notation.ttl +1147 -0
- package/assets/archimate4/archimate4-onto.ttl +1559 -0
- package/assets/archimate4/archimate4-presentation-contexts.ttl +60 -0
- package/assets/archimate4/archimate4-principle-shapes.ttl +893 -0
- package/assets/archimate4/archimate4-questions.ttl +1224 -0
- package/assets/archimate4/archimate4-reference-data.ttl +56 -0
- package/assets/archimate4/archimate4-relationship-shapes.ttl +16920 -0
- package/assets/archimate4/archimate4-relationship-tables.ttl +3200 -0
- package/assets/archimate4/archimate4-tax.ttl +749 -0
- package/assets/archimate4/archimate4-viewpoint-shapes.ttl +55 -0
- package/assets/archimate4/archimate4-viewpoints.ttl +777 -0
- package/assets/archimate4/icons/and-junction.svg +3 -0
- package/assets/archimate4/icons/application-component.svg +18 -0
- package/assets/archimate4/icons/application-interface.svg +16 -0
- package/assets/archimate4/icons/artifact.svg +16 -0
- package/assets/archimate4/icons/assessment.svg +17 -0
- package/assets/archimate4/icons/business-actor.svg +22 -0
- package/assets/archimate4/icons/business-interface.svg +16 -0
- package/assets/archimate4/icons/business-object.svg +14 -0
- package/assets/archimate4/icons/capability.svg +40 -0
- package/assets/archimate4/icons/collaboration.svg +21 -0
- package/assets/archimate4/icons/communication-network.svg +18 -0
- package/assets/archimate4/icons/course-of-action.svg +20 -0
- package/assets/archimate4/icons/data-object.svg +14 -0
- package/assets/archimate4/icons/deliverable.svg +11 -0
- package/assets/archimate4/icons/device.svg +18 -0
- package/assets/archimate4/icons/distribution-network.svg +19 -0
- package/assets/archimate4/icons/driver.svg +24 -0
- package/assets/archimate4/icons/equipment.svg +31 -0
- package/assets/archimate4/icons/event.svg +15 -0
- package/assets/archimate4/icons/facility.svg +16 -0
- package/assets/archimate4/icons/function.svg +13 -0
- package/assets/archimate4/icons/glyphs/activity.svg +3 -0
- package/assets/archimate4/icons/glyphs/actor.svg +14 -0
- package/assets/archimate4/icons/glyphs/application-component.svg +12 -0
- package/assets/archimate4/icons/glyphs/artifact.svg +9 -0
- package/assets/archimate4/icons/glyphs/assessment.svg +9 -0
- package/assets/archimate4/icons/glyphs/capability.svg +32 -0
- package/assets/archimate4/icons/glyphs/cloud-gear.svg +3 -0
- package/assets/archimate4/icons/glyphs/collaboration.svg +15 -0
- package/assets/archimate4/icons/glyphs/communication-network.svg +12 -0
- package/assets/archimate4/icons/glyphs/constraint.svg +10 -0
- package/assets/archimate4/icons/glyphs/contract.svg +5 -0
- package/assets/archimate4/icons/glyphs/course-of-action.svg +12 -0
- package/assets/archimate4/icons/glyphs/data-object.svg +4 -0
- package/assets/archimate4/icons/glyphs/deliverable.svg +3 -0
- package/assets/archimate4/icons/glyphs/device.svg +10 -0
- package/assets/archimate4/icons/glyphs/distribution-network.svg +11 -0
- package/assets/archimate4/icons/glyphs/driver.svg +16 -0
- package/assets/archimate4/icons/glyphs/equipment.svg +22 -0
- package/assets/archimate4/icons/glyphs/event.svg +6 -0
- package/assets/archimate4/icons/glyphs/facility.svg +7 -0
- package/assets/archimate4/icons/glyphs/function.svg +6 -0
- package/assets/archimate4/icons/glyphs/gap.svg +14 -0
- package/assets/archimate4/icons/glyphs/goal.svg +10 -0
- package/assets/archimate4/icons/glyphs/grouping.svg +4 -0
- package/assets/archimate4/icons/glyphs/interaction.svg +10 -0
- package/assets/archimate4/icons/glyphs/interface.svg +8 -0
- package/assets/archimate4/icons/glyphs/location.svg +6 -0
- package/assets/archimate4/icons/glyphs/material.svg +12 -0
- package/assets/archimate4/icons/glyphs/meaning.svg +3 -0
- package/assets/archimate4/icons/glyphs/node.svg +8 -0
- package/assets/archimate4/icons/glyphs/object.svg +4 -0
- package/assets/archimate4/icons/glyphs/outcome.svg +16 -0
- package/assets/archimate4/icons/glyphs/path.svg +10 -0
- package/assets/archimate4/icons/glyphs/person-silhouette.svg +3 -0
- package/assets/archimate4/icons/glyphs/plateau.svg +8 -0
- package/assets/archimate4/icons/glyphs/principle.svg +12 -0
- package/assets/archimate4/icons/glyphs/process.svg +6 -0
- package/assets/archimate4/icons/glyphs/product.svg +4 -0
- package/assets/archimate4/icons/glyphs/representation.svg +4 -0
- package/assets/archimate4/icons/glyphs/requirement.svg +6 -0
- package/assets/archimate4/icons/glyphs/resource.svg +14 -0
- package/assets/archimate4/icons/glyphs/role.svg +6 -0
- package/assets/archimate4/icons/glyphs/service.svg +6 -0
- package/assets/archimate4/icons/glyphs/stakeholder.svg +6 -0
- package/assets/archimate4/icons/glyphs/system-software.svg +14 -0
- package/assets/archimate4/icons/glyphs/value-stream.svg +3 -0
- package/assets/archimate4/icons/glyphs/value.svg +3 -0
- package/assets/archimate4/icons/glyphs/work-package.svg +4 -0
- package/assets/archimate4/icons/goal.svg +18 -0
- package/assets/archimate4/icons/grouping.svg +12 -0
- package/assets/archimate4/icons/location.svg +14 -0
- package/assets/archimate4/icons/material.svg +21 -0
- package/assets/archimate4/icons/meaning.svg +11 -0
- package/assets/archimate4/icons/node.svg +14 -0
- package/assets/archimate4/icons/or-junction.svg +3 -0
- package/assets/archimate4/icons/outcome.svg +25 -0
- package/assets/archimate4/icons/path.svg +18 -0
- package/assets/archimate4/icons/plateau.svg +16 -0
- package/assets/archimate4/icons/principle.svg +21 -0
- package/assets/archimate4/icons/process.svg +15 -0
- package/assets/archimate4/icons/product.svg +12 -0
- package/assets/archimate4/icons/requirement.svg +14 -0
- package/assets/archimate4/icons/resource.svg +23 -0
- package/assets/archimate4/icons/role.svg +16 -0
- package/assets/archimate4/icons/service.svg +13 -0
- package/assets/archimate4/icons/stakeholder.svg +15 -0
- package/assets/archimate4/icons/system-software.svg +22 -0
- package/assets/archimate4/icons/technology-interface.svg +16 -0
- package/assets/archimate4/icons/value-stream.svg +11 -0
- package/assets/archimate4/icons/value.svg +11 -0
- package/assets/archimate4/icons/work-package.svg +12 -0
- package/assets/basic/basic-metamodel.ttl +100 -0
- package/assets/basic/basic-notation-bubble.ttl +175 -0
- package/assets/basic/basic-notation.ttl +172 -0
- package/assets/basic/basic-onto.ttl +171 -0
- package/assets/basic/basic-presentation-contexts.ttl +70 -0
- package/assets/basic/basic-tax.ttl +130 -0
- package/assets/basic/icons/aggregation.svg +7 -0
- package/assets/basic/icons/association.svg +6 -0
- package/assets/basic/icons/element.svg +5 -0
- package/assets/basic/icons/glyphs/aggregation.svg +6 -0
- package/assets/basic/icons/glyphs/association.svg +5 -0
- package/assets/basic/icons/glyphs/element.svg +5 -0
- package/assets/basic/icons/glyphs/relationship.svg +5 -0
- package/assets/basic/icons/relationship.svg +7 -0
- package/assets/basic/notation-bubble/icons/aggregation.svg +7 -0
- package/assets/basic/notation-bubble/icons/association.svg +6 -0
- package/assets/basic/notation-bubble/icons/element.svg +5 -0
- package/assets/basic/notation-bubble/icons/glyphs/aggregation.svg +6 -0
- package/assets/basic/notation-bubble/icons/glyphs/association.svg +5 -0
- package/assets/basic/notation-bubble/icons/glyphs/element.svg +5 -0
- package/assets/basic/notation-bubble/icons/glyphs/relationship.svg +5 -0
- package/assets/basic/notation-bubble/icons/relationship.svg +7 -0
- package/assets/catalog.ttl +7302 -0
- package/assets/core/core-notation.ttl +131 -0
- package/assets/core/core-onto.ttl +2811 -0
- package/assets/core/core-questions.ttl +957 -0
- package/assets/core/core-shapes.ttl +915 -0
- package/assets/core/core-vis-onto.ttl +1408 -0
- package/assets/core/core-vis-shapes.ttl +840 -0
- package/assets/core-vis/markers/circle-dot.svg +3 -0
- package/assets/core-vis/markers/closed-arrowhead.svg +3 -0
- package/assets/core-vis/markers/filled-diamond.svg +3 -0
- package/assets/core-vis/markers/half-arrowhead.svg +3 -0
- package/assets/core-vis/markers/hollow-arrowhead.svg +3 -0
- package/assets/core-vis/markers/hollow-diamond.svg +3 -0
- package/assets/core-vis/markers/open-arrowhead.svg +3 -0
- package/fixtures/interoperability/archimate4-demo.trig +259 -0
- package/fixtures/interoperability/expected-findings.json +26 -0
- package/fixtures/interoperability/shop-seed.ttl +225 -0
- package/package.json +136 -4
- package/scripts/sync-assets.mjs +252 -0
- package/src/conformance.ts +66 -0
- package/src/import-export/model-io.ts +426 -0
- package/src/index.ts +11 -0
- package/src/metamodel-manager/asset-sources.ts +754 -0
- package/src/metamodel-manager/bundled-assets.ts +599 -0
- package/src/metamodel-manager/catalogue.ts +114 -0
- package/src/metamodel-manager/class-hierarchy.ts +155 -0
- package/src/metamodel-manager/index.ts +65 -0
- package/src/metamodel-manager/interfaces.ts +422 -0
- package/src/metamodel-manager/metamodel-completeness.ts +162 -0
- package/src/metamodel-manager/metamodel-loader.ts +864 -0
- package/src/metamodel-manager/notation-resolver.ts +284 -0
- package/src/metamodel-manager/notation.ts +659 -0
- package/src/metamodel-manager/palette-generator.ts +882 -0
- package/src/metamodel-manager/property-shapes.ts +290 -0
- package/src/metamodel-manager/taxonomy.ts +904 -0
- package/src/metamodel-manager/type-guide.ts +241 -0
- package/src/metamodel-manager/viewpoint-manager.ts +147 -0
- package/src/model-manager/appearance.ts +389 -0
- package/src/model-manager/cascade.ts +246 -0
- package/src/model-manager/clipboard.ts +566 -0
- package/src/model-manager/context-names.ts +108 -0
- package/src/model-manager/custom-properties.ts +549 -0
- package/src/model-manager/derivations.ts +166 -0
- package/src/model-manager/direct-permissions.ts +182 -0
- package/src/model-manager/drawing-order.ts +119 -0
- package/src/model-manager/element-manager.ts +69 -0
- package/src/model-manager/element-pictures.ts +118 -0
- package/src/model-manager/field-names.ts +42 -0
- package/src/model-manager/folders.ts +354 -0
- package/src/model-manager/grid.ts +6 -0
- package/src/model-manager/index.ts +43 -0
- package/src/model-manager/interfaces.ts +417 -0
- package/src/model-manager/iri-conformance.ts +183 -0
- package/src/model-manager/label-expression.ts +233 -0
- package/src/model-manager/legacy-migration.ts +200 -0
- package/src/model-manager/missing-references.ts +86 -0
- package/src/model-manager/model-diff-text.ts +150 -0
- package/src/model-manager/model-diff.ts +534 -0
- package/src/model-manager/model-merge.ts +1160 -0
- package/src/model-manager/model-namespace.ts +199 -0
- package/src/model-manager/model-operations.ts +132 -0
- package/src/model-manager/model-queries.ts +616 -0
- package/src/model-manager/model-session.ts +759 -0
- package/src/model-manager/multiplicity.ts +74 -0
- package/src/model-manager/nested-resources.ts +145 -0
- package/src/model-manager/own-metamodel.ts +157 -0
- package/src/model-manager/placement-copy.ts +116 -0
- package/src/model-manager/property-catalog.ts +787 -0
- package/src/model-manager/proposal-order.ts +203 -0
- package/src/model-manager/provenance.ts +396 -0
- package/src/model-manager/questions.ts +470 -0
- package/src/model-manager/rdf-scope.ts +97 -0
- package/src/model-manager/relationship-graph.ts +462 -0
- package/src/model-manager/relationship-manager.ts +962 -0
- package/src/model-manager/relationship-table.ts +189 -0
- package/src/model-manager/relationship-validity.ts +261 -0
- package/src/model-manager/resource-edits.ts +28 -0
- package/src/model-manager/short-hash.ts +104 -0
- package/src/model-manager/snapshot-lines.ts +88 -0
- package/src/model-manager/version-history.ts +205 -0
- package/src/model-manager/view-from-results.ts +81 -0
- package/src/model-manager/view-manager.ts +1410 -0
- package/src/model-manager/vocabulary.ts +279 -0
- package/src/rdf-engine/finding-shape.ts +23 -0
- package/src/rdf-engine/graph-scope.ts +163 -0
- package/src/rdf-engine/index.ts +7 -0
- package/src/rdf-engine/interfaces.ts +144 -0
- package/src/rdf-engine/iri.ts +203 -0
- package/src/rdf-engine/localized-text.ts +13 -0
- package/src/rdf-engine/namespaces.ts +41 -0
- package/src/rdf-engine/observable-store.ts +631 -0
- package/src/rdf-engine/rdf-store.ts +508 -0
- package/src/rdf-engine/shacl-validator.ts +602 -0
- package/src/rdf-engine/shape-reach.ts +140 -0
- package/src/rdf-engine/shape-switches.ts +165 -0
- package/src/rdf-engine/single-valued.ts +219 -0
- package/src/rdf-engine/sparql-constraints.ts +334 -0
- package/src/rdf-engine/term-codec.ts +51 -0
- package/src/rdf-engine/ttl-parser.ts +51 -0
- package/src/rdf-engine/ttl-serializer.ts +79 -0
- package/src/rdf-engine/turtle-writer.ts +284 -0
- package/src/rdf-engine/validation-engine.ts +682 -0
- package/src/rdf-engine/validation-service.ts +184 -0
- package/src/rdf-engine/validation.worker.ts +47 -0
|
@@ -0,0 +1,599 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Registry of the metamodel assets bundled with the application.
|
|
3
|
+
*
|
|
4
|
+
* The app ships a copy of the Linked.Archi ArchiMate 4.0 language definition so
|
|
5
|
+
* a metamodel can be loaded with no network access. The TTL files and SVG icons
|
|
6
|
+
* live under `assets/` in the repository and are emitted verbatim into the build
|
|
7
|
+
* output (see `webpack.config.js`), so the same relative paths address them in
|
|
8
|
+
* Node and in the browser.
|
|
9
|
+
*
|
|
10
|
+
* ## Layout mirrors the published site
|
|
11
|
+
*
|
|
12
|
+
* `assets/` is laid out exactly as `https://meta.linked.archi/` is deployed:
|
|
13
|
+
*
|
|
14
|
+
* ```
|
|
15
|
+
* assets/core/core-onto.ttl ← the arch: core ontology
|
|
16
|
+
* assets/core/core-vis-onto.ttl ← the arch-vis: visual-notation ontology
|
|
17
|
+
* assets/archimate4/*.ttl ← the ArchiMate 4.0 language files
|
|
18
|
+
* assets/archimate4/icons/*.svg ← element icons
|
|
19
|
+
* assets/archimate4/icons/glyphs/*.svg ← badge glyphs
|
|
20
|
+
* assets/basic/*.ttl ← Basic, the generic language
|
|
21
|
+
* assets/basic/icons/, basic/notation-bubble/icons/ ← its two notations' icons
|
|
22
|
+
* assets/arch-decision/*.ttl ← the Architecture Decisions extension
|
|
23
|
+
* assets/arch-processes/*.ttl ← the Architecture Processes extension
|
|
24
|
+
* assets/catalog.ttl ← meta.linked.archi's catalogue
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* That is what makes {@link resolveIconUri} a pure prefix rewrite: the visual
|
|
28
|
+
* notation guide documents that for offline use `https://meta.linked.archi/`
|
|
29
|
+
* resolves to the asset root, so
|
|
30
|
+
* `https://meta.linked.archi/archimate4/icons/business-actor.svg` becomes
|
|
31
|
+
* `assets/archimate4/icons/business-actor.svg`.
|
|
32
|
+
*
|
|
33
|
+
* ## Two environments, one path
|
|
34
|
+
*
|
|
35
|
+
* {@link fetchAssetText} reads an asset in either environment. Which one it is
|
|
36
|
+
* in is decided from the *shape of the filesystem module* rather than by
|
|
37
|
+
* sniffing globals — the same approach `rdf-engine/rdf-store.ts` uses to tell
|
|
38
|
+
* the Node and browser Oxigraph builds apart, and the same
|
|
39
|
+
* capability-then-dynamic-import shape as `platform/platform-factory.ts`:
|
|
40
|
+
*
|
|
41
|
+
* - Under Node/Vitest, `import('fs')` yields a module exposing a callable
|
|
42
|
+
* `promises.readFile`, so the asset is read off disk.
|
|
43
|
+
* - Under the webpack `web` target, `resolve.fallback.fs === false` turns that
|
|
44
|
+
* same import into an empty module, no `readFile` surfaces, and the browser
|
|
45
|
+
* branch fetches the emitted URL instead.
|
|
46
|
+
*
|
|
47
|
+
* Note that probing for a global `fetch` alone would not distinguish them:
|
|
48
|
+
* Node 18+ has `fetch` too. The filesystem capability is the discriminator.
|
|
49
|
+
*/
|
|
50
|
+
|
|
51
|
+
// ── Asset roles and descriptors ────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* The logical part a bundled asset plays in a metamodel definition.
|
|
55
|
+
*
|
|
56
|
+
* These mirror the `arch:Metamodel` manifest properties: `arch:modelConcepts`
|
|
57
|
+
* (`ontology`), `arch:conceptClassification` (`taxonomy`), `arch:notationSet`
|
|
58
|
+
* (`notation`), `arch:formalRules` (`shapes`), `arch:architectureViewpoints`
|
|
59
|
+
* (`viewpoints`) and `arch:presentationContextScheme`
|
|
60
|
+
* (`presentationContexts`), plus the manifest itself and the two core
|
|
61
|
+
* ontologies every language file `owl:imports`.
|
|
62
|
+
*
|
|
63
|
+
* `coreShapes` covers `core-shapes` and `core-vis-shapes`. No manifest names
|
|
64
|
+
* them — they constrain the core and diagram vocabularies every model uses, so
|
|
65
|
+
* the application loads them unconditionally and validates every model against
|
|
66
|
+
* them (`arch:inModel` cardinality, `arch-vis:ArchNode` must name its element).
|
|
67
|
+
* `derivationRules` is the `arch:derivationRules` document: SHACL-AF rules the
|
|
68
|
+
* browser cannot execute, recorded so a remote load reports where it went.
|
|
69
|
+
* `relationshipTables` is the relationship tables a manifest lists under
|
|
70
|
+
* `arch:formalRules` beside the relationship shapes — the same table, as lookups,
|
|
71
|
+
* which also say which relationships a modeller may draw directly. They hold no
|
|
72
|
+
* shapes, so they are kept out of the shapes graph; the relationship manager
|
|
73
|
+
* reads them (`direct-permissions.ts`).
|
|
74
|
+
* `questions` is a language's question set (`arch:hasQuestionSet`) and
|
|
75
|
+
* `coreQuestions` the core one, which no manifest names because it applies to
|
|
76
|
+
* every model: model questions the SPARQL tab offers and the Validation tab runs
|
|
77
|
+
* as model checks (`model-manager/questions.ts`). They are never model data.
|
|
78
|
+
* `coreNotation` is the notation of the core's own relationship types
|
|
79
|
+
* (`core-notation`), which no manifest names either: its sets are consulted
|
|
80
|
+
* after every loaded metamodel's default set, the last fallback layer of the
|
|
81
|
+
* notation lookup (`coreNotationSetIris`, VC-DD-5). It draws Association,
|
|
82
|
+
* Depends On, Has Part and Refines, and lets nesting stand for Has Part and
|
|
83
|
+
* Refines: the part inside the whole, a view inside the box of the element it
|
|
84
|
+
* refines.
|
|
85
|
+
*/
|
|
86
|
+
export type BundledAssetRole =
|
|
87
|
+
| 'manifest'
|
|
88
|
+
| 'ontology'
|
|
89
|
+
| 'taxonomy'
|
|
90
|
+
| 'notation'
|
|
91
|
+
| 'shapes'
|
|
92
|
+
| 'presentationContexts'
|
|
93
|
+
| 'viewpoints'
|
|
94
|
+
| 'derivationRules'
|
|
95
|
+
| 'relationshipTables'
|
|
96
|
+
| 'referenceData'
|
|
97
|
+
| 'coreOntology'
|
|
98
|
+
| 'coreVisOntology'
|
|
99
|
+
| 'coreShapes'
|
|
100
|
+
| 'questions'
|
|
101
|
+
| 'coreQuestions'
|
|
102
|
+
| 'coreNotation';
|
|
103
|
+
|
|
104
|
+
/** A single TTL file shipped with the application. */
|
|
105
|
+
export interface BundledAsset {
|
|
106
|
+
/** The part this file plays in the metamodel definition. */
|
|
107
|
+
readonly role: BundledAssetRole;
|
|
108
|
+
/**
|
|
109
|
+
* IRI of the graph the file defines — the `owl:Ontology` subject, or the
|
|
110
|
+
* `skos:ConceptScheme` subject for the taxonomy and presentation contexts.
|
|
111
|
+
* Use it as the named-graph IRI when loading into the store.
|
|
112
|
+
*/
|
|
113
|
+
readonly ontologyIri: string;
|
|
114
|
+
/** Path relative to the asset root, always with `/` separators. */
|
|
115
|
+
readonly path: string;
|
|
116
|
+
/**
|
|
117
|
+
* The document's `owl:versionIRI`, where another document imports it by its
|
|
118
|
+
* version (meta's relationship tables and derivation rules import
|
|
119
|
+
* `…/archimate4/onto/4.0#`): a lookup by either IRI finds the same file.
|
|
120
|
+
*/
|
|
121
|
+
readonly versionIri?: string;
|
|
122
|
+
/**
|
|
123
|
+
* Id of the {@link BundledMetamodel} the file belongs to, or absent for the
|
|
124
|
+
* core files every metamodel shares.
|
|
125
|
+
*/
|
|
126
|
+
readonly metamodel?: string;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* A metamodel whose complete asset set ships with the application.
|
|
131
|
+
*
|
|
132
|
+
* Offline is a first-class mode: the app must start, and a model conforming to
|
|
133
|
+
* one of these must open, with no network. Anything else resolves remotely —
|
|
134
|
+
* see `asset-sources.ts`.
|
|
135
|
+
*/
|
|
136
|
+
export interface BundledMetamodel {
|
|
137
|
+
/** Short stable id, also the asset sub-directory (`archimate4`). */
|
|
138
|
+
readonly id: string;
|
|
139
|
+
/** IRI of the `arch:Metamodel` subject in the manifest. */
|
|
140
|
+
readonly metamodelIri: string;
|
|
141
|
+
/** IRI of the manifest document (its `owl:Ontology`). */
|
|
142
|
+
readonly manifestIri: string;
|
|
143
|
+
/** Human-readable name for selectors. */
|
|
144
|
+
readonly label: string;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Root of the bundled assets, relative to the module output directory in the
|
|
149
|
+
* browser and discovered on disk in Node. Kept as a bare relative segment so
|
|
150
|
+
* the app works when served from a sub-path.
|
|
151
|
+
*/
|
|
152
|
+
export const ASSET_ROOT = 'assets';
|
|
153
|
+
|
|
154
|
+
/** Base the notation files publish their icon and ontology URIs under. */
|
|
155
|
+
export const PUBLISHED_BASE_URI = 'https://meta.linked.archi/';
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* meta.linked.archi's DCAT catalogue of its semantic assets: the metamodels the
|
|
159
|
+
* Metamodels menu offers (`catalogue.ts`). It belongs to no metamodel, so it is
|
|
160
|
+
* not in {@link BUNDLED_ASSETS} — nothing loads it into the store — and the
|
|
161
|
+
* bundled source answers for it by this IRI alone.
|
|
162
|
+
*/
|
|
163
|
+
export const CATALOGUE_IRI = 'https://meta.linked.archi/catalog';
|
|
164
|
+
|
|
165
|
+
/** The bundled copy of the catalogue, where the site serves it (`/catalog.ttl`). */
|
|
166
|
+
export const BUNDLED_CATALOGUE_PATH = 'catalog.ttl';
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Asset-root-relative directories under which icons are actually bundled.
|
|
170
|
+
*
|
|
171
|
+
* Only these are shipped: the two ArchiMate icon sets, Basic's two (its
|
|
172
|
+
* rectangle and bubble notations), and the core-vis decoration markers
|
|
173
|
+
* (`arch-vis:decorSymbol`) the canvas draws relationship ends with. The other
|
|
174
|
+
* language icon sets exist on the published site but are not in this bundle,
|
|
175
|
+
* so {@link resolveIconUri} reports them as unresolvable rather than handing
|
|
176
|
+
* back a path that would 404.
|
|
177
|
+
*/
|
|
178
|
+
export const BUNDLED_ICON_PREFIXES: readonly string[] = [
|
|
179
|
+
'archimate4/icons/',
|
|
180
|
+
'archimate3/icons/',
|
|
181
|
+
'basic/icons/',
|
|
182
|
+
'basic/notation-bubble/icons/',
|
|
183
|
+
'core-vis/markers/',
|
|
184
|
+
];
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The metamodels shipped complete, default first.
|
|
188
|
+
*
|
|
189
|
+
* ArchiMate 4.0 is the default language. ArchiMate 3.2 ships too because the
|
|
190
|
+
* Open Group Exchange Format — the one interchange format every ArchiMate tool
|
|
191
|
+
* writes — is a 3.x format, so importing an exchange file needs the 3.2
|
|
192
|
+
* ontology whether or not the network is up. Basic ships because it is the
|
|
193
|
+
* generic language — elements no other loaded language has, its Connection
|
|
194
|
+
* relating any two of them — and that has to work offline too.
|
|
195
|
+
* Architecture Decisions ships because it is added beside whichever language is
|
|
196
|
+
* loaded, to record the decisions about a model: an extension, with no
|
|
197
|
+
* presentation contexts and no notation of its own.
|
|
198
|
+
*/
|
|
199
|
+
export const BUNDLED_METAMODELS: readonly BundledMetamodel[] = [
|
|
200
|
+
{
|
|
201
|
+
id: 'archimate4',
|
|
202
|
+
metamodelIri: 'https://meta.linked.archi/archimate4/metamodel#ArchiMate4',
|
|
203
|
+
manifestIri: 'https://meta.linked.archi/archimate4/metamodel#',
|
|
204
|
+
label: 'ArchiMate 4.0',
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
id: 'archimate3',
|
|
208
|
+
metamodelIri: 'https://meta.linked.archi/archimate3/metamodel#ArchiMate3.2',
|
|
209
|
+
manifestIri: 'https://meta.linked.archi/archimate3/metamodel#',
|
|
210
|
+
label: 'ArchiMate 3.2',
|
|
211
|
+
},
|
|
212
|
+
{
|
|
213
|
+
id: 'basic',
|
|
214
|
+
metamodelIri: 'https://meta.linked.archi/basic/metamodel#Basic',
|
|
215
|
+
manifestIri: 'https://meta.linked.archi/basic/metamodel#',
|
|
216
|
+
label: 'Basic',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
id: 'arch-decision',
|
|
220
|
+
metamodelIri: 'https://meta.linked.archi/arch-decision/metamodel#ArchitectureDecisions',
|
|
221
|
+
manifestIri: 'https://meta.linked.archi/arch-decision/metamodel#',
|
|
222
|
+
label: 'Architecture Decisions',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
id: 'arch-processes',
|
|
226
|
+
metamodelIri: 'https://meta.linked.archi/arch-processes/metamodel#ArchitectureProcesses',
|
|
227
|
+
manifestIri: 'https://meta.linked.archi/arch-processes/metamodel#',
|
|
228
|
+
label: 'Architecture Processes',
|
|
229
|
+
},
|
|
230
|
+
];
|
|
231
|
+
|
|
232
|
+
/** The metamodel loaded when nothing else is asked for. */
|
|
233
|
+
export const DEFAULT_METAMODEL: BundledMetamodel = BUNDLED_METAMODELS[0];
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* The per-language files, generated from one table so both bundled languages
|
|
237
|
+
* carry the same roles under the same names.
|
|
238
|
+
*
|
|
239
|
+
* `derivationRules` are not bundled: SHACL-AF rules need a server-side engine,
|
|
240
|
+
* and the browser would only carry them to ignore them.
|
|
241
|
+
*/
|
|
242
|
+
function languageAssets(
|
|
243
|
+
id: string,
|
|
244
|
+
published: string,
|
|
245
|
+
filePrefix: string,
|
|
246
|
+
version: string,
|
|
247
|
+
): BundledAsset[] {
|
|
248
|
+
const doc = (suffix: string) => `https://meta.linked.archi/${published}/${suffix}#`;
|
|
249
|
+
const path = (suffix: string) => `${id}/${filePrefix}-${suffix}.ttl`;
|
|
250
|
+
return [
|
|
251
|
+
{ role: 'manifest', ontologyIri: doc('metamodel'), path: path('metamodel'), metamodel: id },
|
|
252
|
+
{
|
|
253
|
+
role: 'ontology',
|
|
254
|
+
ontologyIri: doc('onto'),
|
|
255
|
+
versionIri: `https://meta.linked.archi/${published}/onto/${version}#`,
|
|
256
|
+
path: path('onto'),
|
|
257
|
+
metamodel: id,
|
|
258
|
+
},
|
|
259
|
+
{ role: 'taxonomy', ontologyIri: doc('tax'), path: path('tax'), metamodel: id },
|
|
260
|
+
{ role: 'notation', ontologyIri: doc('notation'), path: path('notation'), metamodel: id },
|
|
261
|
+
{ role: 'shapes', ontologyIri: doc('element-shapes'), path: path('element-shapes'), metamodel: id },
|
|
262
|
+
{ role: 'shapes', ontologyIri: doc('shapes'), path: path('relationship-shapes'), metamodel: id },
|
|
263
|
+
{ role: 'shapes', ontologyIri: doc('principle-shapes'), path: path('principle-shapes'), metamodel: id },
|
|
264
|
+
{ role: 'shapes', ontologyIri: doc('viewpoint-shapes'), path: path('viewpoint-shapes'), metamodel: id },
|
|
265
|
+
{
|
|
266
|
+
role: 'relationshipTables',
|
|
267
|
+
ontologyIri: doc('relationship-tables'),
|
|
268
|
+
path: path('relationship-tables'),
|
|
269
|
+
metamodel: id,
|
|
270
|
+
},
|
|
271
|
+
{
|
|
272
|
+
role: 'presentationContexts',
|
|
273
|
+
ontologyIri: doc('presentation-contexts'),
|
|
274
|
+
path: path('presentation-contexts'),
|
|
275
|
+
metamodel: id,
|
|
276
|
+
},
|
|
277
|
+
{ role: 'viewpoints', ontologyIri: doc('viewpoints'), path: path('viewpoints'), metamodel: id },
|
|
278
|
+
{ role: 'referenceData', ontologyIri: doc('reference-data'), path: path('reference-data'), metamodel: id },
|
|
279
|
+
];
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Every TTL asset in the bundle, in dependency order.
|
|
284
|
+
*
|
|
285
|
+
* The core files come first because every language file `owl:imports` `arch:`,
|
|
286
|
+
* and the notation files also import `arch-vis:`. Loading in array order
|
|
287
|
+
* therefore never leaves a dangling import.
|
|
288
|
+
*/
|
|
289
|
+
export const BUNDLED_ASSETS: readonly BundledAsset[] = [
|
|
290
|
+
{
|
|
291
|
+
role: 'coreOntology',
|
|
292
|
+
ontologyIri: 'https://meta.linked.archi/core#',
|
|
293
|
+
path: 'core/core-onto.ttl',
|
|
294
|
+
},
|
|
295
|
+
{
|
|
296
|
+
role: 'coreVisOntology',
|
|
297
|
+
ontologyIri: 'https://meta.linked.archi/core-vis#',
|
|
298
|
+
path: 'core/core-vis-onto.ttl',
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
role: 'coreShapes',
|
|
302
|
+
ontologyIri: 'https://meta.linked.archi/core-shapes#',
|
|
303
|
+
path: 'core/core-shapes.ttl',
|
|
304
|
+
},
|
|
305
|
+
{
|
|
306
|
+
role: 'coreShapes',
|
|
307
|
+
ontologyIri: 'https://meta.linked.archi/core-vis-shapes#',
|
|
308
|
+
path: 'core/core-vis-shapes.ttl',
|
|
309
|
+
},
|
|
310
|
+
{
|
|
311
|
+
role: 'coreQuestions',
|
|
312
|
+
ontologyIri: 'https://meta.linked.archi/core-questions#',
|
|
313
|
+
path: 'core/core-questions.ttl',
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
role: 'coreNotation',
|
|
317
|
+
ontologyIri: 'https://meta.linked.archi/core-notation#',
|
|
318
|
+
path: 'core/core-notation.ttl',
|
|
319
|
+
},
|
|
320
|
+
...languageAssets('archimate4', 'archimate4', 'archimate4', '4.0'),
|
|
321
|
+
// The ArchiMate versions publish question sets; the other languages do not yet.
|
|
322
|
+
{
|
|
323
|
+
role: 'questions',
|
|
324
|
+
ontologyIri: 'https://meta.linked.archi/archimate4/questions#',
|
|
325
|
+
path: 'archimate4/archimate4-questions.ttl',
|
|
326
|
+
metamodel: 'archimate4',
|
|
327
|
+
},
|
|
328
|
+
...languageAssets('archimate3', 'archimate3', 'archimate3.2', '3.2'),
|
|
329
|
+
{
|
|
330
|
+
role: 'questions',
|
|
331
|
+
ontologyIri: 'https://meta.linked.archi/archimate3/questions#',
|
|
332
|
+
path: 'archimate3/archimate3.2-questions.ttl',
|
|
333
|
+
metamodel: 'archimate3',
|
|
334
|
+
},
|
|
335
|
+
// Basic's documents do not follow the per-language pattern: its ontology is
|
|
336
|
+
// <https://meta.linked.archi/basic> (no fragment), and its bubble notation —
|
|
337
|
+
// which a presentation context selects — has a folder of its own.
|
|
338
|
+
{ role: 'manifest', ontologyIri: 'https://meta.linked.archi/basic/metamodel#', path: 'basic/basic-metamodel.ttl', metamodel: 'basic' },
|
|
339
|
+
{ role: 'ontology', ontologyIri: 'https://meta.linked.archi/basic', path: 'basic/basic-onto.ttl', metamodel: 'basic' },
|
|
340
|
+
{ role: 'taxonomy', ontologyIri: 'https://meta.linked.archi/basic/tax#', path: 'basic/basic-tax.ttl', metamodel: 'basic' },
|
|
341
|
+
{ role: 'notation', ontologyIri: 'https://meta.linked.archi/basic/notation#', path: 'basic/basic-notation.ttl', metamodel: 'basic' },
|
|
342
|
+
{
|
|
343
|
+
role: 'notation',
|
|
344
|
+
ontologyIri: 'https://meta.linked.archi/basic/notation-bubble#',
|
|
345
|
+
path: 'basic/basic-notation-bubble.ttl',
|
|
346
|
+
metamodel: 'basic',
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
role: 'presentationContexts',
|
|
350
|
+
ontologyIri: 'https://meta.linked.archi/basic/presentation-contexts#',
|
|
351
|
+
path: 'basic/basic-presentation-contexts.ttl',
|
|
352
|
+
metamodel: 'basic',
|
|
353
|
+
},
|
|
354
|
+
// The decision extension: its vocabulary — the relationship types that draw its links with it — and its shapes
|
|
355
|
+
// keep their flat namespaces; its taxonomy and its manifest are nested under it.
|
|
356
|
+
{ role: 'manifest', ontologyIri: 'https://meta.linked.archi/arch-decision/metamodel#', path: 'arch-decision/arch-decision-metamodel.ttl', metamodel: 'arch-decision' },
|
|
357
|
+
{ role: 'ontology', ontologyIri: 'https://meta.linked.archi/arch-decision#', path: 'arch-decision/arch-decision-onto.ttl', metamodel: 'arch-decision' },
|
|
358
|
+
{ role: 'taxonomy', ontologyIri: 'https://meta.linked.archi/arch-decision/tax#', path: 'arch-decision/arch-decision-tax.ttl', metamodel: 'arch-decision' },
|
|
359
|
+
{ role: 'shapes', ontologyIri: 'https://meta.linked.archi/arch-decision-shapes#', path: 'arch-decision/arch-decision-shapes.ttl', metamodel: 'arch-decision' },
|
|
360
|
+
// The processes extension, as the decision one: its vocabulary and shapes flat, its taxonomy and manifest nested.
|
|
361
|
+
// LeanIX and EA on a Page import its vocabulary, which loads from here too.
|
|
362
|
+
{ role: 'manifest', ontologyIri: 'https://meta.linked.archi/arch-processes/metamodel#', path: 'arch-processes/arch-processes-metamodel.ttl', metamodel: 'arch-processes' },
|
|
363
|
+
{ role: 'ontology', ontologyIri: 'https://meta.linked.archi/arch-processes#', path: 'arch-processes/archProcesses.ttl', metamodel: 'arch-processes' },
|
|
364
|
+
{ role: 'taxonomy', ontologyIri: 'https://meta.linked.archi/arch-processes/tax#', path: 'arch-processes/arch-processes-tax.ttl', metamodel: 'arch-processes' },
|
|
365
|
+
{ role: 'shapes', ontologyIri: 'https://meta.linked.archi/arch-processes-shapes#', path: 'arch-processes/archProcesses-shapes.ttl', metamodel: 'arch-processes' },
|
|
366
|
+
];
|
|
367
|
+
|
|
368
|
+
// ── Registry lookups ───────────────────────────────────────────────────
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* All bundled assets playing the given role, in bundle order.
|
|
372
|
+
*
|
|
373
|
+
* Returns an array rather than a single asset because several roles are
|
|
374
|
+
* multi-valued — `arch:formalRules` on a manifest names four shapes graphs, and
|
|
375
|
+
* every bundled language has its own manifest. Pass `metamodel` to keep one
|
|
376
|
+
* language's files.
|
|
377
|
+
*/
|
|
378
|
+
export function getAssetsByRole(role: BundledAssetRole, metamodel?: string): BundledAsset[] {
|
|
379
|
+
return BUNDLED_ASSETS.filter(
|
|
380
|
+
(asset) => asset.role === role && (metamodel === undefined || asset.metamodel === metamodel),
|
|
381
|
+
);
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/** The bundled asset defining the given graph IRI, or `undefined`. */
|
|
385
|
+
export function getAssetByIri(ontologyIri: string): BundledAsset | undefined {
|
|
386
|
+
return BUNDLED_ASSETS.find((asset) => asset.ontologyIri === ontologyIri || asset.versionIri === ontologyIri);
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The bundled metamodel matching an IRI — its `arch:Metamodel` subject or its
|
|
391
|
+
* manifest document, with or without the trailing `#`.
|
|
392
|
+
*/
|
|
393
|
+
export function getBundledMetamodel(iri: string): BundledMetamodel | undefined {
|
|
394
|
+
const normalized = iri.endsWith('#') ? iri : iri.includes('#') ? iri : `${iri}#`;
|
|
395
|
+
return BUNDLED_METAMODELS.find(
|
|
396
|
+
(mm) => mm.metamodelIri === iri || mm.manifestIri === normalized || mm.id === iri,
|
|
397
|
+
);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// ── Icon URI resolution ────────────────────────────────────────────────
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Map a published icon URI from the notation data to its bundled path.
|
|
404
|
+
*
|
|
405
|
+
* Applies the offline resolution rule from the visual notation guide —
|
|
406
|
+
* `https://meta.linked.archi/` is the asset root — and then checks the result
|
|
407
|
+
* against {@link BUNDLED_ICON_PREFIXES}.
|
|
408
|
+
*
|
|
409
|
+
* @param iconUri Either an IRI (`arch:prefVisNotation`) or the string value of
|
|
410
|
+
* an `xsd:anyURI` literal (`arch-vis:iconSymbol`); both carry the same form.
|
|
411
|
+
* @returns The asset-root-relative path, or `null` when the URI is not under
|
|
412
|
+
* the published base or names an icon set this bundle does not ship.
|
|
413
|
+
*/
|
|
414
|
+
export function resolveIconUri(iconUri: string): string | null {
|
|
415
|
+
if (!iconUri.startsWith(PUBLISHED_BASE_URI)) return null;
|
|
416
|
+
|
|
417
|
+
const relative = iconUri.slice(PUBLISHED_BASE_URI.length);
|
|
418
|
+
const isBundled = BUNDLED_ICON_PREFIXES.some((prefix) => relative.startsWith(prefix));
|
|
419
|
+
return isBundled ? relative : null;
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* The asset-root-relative path for a published icon URI, or the URI unchanged
|
|
424
|
+
* when it resolves to nothing bundled.
|
|
425
|
+
*
|
|
426
|
+
* Convenience for render paths that need *some* `src` and would rather let the
|
|
427
|
+
* original URI fail on its own than deal with `null`.
|
|
428
|
+
*/
|
|
429
|
+
export function resolveIconUriOrPassThrough(iconUri: string): string {
|
|
430
|
+
return resolveIconUri(iconUri) ?? iconUri;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
// ── Asset loading ──────────────────────────────────────────────────────
|
|
434
|
+
|
|
435
|
+
/** The subset of `fs.promises.readFile` this module needs. */
|
|
436
|
+
type ReadFileUtf8 = (path: string, encoding: 'utf-8') => Promise<string>;
|
|
437
|
+
|
|
438
|
+
/** Explicitly configured Node asset root, if a caller set one. */
|
|
439
|
+
let assetRootOverride: string | null = null;
|
|
440
|
+
|
|
441
|
+
/** Memoized result of {@link discoverNodeAssetRoot}. */
|
|
442
|
+
let discoveredAssetRoot: string | null = null;
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Point Node asset resolution at a specific directory.
|
|
446
|
+
*
|
|
447
|
+
* The directory is the one *containing* `assets/`. Useful when the bundle is
|
|
448
|
+
* relocated and the walk-up search in {@link discoverNodeAssetRoot} would not
|
|
449
|
+
* find it. Pass `null` to go back to discovery.
|
|
450
|
+
*/
|
|
451
|
+
export function configureAssetRoot(directoryContainingAssets: string | null): void {
|
|
452
|
+
assetRootOverride = directoryContainingAssets;
|
|
453
|
+
discoveredAssetRoot = null;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
/**
|
|
457
|
+
* Probe for a filesystem, returning a reader only if one is really there.
|
|
458
|
+
*
|
|
459
|
+
* Mirrors `getWasmInitializer()` in `rdf-engine/rdf-store.ts`: inspect the
|
|
460
|
+
* resolved module for the callable we need instead of asking the environment
|
|
461
|
+
* what it is. Under the webpack `web` target `resolve.fallback.fs === false`
|
|
462
|
+
* makes this an empty module, so the probe fails and the caller falls back to
|
|
463
|
+
* `fetch`.
|
|
464
|
+
*/
|
|
465
|
+
async function getFileReader(): Promise<ReadFileUtf8 | null> {
|
|
466
|
+
try {
|
|
467
|
+
const mod: unknown = await import('fs');
|
|
468
|
+
const candidates = [
|
|
469
|
+
mod,
|
|
470
|
+
(mod as { default?: unknown }).default,
|
|
471
|
+
];
|
|
472
|
+
for (const candidate of candidates) {
|
|
473
|
+
const promisesApi = (candidate as { promises?: { readFile?: unknown } } | undefined)?.promises;
|
|
474
|
+
if (typeof promisesApi?.readFile === 'function') {
|
|
475
|
+
return promisesApi.readFile as ReadFileUtf8;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
return null;
|
|
479
|
+
} catch {
|
|
480
|
+
// No filesystem module resolvable at all — definitively not Node.
|
|
481
|
+
return null;
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
/** Directory holding this module, as a filesystem path. Node only. */
|
|
486
|
+
function moduleDirectory(): string {
|
|
487
|
+
const url = import.meta.url;
|
|
488
|
+
const withoutScheme = url.startsWith('file://') ? url.slice('file://'.length) : url;
|
|
489
|
+
const decoded = decodeURIComponent(withoutScheme);
|
|
490
|
+
return decoded.slice(0, decoded.lastIndexOf('/'));
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Find the directory containing `assets/` by walking up from this module.
|
|
495
|
+
*
|
|
496
|
+
* Searching rather than assuming a fixed number of levels keeps this correct
|
|
497
|
+
* whether the module runs from `src/metamodel-manager/` under Vitest or from a
|
|
498
|
+
* bundle in `dist/`, as long as `assets/` sits somewhere above it. A sentinel
|
|
499
|
+
* file is checked so a same-named unrelated directory cannot match.
|
|
500
|
+
*/
|
|
501
|
+
async function discoverNodeAssetRoot(readFile: ReadFileUtf8): Promise<string> {
|
|
502
|
+
const sentinel = `${ASSET_ROOT}/${BUNDLED_ASSETS[0].path}`;
|
|
503
|
+
let directory = moduleDirectory();
|
|
504
|
+
|
|
505
|
+
for (let depth = 0; depth < 8 && directory.length > 1; depth += 1) {
|
|
506
|
+
try {
|
|
507
|
+
await readFile(`${directory}/${sentinel}`, 'utf-8');
|
|
508
|
+
return directory;
|
|
509
|
+
} catch {
|
|
510
|
+
directory = directory.slice(0, directory.lastIndexOf('/'));
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
throw new Error(
|
|
515
|
+
`Could not locate the bundled '${ASSET_ROOT}/' directory by walking up from ${moduleDirectory()}. ` +
|
|
516
|
+
'Call configureAssetRoot() with the directory that contains it.',
|
|
517
|
+
);
|
|
518
|
+
}
|
|
519
|
+
|
|
520
|
+
/** Resolve the Node-side directory containing `assets/`, memoizing the search. */
|
|
521
|
+
async function nodeAssetRoot(readFile: ReadFileUtf8): Promise<string> {
|
|
522
|
+
if (assetRootOverride !== null) return assetRootOverride;
|
|
523
|
+
if (discoveredAssetRoot === null) {
|
|
524
|
+
discoveredAssetRoot = await discoverNodeAssetRoot(readFile);
|
|
525
|
+
}
|
|
526
|
+
return discoveredAssetRoot;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* URL a bundled asset is served from in the browser.
|
|
531
|
+
*
|
|
532
|
+
* Resolved against the document base URI when there is one, so a deployment
|
|
533
|
+
* under a sub-path still addresses the emitted files correctly. A build puts
|
|
534
|
+
* its assets' digest on it (`?v=…`): the static servers send no cache headers,
|
|
535
|
+
* and a browser would otherwise draw a glyph from its copy of the old file
|
|
536
|
+
* after the assets were synced again. The servers read the path alone.
|
|
537
|
+
*/
|
|
538
|
+
export interface BundledAssetOptions {
|
|
539
|
+
/** Per-consumer URL of the directory containing assets/. Never a module-global override. */
|
|
540
|
+
baseUrl?: string;
|
|
541
|
+
version?: string;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
export function assetUrl(assetPath: string, options: BundledAssetOptions = {}): string {
|
|
545
|
+
const version = options.version;
|
|
546
|
+
const relative = `${ASSET_ROOT}/${assetPath}${version ? `?v=${encodeURIComponent(version)}` : ''}`;
|
|
547
|
+
const baseUri = options.baseUrl ?? (typeof document !== 'undefined' ? document.baseURI : undefined);
|
|
548
|
+
return baseUri ? new URL(relative, baseUri).href : relative;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Read the Turtle text of a bundled asset.
|
|
553
|
+
*
|
|
554
|
+
* @param asset A registry entry, or an asset-root-relative path such as
|
|
555
|
+
* `archimate4/archimate4-onto.ttl`.
|
|
556
|
+
* @throws If the asset cannot be read — a missing file in Node, or a non-OK
|
|
557
|
+
* response in the browser.
|
|
558
|
+
*/
|
|
559
|
+
export async function fetchAssetText(asset: BundledAsset | string, options: BundledAssetOptions = {}): Promise<string> {
|
|
560
|
+
const assetPath = typeof asset === 'string' ? asset : asset.path;
|
|
561
|
+
|
|
562
|
+
const readFile = options.baseUrl ? null : await getFileReader();
|
|
563
|
+
if (readFile !== null) {
|
|
564
|
+
const root = await nodeAssetRoot(readFile);
|
|
565
|
+
return readFile(`${root}/${ASSET_ROOT}/${assetPath}`, 'utf-8');
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
if (typeof fetch !== 'function') {
|
|
569
|
+
throw new Error(
|
|
570
|
+
`Cannot read bundled asset '${assetPath}': no filesystem and no fetch available.`,
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
const url = assetUrl(assetPath, options);
|
|
575
|
+
// Revalidate: the static server sends no Cache-Control, and a re-synced
|
|
576
|
+
// snapshot must not be shadowed by the browser's copy of the old one.
|
|
577
|
+
const response = await fetch(url, { cache: 'no-cache' });
|
|
578
|
+
if (!response.ok) {
|
|
579
|
+
throw new Error(
|
|
580
|
+
`Failed to fetch bundled asset '${assetPath}' from ${url}: ${response.status} ${response.statusText}`,
|
|
581
|
+
);
|
|
582
|
+
}
|
|
583
|
+
return response.text();
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Read every bundled TTL asset, in dependency order.
|
|
588
|
+
*
|
|
589
|
+
* Requests run concurrently; the returned array preserves
|
|
590
|
+
* {@link BUNDLED_ASSETS} order so callers can load into the store in an order
|
|
591
|
+
* that satisfies `owl:imports`.
|
|
592
|
+
*/
|
|
593
|
+
export async function fetchAllAssetTexts(): Promise<
|
|
594
|
+
Array<{ asset: BundledAsset; ttl: string }>
|
|
595
|
+
> {
|
|
596
|
+
return Promise.all(
|
|
597
|
+
BUNDLED_ASSETS.map(async (asset) => ({ asset, ttl: await fetchAssetText(asset) })),
|
|
598
|
+
);
|
|
599
|
+
}
|