@linked.archi/kernel 0.0.0-stage → 0.1.6
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 +102 -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 +917 -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 +895 -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 +7406 -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 +851 -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 +475 -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/native-load.ts +37 -0
- package/src/rdf-engine/observable-store.ts +609 -0
- package/src/rdf-engine/rdf-store.ts +520 -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 +349 -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 +747 -0
- package/src/rdf-engine/validation-service.ts +186 -0
- package/src/rdf-engine/validation.worker.ts +47 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* IRI minting.
|
|
3
|
+
*
|
|
4
|
+
* Every model resource gets an IRI when it is created and keeps it for life:
|
|
5
|
+
* a rename, a move to another view or a round-trip through a file must never
|
|
6
|
+
* change what a concept is called, because other models, commits and people's
|
|
7
|
+
* links point at it. The only safe way to guarantee that across machines and
|
|
8
|
+
* collaborators is a random UUID — a counter restarts with the process and two
|
|
9
|
+
* users' counters collide.
|
|
10
|
+
*
|
|
11
|
+
* ## Shape
|
|
12
|
+
*
|
|
13
|
+
* A model owns a namespace, `{base}{notation}/{modelId}/` (DD-15/DD-29 in the
|
|
14
|
+
* Linked.Archi design decisions), and what is minted for it follows the layout
|
|
15
|
+
* every Linked.Archi tool shares (DD-41):
|
|
16
|
+
*
|
|
17
|
+
* ```
|
|
18
|
+
* {ns}model the arch:Model
|
|
19
|
+
* {ns}{kind}/{uuid} an element, relationship, view or folder
|
|
20
|
+
* {view}#node-{uuid} {view}#link-{uuid} a shape drawn in a view, named in the view's IRI
|
|
21
|
+
* {owner}/{part}[/{key}] a part: {concept}/name/{context}, {folder}/item/{digest}, …
|
|
22
|
+
* {shape}-{part}[-{key}] a shape's part: {node}-style, {link}-points-{i}, {link}-point-{i}, …
|
|
23
|
+
* {ns}graph/model|semantic|views the DD-15 graphs, at rest only
|
|
24
|
+
* ```
|
|
25
|
+
*
|
|
26
|
+
* After a `#` everything is joined with `-`, which a Turtle prefixed name holds
|
|
27
|
+
* as it is. Which shape a part belongs to is read from the triples, not from its
|
|
28
|
+
* name.
|
|
29
|
+
*
|
|
30
|
+
* What la-gram minted before DD-41 keeps its name — `{ns}element-{uuid}`,
|
|
31
|
+
* `{ns}node-{uuid}`, `{node}-style`, `{link}-points-{i}`, `{link}-p{i}` — and
|
|
32
|
+
* is read as before: a tool never rewrites the local part of an IRI. Turtle
|
|
33
|
+
* writes the layout short (`rdf-engine/turtle-writer.ts`): `me:{uuid}`,
|
|
34
|
+
* `mv3ef7da72:node-{uuid}`.
|
|
35
|
+
*
|
|
36
|
+
* `base` is `https://example.org/` unless configured — a placeholder domain,
|
|
37
|
+
* reserved for exactly this. A team publishing its models sets its own, and a
|
|
38
|
+
* model's namespace can be changed afterwards (`model-namespace.ts`).
|
|
39
|
+
*/
|
|
40
|
+
|
|
41
|
+
/** Default base for models created in this tool. */
|
|
42
|
+
export const DEFAULT_MODEL_BASE = 'https://example.org/';
|
|
43
|
+
|
|
44
|
+
/** Local name of the `arch:Model` resource in its namespace. */
|
|
45
|
+
export const MODEL_LOCAL_NAME = 'model';
|
|
46
|
+
|
|
47
|
+
/** A random RFC 4122 v4 UUID. */
|
|
48
|
+
export function uuid(): string {
|
|
49
|
+
const cryptoApi = (globalThis as { crypto?: Crypto }).crypto;
|
|
50
|
+
// `randomUUID` needs a secure context in browsers; `localhost` and `https`
|
|
51
|
+
// are, but a page opened from `file://` may not be.
|
|
52
|
+
if (cryptoApi && typeof cryptoApi.randomUUID === 'function') {
|
|
53
|
+
try {
|
|
54
|
+
return cryptoApi.randomUUID();
|
|
55
|
+
} catch {
|
|
56
|
+
/* fall through */
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const bytes = new Uint8Array(16);
|
|
60
|
+
if (cryptoApi && typeof cryptoApi.getRandomValues === 'function') {
|
|
61
|
+
cryptoApi.getRandomValues(bytes);
|
|
62
|
+
} else {
|
|
63
|
+
for (let i = 0; i < bytes.length; i += 1) bytes[i] = Math.floor(Math.random() * 256);
|
|
64
|
+
}
|
|
65
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
66
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
67
|
+
const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
68
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Kinds of resource minted in a model's namespace, `{ns}{kind}/{uuid}`. A shape is minted in its view: {@link mintShapeIri}. */
|
|
72
|
+
export type MintKind = 'element' | 'relationship' | 'view' | 'folder';
|
|
73
|
+
|
|
74
|
+
/** Kinds of shape drawn in a view. */
|
|
75
|
+
export type ShapeKind = 'node' | 'link';
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* A namespace IRI ends in `/`, `#` or `:`, so a local name can follow it
|
|
79
|
+
* directly; anything else gets a `/`. A saved model's namespace is read so,
|
|
80
|
+
* whatever its form; a new one also passes {@link namespaceProblem}.
|
|
81
|
+
*/
|
|
82
|
+
export function ensureNamespace(namespace: string): string {
|
|
83
|
+
const ns = namespace.trim();
|
|
84
|
+
return /[/#:]$/.test(ns) ? ns : `${ns}/`;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A new IRI of the given kind in a model's namespace: `{ns}{kind}/{uuid}` (DD-41). */
|
|
88
|
+
export function mintIri(namespace: string, kind: MintKind): string {
|
|
89
|
+
return `${ensureNamespace(namespace)}${kind}/${uuid()}`;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* A new node's or link's IRI, named in its view's (DD-41): `{view}#node-{uuid}`,
|
|
94
|
+
* `{view}#link-{uuid}`. An IRI holds one `#`, so in a view whose IRI already
|
|
95
|
+
* holds one — a model saved with a namespace ending in `#` — the shape is minted
|
|
96
|
+
* flat in the model's namespace, `{ns}node-{uuid}`, as la-gram minted every
|
|
97
|
+
* shape before.
|
|
98
|
+
*/
|
|
99
|
+
export function mintShapeIri(viewIri: string, kind: ShapeKind, modelNamespace: () => string): string {
|
|
100
|
+
return viewIri.includes('#') ? `${ensureNamespace(modelNamespace())}${kind}-${uuid()}` : `${viewIri}#${kind}-${uuid()}`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* A part of `owner`, named under it (DD-41): `{owner}/{part}[/{key}]`, or, when
|
|
105
|
+
* `owner` is named in a fragment — a shape, `{view}#node-{uuid}` —
|
|
106
|
+
* `{owner}-{part}[-{key}]`, since after a `#` everything is joined with `-`.
|
|
107
|
+
*/
|
|
108
|
+
export function partIri(owner: string, ...segments: string[]): string {
|
|
109
|
+
return [owner, ...segments].join(owner.includes('#') ? '-' : '/');
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Whether `iri` is the part `part` of `owner`, named either way la-gram names
|
|
114
|
+
* parts — `{owner}/{part}`, or `{owner}-{part}`, as in a fragment and as before
|
|
115
|
+
* DD-41 — with `/{key}` or `-{key}` after it when `key` matches.
|
|
116
|
+
*/
|
|
117
|
+
export function isPartNamed(owner: string, iri: string, part: string, key?: RegExp): boolean {
|
|
118
|
+
if (!iri.startsWith(owner)) return false;
|
|
119
|
+
const rest = iri.slice(owner.length);
|
|
120
|
+
for (const joiner of ['/', '-']) {
|
|
121
|
+
const name = `${joiner}${part}`;
|
|
122
|
+
if (rest === name) return true;
|
|
123
|
+
if (key && rest.startsWith(`${name}${joiner}`) && new RegExp(`^(?:${key.source})$`).test(rest.slice(name.length + 1))) return true;
|
|
124
|
+
}
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* An identifier as one path segment, as the Linked.Archi converters encode it
|
|
130
|
+
* (Java's `URLEncoder`, a space as `%20`): so an Exchange file imported here and
|
|
131
|
+
* converted there gives the same local names.
|
|
132
|
+
*/
|
|
133
|
+
export function pathSegment(id: string): string {
|
|
134
|
+
return encodeURIComponent(id).replace(/[!'()~]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Whether `namespace` takes a reference relative to it: an `https:` or `http:`
|
|
139
|
+
* IRI ending in `/`, with no `#` or `?` — DD-41's rule for a model's namespace.
|
|
140
|
+
* A URN has no path to resolve against, and a `#` in it would give every shape two.
|
|
141
|
+
*/
|
|
142
|
+
export function isPathNamespace(namespace: string): boolean {
|
|
143
|
+
return /^https?:\/\/[^/?#\s]+\/(?:[^?#\s]*\/)?$/.test(namespace);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* A new model namespace, `{base}{notation}/{uuid}/`.
|
|
148
|
+
*
|
|
149
|
+
* @param base Namespace base; `https://example.org/` unless configured.
|
|
150
|
+
* @param notation The notation slug (`archimate`, `bpmn`, …) — the first path
|
|
151
|
+
* segment the published layout reserves for it.
|
|
152
|
+
*/
|
|
153
|
+
export function mintModelNamespace(base: string = DEFAULT_MODEL_BASE, notation = 'model'): string {
|
|
154
|
+
return `${ensureNamespace(base)}${notation}/${uuid()}/`;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The `arch:Model` IRI in a namespace: `{ns}model`. */
|
|
158
|
+
export function modelIriIn(namespace: string): string {
|
|
159
|
+
return `${ensureNamespace(namespace)}${MODEL_LOCAL_NAME}`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** A new model IRI: {@link modelIriIn} a fresh {@link mintModelNamespace}. */
|
|
163
|
+
export function mintModelIri(base: string = DEFAULT_MODEL_BASE, notation = 'model'): string {
|
|
164
|
+
return modelIriIn(mintModelNamespace(base, notation));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* The namespace an IRI sits in: everything up to its last `/` or `#` (or `:`
|
|
169
|
+
* for a URN). Used where no model says which namespace to mint in.
|
|
170
|
+
*/
|
|
171
|
+
export function namespaceOfIri(iri: string): string {
|
|
172
|
+
const cut = Math.max(iri.lastIndexOf('/'), iri.lastIndexOf('#'));
|
|
173
|
+
if (cut > iri.indexOf(':')) return iri.slice(0, cut + 1);
|
|
174
|
+
const colon = iri.lastIndexOf(':');
|
|
175
|
+
return colon >= 0 ? iri.slice(0, colon + 1) : ensureNamespace(iri);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Whether `namespace` is an absolute IRI usable as a model namespace. Returns
|
|
180
|
+
* the problem, or `null` when it is fine.
|
|
181
|
+
*/
|
|
182
|
+
export function namespaceProblem(namespace: string): string | null {
|
|
183
|
+
const ns = namespace.trim();
|
|
184
|
+
if (!ns) return 'The namespace is empty.';
|
|
185
|
+
if (/[\s<>"{}|\\^`]/.test(ns)) return 'The namespace contains characters an IRI cannot.';
|
|
186
|
+
if (!/^[A-Za-z][A-Za-z0-9+.-]*:./.test(ns)) return 'The namespace must be an absolute IRI, such as https://example.org/models/payments/.';
|
|
187
|
+
// DD-41: a diagram's shapes are named in their view's IRI after a `#`, and an IRI holds one.
|
|
188
|
+
if (/[#?]/.test(ns)) return 'The namespace cannot hold a # or a ?, such as https://example.org/models/payments/.';
|
|
189
|
+
if (!isPathNamespace(ensureNamespace(ns))) return 'The namespace must be an https: or http: IRI, such as https://example.org/models/payments/.';
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Notation slug for a metamodel IRI: `…/archimate4/metamodel#ArchiMate4` →
|
|
195
|
+
* `archimate`. Version digits are dropped so an ArchiMate 3.2 and a 4.0 model
|
|
196
|
+
* share the notation segment, as the published converters do.
|
|
197
|
+
*/
|
|
198
|
+
export function notationSlug(metamodelIri: string | undefined): string {
|
|
199
|
+
if (!metamodelIri) return 'model';
|
|
200
|
+
const match = /^https?:\/\/[^/]+\/([^/#]+)/.exec(metamodelIri);
|
|
201
|
+
const segment = match?.[1] ?? 'model';
|
|
202
|
+
return segment.replace(/[0-9.]+$/, '').replace(/[^a-z0-9-]/gi, '').toLowerCase() || 'model';
|
|
203
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/** Choose a label from the RDF literals an author supplied. */
|
|
2
|
+
export function selectLocalizedLiteral<T extends { termType: string; value: string; language?: string }>(
|
|
3
|
+
terms: readonly T[],
|
|
4
|
+
preferredLanguage = 'en',
|
|
5
|
+
): T | undefined {
|
|
6
|
+
const literals = terms.filter(term => term.termType === 'Literal' && term.value.trim());
|
|
7
|
+
const language = preferredLanguage.toLowerCase();
|
|
8
|
+
for (const tag of [language, language.split('-')[0], 'en', '']) {
|
|
9
|
+
const match = literals.find(term => (term.language ?? '').toLowerCase() === tag);
|
|
10
|
+
if (match) return match;
|
|
11
|
+
}
|
|
12
|
+
return literals[0];
|
|
13
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RDF namespace prefix constants used throughout the application.
|
|
3
|
+
*
|
|
4
|
+
* These correspond to the Linked.Archi core ontology (`arch:`),
|
|
5
|
+
* visualization ontology (`arch-vis:`), and standard W3C vocabularies.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/** Namespace URI constants. */
|
|
9
|
+
export const NAMESPACES = {
|
|
10
|
+
arch: 'https://meta.linked.archi/core#',
|
|
11
|
+
'arch-vis': 'https://meta.linked.archi/core-vis#',
|
|
12
|
+
skos: 'http://www.w3.org/2004/02/skos/core#',
|
|
13
|
+
sh: 'http://www.w3.org/ns/shacl#',
|
|
14
|
+
owl: 'http://www.w3.org/2002/07/owl#',
|
|
15
|
+
rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
|
|
16
|
+
rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
|
|
17
|
+
dc: 'http://purl.org/dc/elements/1.1/',
|
|
18
|
+
dcterms: 'http://purl.org/dc/terms/',
|
|
19
|
+
xsd: 'http://www.w3.org/2001/XMLSchema#',
|
|
20
|
+
prov: 'http://www.w3.org/ns/prov#',
|
|
21
|
+
vann: 'http://purl.org/vocab/vann/',
|
|
22
|
+
/**
|
|
23
|
+
* schema.org as la-gram and the converters write it, `https:`: a folder's name and entries, a picture, the
|
|
24
|
+
* provenance of edits (la-gram, a person). The `http:` form is read too where it matters (folders).
|
|
25
|
+
*/
|
|
26
|
+
schema: 'https://schema.org/',
|
|
27
|
+
} as const;
|
|
28
|
+
|
|
29
|
+
/** Prefix-to-namespace map (same data, typed for use with N3.js / serializers). */
|
|
30
|
+
export const PREFIXES: Record<string, string> = { ...NAMESPACES };
|
|
31
|
+
|
|
32
|
+
/** Helper: expand a prefixed name (e.g. "arch:Element") to a full IRI. */
|
|
33
|
+
export function expandPrefixedName(prefixed: string): string {
|
|
34
|
+
const colonIdx = prefixed.indexOf(':');
|
|
35
|
+
if (colonIdx === -1) return prefixed;
|
|
36
|
+
const prefix = prefixed.slice(0, colonIdx);
|
|
37
|
+
const local = prefixed.slice(colonIdx + 1);
|
|
38
|
+
const ns = NAMESPACES[prefix as keyof typeof NAMESPACES];
|
|
39
|
+
if (!ns) return prefixed;
|
|
40
|
+
return ns + local;
|
|
41
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Quads given to Oxigraph in one native load of N-Triples rather than quad by quad: on a model of 365 000 triples,
|
|
3
|
+
* 2.1 s against 55 s and 402 against 570 MiB of WebAssembly memory, measured in Node (KD-28, KD-29). For the quads
|
|
4
|
+
* N-Triples carries as they are; the rest go one by one.
|
|
5
|
+
*/
|
|
6
|
+
import { DataFactory, Writer } from 'n3';
|
|
7
|
+
import type { Quad, Term } from '@rdfjs/types';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Whether a term goes into a native load as it is: not a blank node, whose label a bulk load reassigns, nor a
|
|
11
|
+
* directional literal; a triple term of such terms.
|
|
12
|
+
*/
|
|
13
|
+
export function canLoadAsTriples(term: Term): boolean {
|
|
14
|
+
if (term.termType === 'BlankNode') return false;
|
|
15
|
+
if (term.termType === 'Literal') return !(term as { direction?: string }).direction;
|
|
16
|
+
if (term.termType === 'Quad') {
|
|
17
|
+
const triple = term as unknown as Quad;
|
|
18
|
+
return triple.graph.termType === 'DefaultGraph' && canLoadAsTriples(triple.subject) && canLoadAsTriples(triple.object);
|
|
19
|
+
}
|
|
20
|
+
return term.termType === 'NamedNode';
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** The quads a native load takes as they are, and the rest, for one by one. */
|
|
24
|
+
export function splitForNativeLoad(quads: Iterable<Quad>): { native: Quad[]; oneByOne: Quad[] } {
|
|
25
|
+
const native: Quad[] = [];
|
|
26
|
+
const oneByOne: Quad[] = [];
|
|
27
|
+
for (const q of quads) (canLoadAsTriples(q.subject) && canLoadAsTriples(q.object) ? native : oneByOne).push(q);
|
|
28
|
+
return { native, oneByOne };
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** The quads as N-Triples, each in the default graph: a load names the graph they go into. */
|
|
32
|
+
export function nTriples(quads: readonly Quad[]): string {
|
|
33
|
+
const triples = quads.map((q) =>
|
|
34
|
+
q.graph.termType === 'DefaultGraph' ? q : (DataFactory.quad(q.subject as never, q.predicate as never, q.object as never) as unknown as Quad),
|
|
35
|
+
);
|
|
36
|
+
return new Writer({ format: 'N-Triples' }).quadsToString(triples as never);
|
|
37
|
+
}
|