@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
package/package.json
CHANGED
|
@@ -1,6 +1,138 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@linked.archi/kernel",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "The Linked.Archi model kernel: metamodel loading, permitted relationships, IRIs, model changes, diff and merge, SHACL validation and canonical Turtle, shared by la-gram and the Linked.Archi workspace.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/linked-archi/kernel.git"
|
|
9
|
+
},
|
|
10
|
+
"homepage": "https://github.com/linked-archi/kernel#readme",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/linked-archi/kernel/issues"
|
|
13
|
+
},
|
|
14
|
+
"type": "module",
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=22"
|
|
17
|
+
},
|
|
18
|
+
"exports": {
|
|
19
|
+
".": "./src/index.ts",
|
|
20
|
+
"./rdf-engine": "./src/rdf-engine/index.ts",
|
|
21
|
+
"./metamodel-manager": "./src/metamodel-manager/index.ts",
|
|
22
|
+
"./model-manager": "./src/model-manager/index.ts",
|
|
23
|
+
"./assets/*": "./assets/*",
|
|
24
|
+
"./package.json": "./package.json",
|
|
25
|
+
"./property-shapes": "./src/metamodel-manager/property-shapes.ts",
|
|
26
|
+
"./conformance": "./src/conformance.ts",
|
|
27
|
+
"./import-export/model-io.js": "./src/import-export/model-io.ts",
|
|
28
|
+
"./index.js": "./src/index.ts",
|
|
29
|
+
"./metamodel-manager/asset-sources.js": "./src/metamodel-manager/asset-sources.ts",
|
|
30
|
+
"./metamodel-manager/bundled-assets.js": "./src/metamodel-manager/bundled-assets.ts",
|
|
31
|
+
"./metamodel-manager/catalogue.js": "./src/metamodel-manager/catalogue.ts",
|
|
32
|
+
"./metamodel-manager/index.js": "./src/metamodel-manager/index.ts",
|
|
33
|
+
"./metamodel-manager/interfaces.js": "./src/metamodel-manager/interfaces.ts",
|
|
34
|
+
"./metamodel-manager/metamodel-loader.js": "./src/metamodel-manager/metamodel-loader.ts",
|
|
35
|
+
"./metamodel-manager/notation-resolver.js": "./src/metamodel-manager/notation-resolver.ts",
|
|
36
|
+
"./metamodel-manager/notation.js": "./src/metamodel-manager/notation.ts",
|
|
37
|
+
"./metamodel-manager/palette-generator.js": "./src/metamodel-manager/palette-generator.ts",
|
|
38
|
+
"./metamodel-manager/property-shapes.js": "./src/metamodel-manager/property-shapes.ts",
|
|
39
|
+
"./metamodel-manager/taxonomy.js": "./src/metamodel-manager/taxonomy.ts",
|
|
40
|
+
"./metamodel-manager/type-guide.js": "./src/metamodel-manager/type-guide.ts",
|
|
41
|
+
"./metamodel-manager/viewpoint-manager.js": "./src/metamodel-manager/viewpoint-manager.ts",
|
|
42
|
+
"./model-manager/appearance.js": "./src/model-manager/appearance.ts",
|
|
43
|
+
"./model-manager/cascade.js": "./src/model-manager/cascade.ts",
|
|
44
|
+
"./model-manager/clipboard.js": "./src/model-manager/clipboard.ts",
|
|
45
|
+
"./model-manager/context-names.js": "./src/model-manager/context-names.ts",
|
|
46
|
+
"./model-manager/custom-properties.js": "./src/model-manager/custom-properties.ts",
|
|
47
|
+
"./model-manager/derivations.js": "./src/model-manager/derivations.ts",
|
|
48
|
+
"./model-manager/direct-permissions.js": "./src/model-manager/direct-permissions.ts",
|
|
49
|
+
"./model-manager/element-manager.js": "./src/model-manager/element-manager.ts",
|
|
50
|
+
"./model-manager/element-pictures.js": "./src/model-manager/element-pictures.ts",
|
|
51
|
+
"./model-manager/field-names.js": "./src/model-manager/field-names.ts",
|
|
52
|
+
"./model-manager/folders.js": "./src/model-manager/folders.ts",
|
|
53
|
+
"./model-manager/grid.js": "./src/model-manager/grid.ts",
|
|
54
|
+
"./model-manager/index.js": "./src/model-manager/index.ts",
|
|
55
|
+
"./model-manager/interfaces.js": "./src/model-manager/interfaces.ts",
|
|
56
|
+
"./model-manager/iri-conformance.js": "./src/model-manager/iri-conformance.ts",
|
|
57
|
+
"./model-manager/label-expression.js": "./src/model-manager/label-expression.ts",
|
|
58
|
+
"./model-manager/model-diff-text.js": "./src/model-manager/model-diff-text.ts",
|
|
59
|
+
"./model-manager/model-diff.js": "./src/model-manager/model-diff.ts",
|
|
60
|
+
"./model-manager/model-merge.js": "./src/model-manager/model-merge.ts",
|
|
61
|
+
"./model-manager/model-namespace.js": "./src/model-manager/model-namespace.ts",
|
|
62
|
+
"./model-manager/model-operations.js": "./src/model-manager/model-operations.ts",
|
|
63
|
+
"./model-manager/model-queries.js": "./src/model-manager/model-queries.ts",
|
|
64
|
+
"./model-manager/model-session.js": "./src/model-manager/model-session.ts",
|
|
65
|
+
"./model-manager/multiplicity.js": "./src/model-manager/multiplicity.ts",
|
|
66
|
+
"./model-manager/nested-resources.js": "./src/model-manager/nested-resources.ts",
|
|
67
|
+
"./model-manager/property-catalog.js": "./src/model-manager/property-catalog.ts",
|
|
68
|
+
"./model-manager/proposal-order.js": "./src/model-manager/proposal-order.ts",
|
|
69
|
+
"./model-manager/provenance.js": "./src/model-manager/provenance.ts",
|
|
70
|
+
"./model-manager/questions.js": "./src/model-manager/questions.ts",
|
|
71
|
+
"./model-manager/rdf-scope.js": "./src/model-manager/rdf-scope.ts",
|
|
72
|
+
"./model-manager/relationship-graph.js": "./src/model-manager/relationship-graph.ts",
|
|
73
|
+
"./model-manager/relationship-manager.js": "./src/model-manager/relationship-manager.ts",
|
|
74
|
+
"./model-manager/relationship-table.js": "./src/model-manager/relationship-table.ts",
|
|
75
|
+
"./model-manager/relationship-validity.js": "./src/model-manager/relationship-validity.ts",
|
|
76
|
+
"./model-manager/resource-edits.js": "./src/model-manager/resource-edits.ts",
|
|
77
|
+
"./model-manager/short-hash.js": "./src/model-manager/short-hash.ts",
|
|
78
|
+
"./model-manager/snapshot-lines.js": "./src/model-manager/snapshot-lines.ts",
|
|
79
|
+
"./model-manager/version-history.js": "./src/model-manager/version-history.ts",
|
|
80
|
+
"./model-manager/view-from-results.js": "./src/model-manager/view-from-results.ts",
|
|
81
|
+
"./model-manager/view-manager.js": "./src/model-manager/view-manager.ts",
|
|
82
|
+
"./model-manager/vocabulary.js": "./src/model-manager/vocabulary.ts",
|
|
83
|
+
"./rdf-engine/finding-shape.js": "./src/rdf-engine/finding-shape.ts",
|
|
84
|
+
"./rdf-engine/index.js": "./src/rdf-engine/index.ts",
|
|
85
|
+
"./rdf-engine/interfaces.js": "./src/rdf-engine/interfaces.ts",
|
|
86
|
+
"./rdf-engine/iri.js": "./src/rdf-engine/iri.ts",
|
|
87
|
+
"./rdf-engine/localized-text.js": "./src/rdf-engine/localized-text.ts",
|
|
88
|
+
"./rdf-engine/namespaces.js": "./src/rdf-engine/namespaces.ts",
|
|
89
|
+
"./rdf-engine/observable-store.js": "./src/rdf-engine/observable-store.ts",
|
|
90
|
+
"./rdf-engine/rdf-store.js": "./src/rdf-engine/rdf-store.ts",
|
|
91
|
+
"./rdf-engine/shacl-validator.js": "./src/rdf-engine/shacl-validator.ts",
|
|
92
|
+
"./rdf-engine/shape-switches.js": "./src/rdf-engine/shape-switches.ts",
|
|
93
|
+
"./rdf-engine/single-valued.js": "./src/rdf-engine/single-valued.ts",
|
|
94
|
+
"./rdf-engine/sparql-constraints.js": "./src/rdf-engine/sparql-constraints.ts",
|
|
95
|
+
"./rdf-engine/term-codec.js": "./src/rdf-engine/term-codec.ts",
|
|
96
|
+
"./rdf-engine/ttl-parser.js": "./src/rdf-engine/ttl-parser.ts",
|
|
97
|
+
"./rdf-engine/ttl-serializer.js": "./src/rdf-engine/ttl-serializer.ts",
|
|
98
|
+
"./rdf-engine/validation-engine.js": "./src/rdf-engine/validation-engine.ts",
|
|
99
|
+
"./rdf-engine/validation-service.js": "./src/rdf-engine/validation-service.ts",
|
|
100
|
+
"./rdf-engine/validation.worker.js": "./src/rdf-engine/validation.worker.ts"
|
|
101
|
+
},
|
|
102
|
+
"files": [
|
|
103
|
+
"src",
|
|
104
|
+
"!src/**/__tests__",
|
|
105
|
+
"!src/__tests__",
|
|
106
|
+
"assets",
|
|
107
|
+
"scripts/sync-assets.mjs",
|
|
108
|
+
"LICENSE",
|
|
109
|
+
"NOTICE",
|
|
110
|
+
"README.md",
|
|
111
|
+
"fixtures"
|
|
112
|
+
],
|
|
113
|
+
"sideEffects": false,
|
|
114
|
+
"scripts": {
|
|
115
|
+
"typecheck": "tsc --noEmit",
|
|
116
|
+
"test": "vitest --run",
|
|
117
|
+
"test:watch": "vitest",
|
|
118
|
+
"test:coverage": "vitest --run --coverage",
|
|
119
|
+
"sync-assets": "node scripts/sync-assets.mjs",
|
|
120
|
+
"bench:model": "node scripts/bench-model.mjs",
|
|
121
|
+
"pack:check": "npm pack --dry-run"
|
|
122
|
+
},
|
|
123
|
+
"dependencies": {
|
|
124
|
+
"@rdfjs/types": "^2.0.1",
|
|
125
|
+
"n3": "2.13.12",
|
|
126
|
+
"oxigraph": "0.5.13",
|
|
127
|
+
"rdf-validate-shacl": "^0.5.0",
|
|
128
|
+
"@types/n3": "^1.26.1",
|
|
129
|
+
"@types/rdf-validate-shacl": "^0.5.7"
|
|
130
|
+
},
|
|
131
|
+
"devDependencies": {
|
|
132
|
+
"@types/node": "^24.19.2",
|
|
133
|
+
"@vitest/coverage-v8": "^4.1.12",
|
|
134
|
+
"fast-check": "^3.17.0",
|
|
135
|
+
"typescript": "^5.4.0",
|
|
136
|
+
"vitest": "^4.1.12"
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Refresh the bundled snapshot from meta.linked.archi by default, or explicitly
|
|
4
|
+
* from a local linked-archi-meta checkout (--meta / LINKED_ARCHI_META).
|
|
5
|
+
*
|
|
6
|
+
* npm run sync-assets published assets
|
|
7
|
+
* npm run sync-assets -- --check compare without writing
|
|
8
|
+
* npm run sync-assets -- --meta <path> local publishing scripts + catalogue
|
|
9
|
+
* npm run sync-assets -- --online published assets, ignoring the env override
|
|
10
|
+
*
|
|
11
|
+
* Builds copy assets/ as it stands; run this before building to refresh it.
|
|
12
|
+
* All inputs are fetched and validated before replacing any bundled file, so
|
|
13
|
+
* an unavailable asset cannot leave a partially refreshed network snapshot.
|
|
14
|
+
*/
|
|
15
|
+
import { execFileSync } from 'node:child_process';
|
|
16
|
+
import { existsSync, mkdtempSync, readFileSync, readdirSync, rmSync, statSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
17
|
+
import { tmpdir } from 'node:os';
|
|
18
|
+
import { dirname, join, relative, resolve, sep } from 'node:path';
|
|
19
|
+
import { fileURLToPath } from 'node:url';
|
|
20
|
+
import { Parser } from 'n3';
|
|
21
|
+
|
|
22
|
+
const ROOT = resolve(dirname(fileURLToPath(import.meta.url)), '..');
|
|
23
|
+
const SITE_BASE = 'https://meta.linked.archi/';
|
|
24
|
+
const CATALOGUE = 'catalog.ttl';
|
|
25
|
+
|
|
26
|
+
class UsageError extends Error {}
|
|
27
|
+
|
|
28
|
+
/** No checkout is inferred: an explicit CLI or environment value selects local mode. */
|
|
29
|
+
export function parseOptions(args, env = {}) {
|
|
30
|
+
let check = false;
|
|
31
|
+
let meta;
|
|
32
|
+
let online = false;
|
|
33
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
34
|
+
const arg = args[i];
|
|
35
|
+
if (arg === '--check') check = true;
|
|
36
|
+
else if (arg === '--online') online = true;
|
|
37
|
+
else if (arg === '--meta') {
|
|
38
|
+
meta = args[++i];
|
|
39
|
+
if (!meta || meta.startsWith('--')) throw new UsageError('--meta requires a checkout path.');
|
|
40
|
+
} else throw new UsageError(`Unknown option: ${arg}`);
|
|
41
|
+
}
|
|
42
|
+
if (online && meta) throw new UsageError('Choose either --online or --meta <path>.');
|
|
43
|
+
return { check, meta: online ? undefined : meta ?? (env.LINKED_ARCHI_META || undefined) };
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Every file below a directory, deterministically ordered; dotfiles are not bundled. */
|
|
47
|
+
function filesUnder(dir) {
|
|
48
|
+
const out = [];
|
|
49
|
+
const walk = (at) => {
|
|
50
|
+
for (const name of readdirSync(at).sort()) {
|
|
51
|
+
if (name.startsWith('.')) continue;
|
|
52
|
+
const path = join(at, name);
|
|
53
|
+
if (statSync(path).isDirectory()) walk(path);
|
|
54
|
+
else out.push(relative(dir, path).split(sep).join('/'));
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
walk(dir);
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** The namespace publishing rule used by linked-archi-meta's copy-ttl-sources.sh. */
|
|
62
|
+
function namespaceOf(text) {
|
|
63
|
+
const vann = /preferredNamespaceUri[^"]*"([^"]+)"/.exec(text);
|
|
64
|
+
if (vann) return vann[1].trim();
|
|
65
|
+
const prefix = /^@prefix :\s*<([^>]+)>/m.exec(text);
|
|
66
|
+
if (prefix) return prefix[1].trim();
|
|
67
|
+
return /^@base\s*<([^>]+)>/m.exec(text)?.[1].trim();
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** TTLs are addressed by namespace, not by the local bundle's filename. */
|
|
71
|
+
function publishedPath(assetPath, assets) {
|
|
72
|
+
if (assetPath === CATALOGUE || !assetPath.endsWith('.ttl')) return assetPath;
|
|
73
|
+
const ns = namespaceOf(readFileSync(join(assets, assetPath), 'utf8'));
|
|
74
|
+
if (!ns?.startsWith(SITE_BASE)) return undefined;
|
|
75
|
+
const path = ns.slice(SITE_BASE.length).replace(/#$/, '').replace(/\/$/, '');
|
|
76
|
+
return path ? `${path}/ontology.ttl` : undefined;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/** Parse RDF rather than accepting an HTML error page returned with status 200. */
|
|
80
|
+
function validateBody(bytes, path, contentType = '') {
|
|
81
|
+
if (/text\/html|application\/xhtml\+xml/i.test(contentType)) throw new Error(`HTML response for ${path}`);
|
|
82
|
+
if (path.endsWith('.ttl')) {
|
|
83
|
+
try {
|
|
84
|
+
if (!new Parser().parse(bytes.toString('utf8')).length) throw new Error('empty document');
|
|
85
|
+
}
|
|
86
|
+
catch (error) { throw new Error(`Invalid Turtle for ${path}: ${error.message}`); }
|
|
87
|
+
} else if (path.endsWith('.svg')) {
|
|
88
|
+
// An HTML error page may contain an SVG logo. Require an SVG document root,
|
|
89
|
+
// allowing the XML declaration/comments used by SVG exporters before it.
|
|
90
|
+
const body = bytes.toString('utf8').replace(/^\uFEFF/, '')
|
|
91
|
+
.replace(/^\s*(?:<\?xml[\s\S]*?\?>\s*)?(?:<!--[\s\S]*?-->\s*)*/, '')
|
|
92
|
+
.replace(/^<!DOCTYPE\s+svg\b[^>]*>\s*/i, '')
|
|
93
|
+
.replace(/^(?:<!--[\s\S]*?-->\s*)*/, '');
|
|
94
|
+
if (!/^<svg(?:\s|\/?>)/i.test(body)) throw new Error(`Invalid SVG for ${path}`);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Avoid opening hundreds of connections while fetching the bundled snapshot. */
|
|
99
|
+
async function mapLimited(items, run) {
|
|
100
|
+
let next = 0;
|
|
101
|
+
const results = new Array(items.length);
|
|
102
|
+
const workers = Array.from({ length: Math.min(8, items.length) }, async () => {
|
|
103
|
+
while (next < items.length) {
|
|
104
|
+
const index = next++;
|
|
105
|
+
results[index] = await run(items[index]);
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
// Wait for all workers even after failure; no background fetch outlives this sync.
|
|
109
|
+
const settled = await Promise.allSettled(workers);
|
|
110
|
+
const failure = settled.find((result) => result.status === 'rejected');
|
|
111
|
+
if (failure) throw failure.reason;
|
|
112
|
+
return results;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
/** Discover newly referenced icons in folders that this application already bundles. */
|
|
116
|
+
function referencedIcons(staged, iconFolders) {
|
|
117
|
+
const paths = new Set();
|
|
118
|
+
for (const [path, bytes] of staged) {
|
|
119
|
+
if (!path.endsWith('.ttl') || path === CATALOGUE) continue;
|
|
120
|
+
for (const quad of new Parser().parse(bytes.toString('utf8'))) {
|
|
121
|
+
const value = quad.object.value;
|
|
122
|
+
if (!value.startsWith(SITE_BASE)) continue;
|
|
123
|
+
const iconPath = value.slice(SITE_BASE.length);
|
|
124
|
+
if (!/\.svg$/.test(iconPath) || !iconFolders.includes(dirname(iconPath))) continue;
|
|
125
|
+
// Keep publication paths within the existing bundle's folders.
|
|
126
|
+
if (iconPath.split('/').some((part) => part === '..' || part === '.')) continue;
|
|
127
|
+
if (!staged.has(iconPath)) paths.add(iconPath);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return [...paths].sort();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/** Refresh or compare the snapshot. Exported for isolated filesystem/network regression tests. */
|
|
134
|
+
export async function syncAssets({ root = ROOT, meta, check = false, fetchImpl = globalThis.fetch, log = console.log } = {}) {
|
|
135
|
+
const assets = join(root, 'assets');
|
|
136
|
+
const bundled = filesUnder(assets);
|
|
137
|
+
const staged = new Map();
|
|
138
|
+
const own = [];
|
|
139
|
+
const iconFolders = [...new Set(bundled.filter((path) => !path.endsWith('.ttl')).map(dirname))];
|
|
140
|
+
const localMeta = meta ? resolve(meta) : undefined;
|
|
141
|
+
let site;
|
|
142
|
+
let noCatalogue = false;
|
|
143
|
+
try {
|
|
144
|
+
if (localMeta) {
|
|
145
|
+
for (const script of ['copy-ttl-sources.sh', 'copy-icon-assets.sh']) {
|
|
146
|
+
if (!existsSync(join(localMeta, '.scripts', script))) {
|
|
147
|
+
throw new UsageError(`No linked-archi-meta checkout at ${localMeta} (missing .scripts/${script}).`);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
site = mkdtempSync(join(tmpdir(), 'la-gram-sync-'));
|
|
151
|
+
for (const script of ['copy-ttl-sources.sh', 'copy-icon-assets.sh']) {
|
|
152
|
+
execFileSync('bash', [join(localMeta, '.scripts', script), site], { stdio: 'pipe' });
|
|
153
|
+
}
|
|
154
|
+
const generatedCatalogue = join(localMeta, '.onto-docs', CATALOGUE);
|
|
155
|
+
for (const path of new Set([...bundled, CATALOGUE])) {
|
|
156
|
+
const from = path === CATALOGUE ? generatedCatalogue : publishedPath(path, assets);
|
|
157
|
+
const source = path === CATALOGUE ? from : from ? join(site, from) : undefined;
|
|
158
|
+
if (path === CATALOGUE && !existsSync(generatedCatalogue)) {
|
|
159
|
+
noCatalogue = true;
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
if (!source || !existsSync(source)) { own.push(path); continue; }
|
|
163
|
+
const bytes = readFileSync(source);
|
|
164
|
+
validateBody(bytes, path);
|
|
165
|
+
staged.set(path, bytes);
|
|
166
|
+
}
|
|
167
|
+
// A local publishing tree can enumerate new icons, including unreferenced ones.
|
|
168
|
+
for (const folder of iconFolders) {
|
|
169
|
+
const published = join(site, folder);
|
|
170
|
+
if (!existsSync(published)) continue;
|
|
171
|
+
for (const name of readdirSync(published).sort()) {
|
|
172
|
+
if (name.startsWith('.') || !statSync(join(published, name)).isFile()) continue;
|
|
173
|
+
const path = `${folder}/${name}`;
|
|
174
|
+
if (!staged.has(path)) {
|
|
175
|
+
const bytes = readFileSync(join(published, name));
|
|
176
|
+
validateBody(bytes, path);
|
|
177
|
+
staged.set(path, bytes);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
} else {
|
|
182
|
+
const download = async (path, remotePath) => {
|
|
183
|
+
const url = new URL(remotePath, SITE_BASE).href;
|
|
184
|
+
let response;
|
|
185
|
+
try {
|
|
186
|
+
response = await fetchImpl(url, {
|
|
187
|
+
headers: { Accept: path.endsWith('.ttl') ? 'text/turtle' : path.endsWith('.svg') ? 'image/svg+xml' : 'application/octet-stream' },
|
|
188
|
+
cache: 'no-cache',
|
|
189
|
+
signal: AbortSignal.timeout(20_000),
|
|
190
|
+
});
|
|
191
|
+
if (!response.ok) throw new Error(`HTTP ${response.status}`);
|
|
192
|
+
const bytes = Buffer.from(await response.arrayBuffer());
|
|
193
|
+
validateBody(bytes, path, response.headers.get('content-type') ?? '');
|
|
194
|
+
return [path, bytes];
|
|
195
|
+
} catch (error) { throw new Error(`Cannot sync ${url}: ${error.message}`); }
|
|
196
|
+
};
|
|
197
|
+
const requests = [];
|
|
198
|
+
for (const path of new Set([...bundled, CATALOGUE])) {
|
|
199
|
+
const from = publishedPath(path, assets);
|
|
200
|
+
if (from) requests.push([path, from]);
|
|
201
|
+
else own.push(path);
|
|
202
|
+
}
|
|
203
|
+
for (const [path, bytes] of await mapLimited(requests, ([path, from]) => download(path, from))) staged.set(path, bytes);
|
|
204
|
+
for (const [path, bytes] of await mapLimited(referencedIcons(staged, iconFolders), (path) => download(path, path))) staged.set(path, bytes);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const unchanged = [];
|
|
208
|
+
const updated = [];
|
|
209
|
+
const added = [];
|
|
210
|
+
for (const [path, bytes] of staged) {
|
|
211
|
+
const target = join(assets, path);
|
|
212
|
+
if (!existsSync(target)) added.push(path);
|
|
213
|
+
else if (readFileSync(target).equals(bytes)) unchanged.push(path);
|
|
214
|
+
else updated.push(path);
|
|
215
|
+
}
|
|
216
|
+
// Every input has succeeded before the first bundled file is changed.
|
|
217
|
+
if (!check) {
|
|
218
|
+
for (const path of [...updated, ...added]) {
|
|
219
|
+
const target = join(assets, path);
|
|
220
|
+
mkdirSync(dirname(target), { recursive: true });
|
|
221
|
+
writeFileSync(target, staged.get(path));
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
log(`Source: ${localMeta ? `local ${localMeta}` : SITE_BASE}`);
|
|
225
|
+
log(`${unchanged.length} unchanged, ${updated.length} ${check ? 'differ' : 'updated'}, ${added.length} ${check ? 'missing' : 'added'}, ${own.length} own (not mapped to this source)`);
|
|
226
|
+
for (const path of updated) log(` ${check ? 'differs' : 'updated'} ${path}`);
|
|
227
|
+
for (const path of added) log(` ${check ? 'missing' : 'added'} ${path}`);
|
|
228
|
+
for (const path of own) log(` own ${path}`);
|
|
229
|
+
if (noCatalogue) log(` kept ${CATALOGUE} — no ${join(localMeta, '.onto-docs', CATALOGUE)}; generate the full catalogue in that checkout first`);
|
|
230
|
+
if (!check && (updated.length || added.length)) log('Rebuild to ship it: npm run build');
|
|
231
|
+
return { unchanged, updated, added, own };
|
|
232
|
+
} finally {
|
|
233
|
+
if (site) rmSync(site, { recursive: true, force: true });
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export async function main(args = process.argv.slice(2), env = process.env) {
|
|
238
|
+
if (args.length === 1 && ['--help', '-h'].includes(args[0])) {
|
|
239
|
+
console.log('Usage: npm run sync-assets -- [--check] [--online | --meta <checkout>]\nDefault: https://meta.linked.archi/. LINKED_ARCHI_META explicitly selects a local checkout; --online overrides it.');
|
|
240
|
+
return 0;
|
|
241
|
+
}
|
|
242
|
+
try {
|
|
243
|
+
const options = parseOptions(args, env);
|
|
244
|
+
const result = await syncAssets(options);
|
|
245
|
+
return options.check && (result.updated.length || result.added.length) ? 1 : 0;
|
|
246
|
+
} catch (error) {
|
|
247
|
+
console.error(error.message);
|
|
248
|
+
return error instanceof UsageError ? 2 : 1;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (process.argv[1] && resolve(process.argv[1]) === fileURLToPath(import.meta.url)) process.exitCode = await main();
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { ValidationResult } from './rdf-engine/interfaces.js';
|
|
2
|
+
import type { PlainResult } from './rdf-engine/validation-engine.js';
|
|
3
|
+
|
|
4
|
+
/** The observable outputs of a consumer's normal model open, save and validation (KReq 1.4). */
|
|
5
|
+
export interface ShopConformanceResult {
|
|
6
|
+
modelIri: string | undefined;
|
|
7
|
+
metamodelIris: readonly string[];
|
|
8
|
+
trig: string;
|
|
9
|
+
findings: readonly PlainResult[];
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/** Project validation terms to transportable data for comparisons across runtimes. */
|
|
13
|
+
export function conformanceFindings(report: { results: readonly ValidationResult[] }): PlainResult[] {
|
|
14
|
+
return report.results.map(result => ({
|
|
15
|
+
focusNode: result.focusNode.value,
|
|
16
|
+
resultPath: result.resultPath.value,
|
|
17
|
+
sourceShape: result.sourceShape.value,
|
|
18
|
+
message: result.message,
|
|
19
|
+
severity: result.severity,
|
|
20
|
+
...(result.sourceConstraintComponent && { sourceConstraintComponent: result.sourceConstraintComponent.value }),
|
|
21
|
+
...(result.withinShape && { withinShape: result.withinShape.value }),
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function sortedFindings(findings: readonly PlainResult[]): string[] {
|
|
26
|
+
return findings.map(finding => JSON.stringify([
|
|
27
|
+
finding.focusNode,
|
|
28
|
+
finding.resultPath,
|
|
29
|
+
finding.sourceShape,
|
|
30
|
+
finding.message,
|
|
31
|
+
finding.severity,
|
|
32
|
+
finding.sourceConstraintComponent,
|
|
33
|
+
finding.withinShape,
|
|
34
|
+
])).sort();
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Qualify the bundled shop model using the consumer's own open, export and validate path.
|
|
39
|
+
* The reader can use a filesystem or a test host. The canonical sample retains full TriG
|
|
40
|
+
* graph identities, model and view IRIs, and all three named SHACL findings.
|
|
41
|
+
*/
|
|
42
|
+
export async function runShopConformance(
|
|
43
|
+
readText: (file: URL) => Promise<string>,
|
|
44
|
+
open: (text: string, filename: string) => Promise<ShopConformanceResult>,
|
|
45
|
+
): Promise<void> {
|
|
46
|
+
const [trig, expected] = await Promise.all([
|
|
47
|
+
readText(new URL('../fixtures/interoperability/archimate4-demo.trig', import.meta.url)),
|
|
48
|
+
readText(new URL('../fixtures/interoperability/expected-findings.json', import.meta.url)),
|
|
49
|
+
]);
|
|
50
|
+
const result = await open(trig, 'archimate4-demo.trig');
|
|
51
|
+
if (result.modelIri !== 'https://example.org/acme/shop/model') {
|
|
52
|
+
throw new Error(`Shop conformance: expected the shop model IRI, got ${result.modelIri ?? 'none'}.`);
|
|
53
|
+
}
|
|
54
|
+
if (result.metamodelIris.length !== 1 ||
|
|
55
|
+
result.metamodelIris[0] !== 'https://meta.linked.archi/archimate4/metamodel#ArchiMate4') {
|
|
56
|
+
throw new Error(`Shop conformance: expected the pinned ArchiMate 4.0 metamodel, got ${result.metamodelIris.join(', ') || 'none'}.`);
|
|
57
|
+
}
|
|
58
|
+
if (result.trig !== trig) {
|
|
59
|
+
throw new Error('Shop conformance: saved TriG differs from the canonical fixture.');
|
|
60
|
+
}
|
|
61
|
+
const expectedFindings = sortedFindings(JSON.parse(expected) as PlainResult[]);
|
|
62
|
+
const actualFindings = sortedFindings(result.findings);
|
|
63
|
+
if (JSON.stringify(actualFindings) !== JSON.stringify(expectedFindings)) {
|
|
64
|
+
throw new Error(`Shop conformance: SHACL findings differ. Expected ${expectedFindings.join('; ')}. Got ${actualFindings.join('; ')}.`);
|
|
65
|
+
}
|
|
66
|
+
}
|