@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.
Files changed (365) hide show
  1. package/LICENSE +202 -0
  2. package/NOTICE +11 -0
  3. package/README.md +96 -2
  4. package/assets/arch-decision/arch-decision-metamodel.ttl +44 -0
  5. package/assets/arch-decision/arch-decision-onto.ttl +1566 -0
  6. package/assets/arch-decision/arch-decision-shapes.ttl +582 -0
  7. package/assets/arch-decision/arch-decision-tax.ttl +129 -0
  8. package/assets/arch-processes/arch-processes-metamodel.ttl +42 -0
  9. package/assets/arch-processes/arch-processes-tax.ttl +136 -0
  10. package/assets/arch-processes/archProcesses-shapes.ttl +189 -0
  11. package/assets/arch-processes/archProcesses.ttl +953 -0
  12. package/assets/archimate3/archimate3.2-element-shapes.ttl +379 -0
  13. package/assets/archimate3/archimate3.2-metamodel.ttl +205 -0
  14. package/assets/archimate3/archimate3.2-notation.ttl +1503 -0
  15. package/assets/archimate3/archimate3.2-onto.ttl +1579 -0
  16. package/assets/archimate3/archimate3.2-presentation-contexts.ttl +90 -0
  17. package/assets/archimate3/archimate3.2-principle-shapes.ttl +923 -0
  18. package/assets/archimate3/archimate3.2-questions.ttl +1125 -0
  19. package/assets/archimate3/archimate3.2-reference-data.ttl +74 -0
  20. package/assets/archimate3/archimate3.2-relationship-shapes.ttl +30956 -0
  21. package/assets/archimate3/archimate3.2-relationship-tables.ttl +5992 -0
  22. package/assets/archimate3/archimate3.2-tax.ttl +724 -0
  23. package/assets/archimate3/archimate3.2-viewpoint-shapes.ttl +59 -0
  24. package/assets/archimate3/archimate3.2-viewpoints.ttl +793 -0
  25. package/assets/archimate3/icons/and-junction.svg +3 -0
  26. package/assets/archimate3/icons/application-collaboration.svg +22 -0
  27. package/assets/archimate3/icons/application-component.svg +18 -0
  28. package/assets/archimate3/icons/application-event.svg +15 -0
  29. package/assets/archimate3/icons/application-function.svg +14 -0
  30. package/assets/archimate3/icons/application-interaction.svg +17 -0
  31. package/assets/archimate3/icons/application-interface.svg +16 -0
  32. package/assets/archimate3/icons/application-process.svg +14 -0
  33. package/assets/archimate3/icons/application-service.svg +14 -0
  34. package/assets/archimate3/icons/artifact.svg +16 -0
  35. package/assets/archimate3/icons/assessment.svg +17 -0
  36. package/assets/archimate3/icons/business-actor.svg +22 -0
  37. package/assets/archimate3/icons/business-collaboration.svg +21 -0
  38. package/assets/archimate3/icons/business-event.svg +15 -0
  39. package/assets/archimate3/icons/business-function.svg +14 -0
  40. package/assets/archimate3/icons/business-interaction.svg +18 -0
  41. package/assets/archimate3/icons/business-interface.svg +16 -0
  42. package/assets/archimate3/icons/business-object.svg +14 -0
  43. package/assets/archimate3/icons/business-process.svg +15 -0
  44. package/assets/archimate3/icons/business-role.svg +16 -0
  45. package/assets/archimate3/icons/business-service.svg +14 -0
  46. package/assets/archimate3/icons/capability.svg +40 -0
  47. package/assets/archimate3/icons/communication-network.svg +18 -0
  48. package/assets/archimate3/icons/constraint.svg +18 -0
  49. package/assets/archimate3/icons/contract.svg +13 -0
  50. package/assets/archimate3/icons/course-of-action.svg +20 -0
  51. package/assets/archimate3/icons/data-object.svg +14 -0
  52. package/assets/archimate3/icons/deliverable.svg +11 -0
  53. package/assets/archimate3/icons/device.svg +18 -0
  54. package/assets/archimate3/icons/distribution-network.svg +19 -0
  55. package/assets/archimate3/icons/driver.svg +24 -0
  56. package/assets/archimate3/icons/equipment.svg +31 -0
  57. package/assets/archimate3/icons/facility.svg +16 -0
  58. package/assets/archimate3/icons/gap.svg +22 -0
  59. package/assets/archimate3/icons/glyphs/activity.svg +3 -0
  60. package/assets/archimate3/icons/glyphs/actor.svg +14 -0
  61. package/assets/archimate3/icons/glyphs/application-component.svg +12 -0
  62. package/assets/archimate3/icons/glyphs/artifact.svg +9 -0
  63. package/assets/archimate3/icons/glyphs/assessment.svg +9 -0
  64. package/assets/archimate3/icons/glyphs/capability.svg +32 -0
  65. package/assets/archimate3/icons/glyphs/cloud-gear.svg +3 -0
  66. package/assets/archimate3/icons/glyphs/collaboration.svg +15 -0
  67. package/assets/archimate3/icons/glyphs/communication-network.svg +12 -0
  68. package/assets/archimate3/icons/glyphs/constraint.svg +10 -0
  69. package/assets/archimate3/icons/glyphs/contract.svg +5 -0
  70. package/assets/archimate3/icons/glyphs/course-of-action.svg +12 -0
  71. package/assets/archimate3/icons/glyphs/data-object.svg +4 -0
  72. package/assets/archimate3/icons/glyphs/deliverable.svg +3 -0
  73. package/assets/archimate3/icons/glyphs/device.svg +10 -0
  74. package/assets/archimate3/icons/glyphs/distribution-network.svg +11 -0
  75. package/assets/archimate3/icons/glyphs/driver.svg +16 -0
  76. package/assets/archimate3/icons/glyphs/equipment.svg +22 -0
  77. package/assets/archimate3/icons/glyphs/event.svg +6 -0
  78. package/assets/archimate3/icons/glyphs/facility.svg +7 -0
  79. package/assets/archimate3/icons/glyphs/function.svg +6 -0
  80. package/assets/archimate3/icons/glyphs/gap.svg +14 -0
  81. package/assets/archimate3/icons/glyphs/goal.svg +10 -0
  82. package/assets/archimate3/icons/glyphs/grouping.svg +4 -0
  83. package/assets/archimate3/icons/glyphs/interaction.svg +10 -0
  84. package/assets/archimate3/icons/glyphs/interface.svg +8 -0
  85. package/assets/archimate3/icons/glyphs/location.svg +6 -0
  86. package/assets/archimate3/icons/glyphs/material.svg +12 -0
  87. package/assets/archimate3/icons/glyphs/meaning.svg +3 -0
  88. package/assets/archimate3/icons/glyphs/node.svg +8 -0
  89. package/assets/archimate3/icons/glyphs/object.svg +4 -0
  90. package/assets/archimate3/icons/glyphs/outcome.svg +16 -0
  91. package/assets/archimate3/icons/glyphs/path.svg +10 -0
  92. package/assets/archimate3/icons/glyphs/person-silhouette.svg +3 -0
  93. package/assets/archimate3/icons/glyphs/plateau.svg +8 -0
  94. package/assets/archimate3/icons/glyphs/principle.svg +12 -0
  95. package/assets/archimate3/icons/glyphs/process.svg +6 -0
  96. package/assets/archimate3/icons/glyphs/product.svg +4 -0
  97. package/assets/archimate3/icons/glyphs/representation.svg +4 -0
  98. package/assets/archimate3/icons/glyphs/requirement.svg +6 -0
  99. package/assets/archimate3/icons/glyphs/resource.svg +14 -0
  100. package/assets/archimate3/icons/glyphs/role.svg +6 -0
  101. package/assets/archimate3/icons/glyphs/service.svg +6 -0
  102. package/assets/archimate3/icons/glyphs/stakeholder.svg +6 -0
  103. package/assets/archimate3/icons/glyphs/system-software.svg +14 -0
  104. package/assets/archimate3/icons/glyphs/value-stream.svg +3 -0
  105. package/assets/archimate3/icons/glyphs/value.svg +3 -0
  106. package/assets/archimate3/icons/glyphs/work-package.svg +4 -0
  107. package/assets/archimate3/icons/goal.svg +18 -0
  108. package/assets/archimate3/icons/grouping.svg +12 -0
  109. package/assets/archimate3/icons/implementation-event.svg +15 -0
  110. package/assets/archimate3/icons/location.svg +14 -0
  111. package/assets/archimate3/icons/material.svg +21 -0
  112. package/assets/archimate3/icons/meaning.svg +11 -0
  113. package/assets/archimate3/icons/node.svg +14 -0
  114. package/assets/archimate3/icons/or-junction.svg +3 -0
  115. package/assets/archimate3/icons/outcome.svg +25 -0
  116. package/assets/archimate3/icons/path.svg +18 -0
  117. package/assets/archimate3/icons/plateau.svg +16 -0
  118. package/assets/archimate3/icons/principle.svg +21 -0
  119. package/assets/archimate3/icons/product.svg +12 -0
  120. package/assets/archimate3/icons/representation.svg +12 -0
  121. package/assets/archimate3/icons/requirement.svg +14 -0
  122. package/assets/archimate3/icons/resource.svg +23 -0
  123. package/assets/archimate3/icons/stakeholder.svg +15 -0
  124. package/assets/archimate3/icons/system-software.svg +22 -0
  125. package/assets/archimate3/icons/technology-collaboration.svg +22 -0
  126. package/assets/archimate3/icons/technology-event.svg +15 -0
  127. package/assets/archimate3/icons/technology-function.svg +14 -0
  128. package/assets/archimate3/icons/technology-interaction.svg +18 -0
  129. package/assets/archimate3/icons/technology-interface.svg +16 -0
  130. package/assets/archimate3/icons/technology-process.svg +14 -0
  131. package/assets/archimate3/icons/technology-service.svg +14 -0
  132. package/assets/archimate3/icons/value-stream.svg +11 -0
  133. package/assets/archimate3/icons/value.svg +11 -0
  134. package/assets/archimate3/icons/work-package.svg +12 -0
  135. package/assets/archimate4/archimate4-element-shapes.ttl +404 -0
  136. package/assets/archimate4/archimate4-metamodel.ttl +179 -0
  137. package/assets/archimate4/archimate4-notation.ttl +1147 -0
  138. package/assets/archimate4/archimate4-onto.ttl +1559 -0
  139. package/assets/archimate4/archimate4-presentation-contexts.ttl +60 -0
  140. package/assets/archimate4/archimate4-principle-shapes.ttl +893 -0
  141. package/assets/archimate4/archimate4-questions.ttl +1224 -0
  142. package/assets/archimate4/archimate4-reference-data.ttl +56 -0
  143. package/assets/archimate4/archimate4-relationship-shapes.ttl +16920 -0
  144. package/assets/archimate4/archimate4-relationship-tables.ttl +3200 -0
  145. package/assets/archimate4/archimate4-tax.ttl +749 -0
  146. package/assets/archimate4/archimate4-viewpoint-shapes.ttl +55 -0
  147. package/assets/archimate4/archimate4-viewpoints.ttl +777 -0
  148. package/assets/archimate4/icons/and-junction.svg +3 -0
  149. package/assets/archimate4/icons/application-component.svg +18 -0
  150. package/assets/archimate4/icons/application-interface.svg +16 -0
  151. package/assets/archimate4/icons/artifact.svg +16 -0
  152. package/assets/archimate4/icons/assessment.svg +17 -0
  153. package/assets/archimate4/icons/business-actor.svg +22 -0
  154. package/assets/archimate4/icons/business-interface.svg +16 -0
  155. package/assets/archimate4/icons/business-object.svg +14 -0
  156. package/assets/archimate4/icons/capability.svg +40 -0
  157. package/assets/archimate4/icons/collaboration.svg +21 -0
  158. package/assets/archimate4/icons/communication-network.svg +18 -0
  159. package/assets/archimate4/icons/course-of-action.svg +20 -0
  160. package/assets/archimate4/icons/data-object.svg +14 -0
  161. package/assets/archimate4/icons/deliverable.svg +11 -0
  162. package/assets/archimate4/icons/device.svg +18 -0
  163. package/assets/archimate4/icons/distribution-network.svg +19 -0
  164. package/assets/archimate4/icons/driver.svg +24 -0
  165. package/assets/archimate4/icons/equipment.svg +31 -0
  166. package/assets/archimate4/icons/event.svg +15 -0
  167. package/assets/archimate4/icons/facility.svg +16 -0
  168. package/assets/archimate4/icons/function.svg +13 -0
  169. package/assets/archimate4/icons/glyphs/activity.svg +3 -0
  170. package/assets/archimate4/icons/glyphs/actor.svg +14 -0
  171. package/assets/archimate4/icons/glyphs/application-component.svg +12 -0
  172. package/assets/archimate4/icons/glyphs/artifact.svg +9 -0
  173. package/assets/archimate4/icons/glyphs/assessment.svg +9 -0
  174. package/assets/archimate4/icons/glyphs/capability.svg +32 -0
  175. package/assets/archimate4/icons/glyphs/cloud-gear.svg +3 -0
  176. package/assets/archimate4/icons/glyphs/collaboration.svg +15 -0
  177. package/assets/archimate4/icons/glyphs/communication-network.svg +12 -0
  178. package/assets/archimate4/icons/glyphs/constraint.svg +10 -0
  179. package/assets/archimate4/icons/glyphs/contract.svg +5 -0
  180. package/assets/archimate4/icons/glyphs/course-of-action.svg +12 -0
  181. package/assets/archimate4/icons/glyphs/data-object.svg +4 -0
  182. package/assets/archimate4/icons/glyphs/deliverable.svg +3 -0
  183. package/assets/archimate4/icons/glyphs/device.svg +10 -0
  184. package/assets/archimate4/icons/glyphs/distribution-network.svg +11 -0
  185. package/assets/archimate4/icons/glyphs/driver.svg +16 -0
  186. package/assets/archimate4/icons/glyphs/equipment.svg +22 -0
  187. package/assets/archimate4/icons/glyphs/event.svg +6 -0
  188. package/assets/archimate4/icons/glyphs/facility.svg +7 -0
  189. package/assets/archimate4/icons/glyphs/function.svg +6 -0
  190. package/assets/archimate4/icons/glyphs/gap.svg +14 -0
  191. package/assets/archimate4/icons/glyphs/goal.svg +10 -0
  192. package/assets/archimate4/icons/glyphs/grouping.svg +4 -0
  193. package/assets/archimate4/icons/glyphs/interaction.svg +10 -0
  194. package/assets/archimate4/icons/glyphs/interface.svg +8 -0
  195. package/assets/archimate4/icons/glyphs/location.svg +6 -0
  196. package/assets/archimate4/icons/glyphs/material.svg +12 -0
  197. package/assets/archimate4/icons/glyphs/meaning.svg +3 -0
  198. package/assets/archimate4/icons/glyphs/node.svg +8 -0
  199. package/assets/archimate4/icons/glyphs/object.svg +4 -0
  200. package/assets/archimate4/icons/glyphs/outcome.svg +16 -0
  201. package/assets/archimate4/icons/glyphs/path.svg +10 -0
  202. package/assets/archimate4/icons/glyphs/person-silhouette.svg +3 -0
  203. package/assets/archimate4/icons/glyphs/plateau.svg +8 -0
  204. package/assets/archimate4/icons/glyphs/principle.svg +12 -0
  205. package/assets/archimate4/icons/glyphs/process.svg +6 -0
  206. package/assets/archimate4/icons/glyphs/product.svg +4 -0
  207. package/assets/archimate4/icons/glyphs/representation.svg +4 -0
  208. package/assets/archimate4/icons/glyphs/requirement.svg +6 -0
  209. package/assets/archimate4/icons/glyphs/resource.svg +14 -0
  210. package/assets/archimate4/icons/glyphs/role.svg +6 -0
  211. package/assets/archimate4/icons/glyphs/service.svg +6 -0
  212. package/assets/archimate4/icons/glyphs/stakeholder.svg +6 -0
  213. package/assets/archimate4/icons/glyphs/system-software.svg +14 -0
  214. package/assets/archimate4/icons/glyphs/value-stream.svg +3 -0
  215. package/assets/archimate4/icons/glyphs/value.svg +3 -0
  216. package/assets/archimate4/icons/glyphs/work-package.svg +4 -0
  217. package/assets/archimate4/icons/goal.svg +18 -0
  218. package/assets/archimate4/icons/grouping.svg +12 -0
  219. package/assets/archimate4/icons/location.svg +14 -0
  220. package/assets/archimate4/icons/material.svg +21 -0
  221. package/assets/archimate4/icons/meaning.svg +11 -0
  222. package/assets/archimate4/icons/node.svg +14 -0
  223. package/assets/archimate4/icons/or-junction.svg +3 -0
  224. package/assets/archimate4/icons/outcome.svg +25 -0
  225. package/assets/archimate4/icons/path.svg +18 -0
  226. package/assets/archimate4/icons/plateau.svg +16 -0
  227. package/assets/archimate4/icons/principle.svg +21 -0
  228. package/assets/archimate4/icons/process.svg +15 -0
  229. package/assets/archimate4/icons/product.svg +12 -0
  230. package/assets/archimate4/icons/requirement.svg +14 -0
  231. package/assets/archimate4/icons/resource.svg +23 -0
  232. package/assets/archimate4/icons/role.svg +16 -0
  233. package/assets/archimate4/icons/service.svg +13 -0
  234. package/assets/archimate4/icons/stakeholder.svg +15 -0
  235. package/assets/archimate4/icons/system-software.svg +22 -0
  236. package/assets/archimate4/icons/technology-interface.svg +16 -0
  237. package/assets/archimate4/icons/value-stream.svg +11 -0
  238. package/assets/archimate4/icons/value.svg +11 -0
  239. package/assets/archimate4/icons/work-package.svg +12 -0
  240. package/assets/basic/basic-metamodel.ttl +100 -0
  241. package/assets/basic/basic-notation-bubble.ttl +175 -0
  242. package/assets/basic/basic-notation.ttl +172 -0
  243. package/assets/basic/basic-onto.ttl +171 -0
  244. package/assets/basic/basic-presentation-contexts.ttl +70 -0
  245. package/assets/basic/basic-tax.ttl +130 -0
  246. package/assets/basic/icons/aggregation.svg +7 -0
  247. package/assets/basic/icons/association.svg +6 -0
  248. package/assets/basic/icons/element.svg +5 -0
  249. package/assets/basic/icons/glyphs/aggregation.svg +6 -0
  250. package/assets/basic/icons/glyphs/association.svg +5 -0
  251. package/assets/basic/icons/glyphs/element.svg +5 -0
  252. package/assets/basic/icons/glyphs/relationship.svg +5 -0
  253. package/assets/basic/icons/relationship.svg +7 -0
  254. package/assets/basic/notation-bubble/icons/aggregation.svg +7 -0
  255. package/assets/basic/notation-bubble/icons/association.svg +6 -0
  256. package/assets/basic/notation-bubble/icons/element.svg +5 -0
  257. package/assets/basic/notation-bubble/icons/glyphs/aggregation.svg +6 -0
  258. package/assets/basic/notation-bubble/icons/glyphs/association.svg +5 -0
  259. package/assets/basic/notation-bubble/icons/glyphs/element.svg +5 -0
  260. package/assets/basic/notation-bubble/icons/glyphs/relationship.svg +5 -0
  261. package/assets/basic/notation-bubble/icons/relationship.svg +7 -0
  262. package/assets/catalog.ttl +7302 -0
  263. package/assets/core/core-notation.ttl +131 -0
  264. package/assets/core/core-onto.ttl +2811 -0
  265. package/assets/core/core-questions.ttl +957 -0
  266. package/assets/core/core-shapes.ttl +915 -0
  267. package/assets/core/core-vis-onto.ttl +1408 -0
  268. package/assets/core/core-vis-shapes.ttl +840 -0
  269. package/assets/core-vis/markers/circle-dot.svg +3 -0
  270. package/assets/core-vis/markers/closed-arrowhead.svg +3 -0
  271. package/assets/core-vis/markers/filled-diamond.svg +3 -0
  272. package/assets/core-vis/markers/half-arrowhead.svg +3 -0
  273. package/assets/core-vis/markers/hollow-arrowhead.svg +3 -0
  274. package/assets/core-vis/markers/hollow-diamond.svg +3 -0
  275. package/assets/core-vis/markers/open-arrowhead.svg +3 -0
  276. package/fixtures/interoperability/archimate4-demo.trig +259 -0
  277. package/fixtures/interoperability/expected-findings.json +26 -0
  278. package/fixtures/interoperability/shop-seed.ttl +225 -0
  279. package/package.json +136 -4
  280. package/scripts/sync-assets.mjs +252 -0
  281. package/src/conformance.ts +66 -0
  282. package/src/import-export/model-io.ts +426 -0
  283. package/src/index.ts +11 -0
  284. package/src/metamodel-manager/asset-sources.ts +754 -0
  285. package/src/metamodel-manager/bundled-assets.ts +599 -0
  286. package/src/metamodel-manager/catalogue.ts +114 -0
  287. package/src/metamodel-manager/class-hierarchy.ts +155 -0
  288. package/src/metamodel-manager/index.ts +65 -0
  289. package/src/metamodel-manager/interfaces.ts +422 -0
  290. package/src/metamodel-manager/metamodel-completeness.ts +162 -0
  291. package/src/metamodel-manager/metamodel-loader.ts +864 -0
  292. package/src/metamodel-manager/notation-resolver.ts +284 -0
  293. package/src/metamodel-manager/notation.ts +659 -0
  294. package/src/metamodel-manager/palette-generator.ts +882 -0
  295. package/src/metamodel-manager/property-shapes.ts +290 -0
  296. package/src/metamodel-manager/taxonomy.ts +904 -0
  297. package/src/metamodel-manager/type-guide.ts +241 -0
  298. package/src/metamodel-manager/viewpoint-manager.ts +147 -0
  299. package/src/model-manager/appearance.ts +389 -0
  300. package/src/model-manager/cascade.ts +246 -0
  301. package/src/model-manager/clipboard.ts +566 -0
  302. package/src/model-manager/context-names.ts +108 -0
  303. package/src/model-manager/custom-properties.ts +549 -0
  304. package/src/model-manager/derivations.ts +166 -0
  305. package/src/model-manager/direct-permissions.ts +182 -0
  306. package/src/model-manager/drawing-order.ts +119 -0
  307. package/src/model-manager/element-manager.ts +69 -0
  308. package/src/model-manager/element-pictures.ts +118 -0
  309. package/src/model-manager/field-names.ts +42 -0
  310. package/src/model-manager/folders.ts +354 -0
  311. package/src/model-manager/grid.ts +6 -0
  312. package/src/model-manager/index.ts +43 -0
  313. package/src/model-manager/interfaces.ts +417 -0
  314. package/src/model-manager/iri-conformance.ts +183 -0
  315. package/src/model-manager/label-expression.ts +233 -0
  316. package/src/model-manager/legacy-migration.ts +200 -0
  317. package/src/model-manager/missing-references.ts +86 -0
  318. package/src/model-manager/model-diff-text.ts +150 -0
  319. package/src/model-manager/model-diff.ts +534 -0
  320. package/src/model-manager/model-merge.ts +1160 -0
  321. package/src/model-manager/model-namespace.ts +199 -0
  322. package/src/model-manager/model-operations.ts +132 -0
  323. package/src/model-manager/model-queries.ts +616 -0
  324. package/src/model-manager/model-session.ts +759 -0
  325. package/src/model-manager/multiplicity.ts +74 -0
  326. package/src/model-manager/nested-resources.ts +145 -0
  327. package/src/model-manager/own-metamodel.ts +157 -0
  328. package/src/model-manager/placement-copy.ts +116 -0
  329. package/src/model-manager/property-catalog.ts +787 -0
  330. package/src/model-manager/proposal-order.ts +203 -0
  331. package/src/model-manager/provenance.ts +396 -0
  332. package/src/model-manager/questions.ts +470 -0
  333. package/src/model-manager/rdf-scope.ts +97 -0
  334. package/src/model-manager/relationship-graph.ts +462 -0
  335. package/src/model-manager/relationship-manager.ts +962 -0
  336. package/src/model-manager/relationship-table.ts +189 -0
  337. package/src/model-manager/relationship-validity.ts +261 -0
  338. package/src/model-manager/resource-edits.ts +28 -0
  339. package/src/model-manager/short-hash.ts +104 -0
  340. package/src/model-manager/snapshot-lines.ts +88 -0
  341. package/src/model-manager/version-history.ts +205 -0
  342. package/src/model-manager/view-from-results.ts +81 -0
  343. package/src/model-manager/view-manager.ts +1410 -0
  344. package/src/model-manager/vocabulary.ts +279 -0
  345. package/src/rdf-engine/finding-shape.ts +23 -0
  346. package/src/rdf-engine/graph-scope.ts +163 -0
  347. package/src/rdf-engine/index.ts +7 -0
  348. package/src/rdf-engine/interfaces.ts +144 -0
  349. package/src/rdf-engine/iri.ts +203 -0
  350. package/src/rdf-engine/localized-text.ts +13 -0
  351. package/src/rdf-engine/namespaces.ts +41 -0
  352. package/src/rdf-engine/observable-store.ts +631 -0
  353. package/src/rdf-engine/rdf-store.ts +508 -0
  354. package/src/rdf-engine/shacl-validator.ts +602 -0
  355. package/src/rdf-engine/shape-reach.ts +140 -0
  356. package/src/rdf-engine/shape-switches.ts +165 -0
  357. package/src/rdf-engine/single-valued.ts +219 -0
  358. package/src/rdf-engine/sparql-constraints.ts +334 -0
  359. package/src/rdf-engine/term-codec.ts +51 -0
  360. package/src/rdf-engine/ttl-parser.ts +51 -0
  361. package/src/rdf-engine/ttl-serializer.ts +79 -0
  362. package/src/rdf-engine/turtle-writer.ts +284 -0
  363. package/src/rdf-engine/validation-engine.ts +682 -0
  364. package/src/rdf-engine/validation-service.ts +184 -0
  365. package/src/rdf-engine/validation.worker.ts +47 -0
@@ -0,0 +1,241 @@
1
+ /**
2
+ * What the loaded metamodels say about a type — the property panel's
3
+ * "About ‹type›" tab.
4
+ *
5
+ * From the **ontology**: the type's definition (`skos:definition`), its
6
+ * guidance (`skos:scopeNote`: when to use it, how to name it, what it is not),
7
+ * other names (`skos:altLabel`), what changed (`skos:changeNote`), the classes
8
+ * it specializes (`rdfs:subClassOf`, transitively), whether it is abstract,
9
+ * where it is defined (`rdfs:seeAlso`, `dcterms:source`) — and, per kind of
10
+ * type, the facts that help a modeller: a relationship's typical ends
11
+ * (`arch:domainIncludes`, `arch:rangeIncludes`, its predicate's) and unqualified form; a
12
+ * viewpoint's concepts, stakeholders and purposes.
13
+ *
14
+ * From the **taxonomy**: where the type is classified — for each SKOS concept
15
+ * that holds it (`skos:narrower`, or the type's `skos:broader`), the path from
16
+ * the top concept (the axis: "Domain", "Aspect") down to
17
+ * that group, the group's own definition, guidance and changes, and the other
18
+ * types in the group.
19
+ *
20
+ * Everything is read structurally from whatever metamodels are loaded, so it
21
+ * works for any notation that publishes these properties; what a metamodel
22
+ * does not say is simply absent.
23
+ */
24
+
25
+ import type { Quad, Term } from '@rdfjs/types';
26
+ import type { RdfStore } from '../rdf-engine/interfaces.js';
27
+ import { NAMESPACES } from '../rdf-engine/namespaces.js';
28
+ import { humanize, localName } from '../model-manager/vocabulary.js';
29
+
30
+ /** A type, concept or resource the guide mentions. */
31
+ export interface GuideRef {
32
+ iri: string;
33
+ label: string;
34
+ definition?: string;
35
+ }
36
+
37
+ /** Where a taxonomy classifies the type. */
38
+ export interface GuideClassification {
39
+ /** The top concept: the axis ("Domain"). */
40
+ axis: GuideRef;
41
+ /** The concepts from under the axis down to the group, the group last. */
42
+ path: GuideRef[];
43
+ /** The concept that holds the type, with its guidance. */
44
+ group: GuideRef & { notes: string[]; changes: string[] };
45
+ /** The other types in the group. */
46
+ members: GuideRef[];
47
+ }
48
+
49
+ /** A fact about the type with the resources it names ("Typically from: …"). */
50
+ export interface GuideFact {
51
+ label: string;
52
+ values: GuideRef[];
53
+ }
54
+
55
+ /** What the metamodels say about one type. */
56
+ export interface TypeGuide {
57
+ iri: string;
58
+ label: string;
59
+ altLabels: string[];
60
+ definition?: string;
61
+ /** Guidance, one paragraph each. */
62
+ notes: string[];
63
+ changes: string[];
64
+ abstract: boolean;
65
+ /** Where it is defined: web pages, not resources of the loaded metamodels. */
66
+ sources: string[];
67
+ /** The classes it specializes, nearest first. */
68
+ superclasses: GuideRef[];
69
+ classifications: GuideClassification[];
70
+ facts: GuideFact[];
71
+ }
72
+
73
+ const SKOS = NAMESPACES.skos;
74
+ const ARCH = NAMESPACES.arch;
75
+ const P = {
76
+ type: NAMESPACES.rdf + 'type',
77
+ label: NAMESPACES.rdfs + 'label',
78
+ comment: NAMESPACES.rdfs + 'comment',
79
+ subClassOf: NAMESPACES.rdfs + 'subClassOf',
80
+ seeAlso: NAMESPACES.rdfs + 'seeAlso',
81
+ source: NAMESPACES.dcterms + 'source',
82
+ prefLabel: SKOS + 'prefLabel',
83
+ altLabel: SKOS + 'altLabel',
84
+ definition: SKOS + 'definition',
85
+ scopeNote: SKOS + 'scopeNote',
86
+ changeNote: SKOS + 'changeNote',
87
+ broader: SKOS + 'broader',
88
+ narrower: SKOS + 'narrower',
89
+ concept: SKOS + 'Concept',
90
+ isAbstract: ARCH + 'isAbstractClass',
91
+ };
92
+
93
+ /** Facts worth showing, by predicate, in this order. */
94
+ const FACTS: ReadonlyArray<[string, string]> = [
95
+ [ARCH + 'domainIncludes', 'Typically from'],
96
+ [ARCH + 'rangeIncludes', 'Typically to'],
97
+ [ARCH + 'unqualifiedForm', 'Unqualified form'],
98
+ [ARCH + 'includesConcept', 'Shows'],
99
+ [ARCH + 'targetsStakeholder', 'For'],
100
+ [ARCH + 'viewpointFramesConcern', 'Concerns'],
101
+ [ARCH + 'viewpointHasPurpose', 'Purpose'],
102
+ ];
103
+
104
+ /**
105
+ * Paragraphs of a text. The metamodels hard-wrap their texts, so a line break
106
+ * starts a paragraph only after the end of a sentence; within one, it is a space.
107
+ */
108
+ export function paragraphs(values: readonly string[]): string[] {
109
+ const out: string[] = [];
110
+ for (const value of values) {
111
+ let current = '';
112
+ for (const line of value.split('\n').map((l) => l.trim())) {
113
+ if (!line) {
114
+ if (current) out.push(current);
115
+ current = '';
116
+ continue;
117
+ }
118
+ current = current ? `${current} ${line}` : line;
119
+ if (/[.!?:;]["”’)]?$/.test(line)) {
120
+ out.push(current);
121
+ current = '';
122
+ }
123
+ }
124
+ if (current) out.push(current);
125
+ }
126
+ return out.map((p) => prose(p)!).filter(Boolean);
127
+ }
128
+
129
+ /** One line of prose: whitespace collapsed, Markdown links reduced to their text. */
130
+ function prose(value: string | undefined): string | undefined {
131
+ return value?.replace(/\[([^\]]+)\]\([^)]*\)/g, '$1').replace(/\s+/g, ' ').trim() || undefined;
132
+ }
133
+
134
+ /** Superclasses not worth listing: every class is one. */
135
+ const TOO_GENERAL = new Set([NAMESPACES.owl + 'Thing', NAMESPACES.rdfs + 'Resource', NAMESPACES.rdfs + 'Class']);
136
+
137
+ /**
138
+ * The guide to `typeIri` from what the store holds (all graphs: the metamodels
139
+ * are named graphs). `undefined` when the store says nothing about it.
140
+ *
141
+ * @param language Preferred language of texts; untagged texts come next, then any.
142
+ */
143
+ export function readTypeGuide(store: Pick<RdfStore, 'getQuads'>, typeIri: string, language = 'en'): TypeGuide | undefined {
144
+ const node = (iri: string) => ({ termType: 'NamedNode', value: iri }) as never;
145
+ const quads = (subject: string | null, predicate: string, object: string | null = null): Quad[] =>
146
+ store.getQuads(subject ? node(subject) : null, node(predicate), object ? node(object) : null);
147
+ const iris = (terms: Term[]) => [...new Set(terms.filter((t) => t.termType === 'NamedNode').map((t) => t.value))];
148
+ const objects = (subject: string, predicate: string) => iris(quads(subject, predicate).map((q) => q.object));
149
+ const subjects = (predicate: string, object: string) => iris(quads(null, predicate, object).map((q) => q.subject));
150
+
151
+ /** Texts of a property: the preferred language's, else untagged, else any — once each. */
152
+ const texts = (subject: string, predicate: string): string[] => {
153
+ const literals = quads(subject, predicate)
154
+ .map((q) => q.object)
155
+ .filter((o): o is Extract<Term, { termType: 'Literal' }> => o.termType === 'Literal');
156
+ const pick =
157
+ [language, ''].map((lang) => literals.filter((l) => l.language === lang)).find((l) => l.length > 0) ?? literals;
158
+ return [...new Set(pick.map((l) => l.value.trim()).filter(Boolean))];
159
+ };
160
+ const text = (subject: string, predicate: string) => texts(subject, predicate)[0];
161
+ const labelOf = (iri: string) => {
162
+ const label = text(iri, P.prefLabel) ?? text(iri, P.label) ?? localName(iri);
163
+ // A label that is an identifier ("BusinessDomainElement") reads better spaced.
164
+ return /\s/.test(label) ? label : humanize(label);
165
+ };
166
+ const ref = (iri: string, withDefinition = true): GuideRef => {
167
+ const definition = withDefinition ? prose(text(iri, P.definition) ?? text(iri, P.comment)) : undefined;
168
+ return { iri, label: labelOf(iri), ...(definition ? { definition } : {}) };
169
+ };
170
+ const isConcept = (iri: string) => quads(iri, P.type, P.concept).length > 0;
171
+
172
+ const known = quads(typeIri, P.type).length > 0 || texts(typeIri, P.prefLabel).length > 0 || texts(typeIri, P.label).length > 0;
173
+ if (!known) return undefined;
174
+
175
+ // Ontology: the classes it specializes, nearest first.
176
+ const superclasses: GuideRef[] = [];
177
+ const seen = new Set([typeIri]);
178
+ let level = [typeIri];
179
+ while (level.length > 0) {
180
+ const next: string[] = [];
181
+ for (const cls of level) {
182
+ for (const parent of objects(cls, P.subClassOf)) {
183
+ if (seen.has(parent) || TOO_GENERAL.has(parent)) continue;
184
+ seen.add(parent);
185
+ superclasses.push(ref(parent));
186
+ next.push(parent);
187
+ }
188
+ }
189
+ level = next;
190
+ }
191
+
192
+ // Taxonomy: every concept that holds the type, from its axis down.
193
+ const holders = [...new Set([...subjects(P.narrower, typeIri), ...objects(typeIri, P.broader)])].filter(isConcept);
194
+ const broaderOf = (concept: string) => [...new Set([...objects(concept, P.broader), ...subjects(P.narrower, concept)])].filter(isConcept);
195
+ const classifications: GuideClassification[] = holders.map((group) => {
196
+ const path = [group];
197
+ for (let up = broaderOf(group)[0]; up && !path.includes(up); up = broaderOf(up)[0]) path.unshift(up);
198
+ const axis = path[0]!;
199
+ const members = [...new Set([...objects(group, P.narrower), ...subjects(P.broader, group)])]
200
+ .filter((m) => m !== typeIri && !isConcept(m))
201
+ .map((m) => ref(m, false))
202
+ .sort((a, b) => a.label.localeCompare(b.label));
203
+ return {
204
+ axis: ref(axis),
205
+ path: path.slice(1).map((c) => ref(c)),
206
+ group: { ...ref(group), notes: paragraphs(texts(group, P.scopeNote)), changes: texts(group, P.changeNote).map((c) => prose(c)!) },
207
+ members,
208
+ };
209
+ });
210
+
211
+ // Where it is defined: web pages, not resources of the loaded metamodels.
212
+ const sources = iris([...quads(typeIri, P.seeAlso), ...quads(typeIri, P.source)].map((q) => q.object)).filter(
213
+ (iri) => /^https?:/.test(iri) && quads(iri, P.type).length === 0,
214
+ );
215
+
216
+ // A relationship's typical ends are its predicate's (arch:domainIncludes and arch:rangeIncludes go on
217
+ // properties only): read through its unqualified form, as well as off the type.
218
+ const viaPredicate = new Set([ARCH + 'domainIncludes', ARCH + 'rangeIncludes']);
219
+ const predicates = objects(typeIri, ARCH + 'unqualifiedForm');
220
+ const facts: GuideFact[] = FACTS.map(([predicate, label]) => ({
221
+ label,
222
+ values: [...new Set([typeIri, ...(viaPredicate.has(predicate) ? predicates : [])].flatMap((subject) => objects(subject, predicate)))]
223
+ .map((iri) => ref(iri, false))
224
+ .sort((a, b) => a.label.localeCompare(b.label)),
225
+ })).filter((f) => f.values.length > 0);
226
+
227
+ const definition = prose(text(typeIri, P.definition) ?? text(typeIri, P.comment));
228
+ return {
229
+ iri: typeIri,
230
+ label: labelOf(typeIri),
231
+ altLabels: texts(typeIri, P.altLabel),
232
+ ...(definition ? { definition } : {}),
233
+ notes: paragraphs(texts(typeIri, P.scopeNote)),
234
+ changes: texts(typeIri, P.changeNote).map((c) => prose(c)!),
235
+ abstract: quads(typeIri, P.isAbstract).some((q) => q.object.value === 'true'),
236
+ sources,
237
+ superclasses,
238
+ classifications,
239
+ facts,
240
+ };
241
+ }
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Viewpoint Manager implementation.
3
+ *
4
+ * Queries arch:Viewpoint instances from the RDF store and determines
5
+ * permitted element/relationship types per viewpoint.
6
+ *
7
+ * ## Which graphs these queries read
8
+ *
9
+ * Viewpoints are metamodel content: ArchiMate 4.0 publishes its 17 of them in
10
+ * `archimate4-viewpoints.ttl`, which `N3MetamodelLoader` loads into the named
11
+ * graph `https://meta.linked.archi/archimate4/viewpoints#`. An unscoped SPARQL
12
+ * pattern sees the default graph only, so it would find none of them — measured
13
+ * against the bundle, `getViewpoints()` returned nothing at all, and 17 once
14
+ * scoped. Both queries
15
+ * therefore go through {@link GraphScope}, which spans the default graph *and*
16
+ * every named graph, so a hand-written viewpoint added graph-less still works.
17
+ */
18
+
19
+ import type { RdfStore } from '../rdf-engine/interfaces.js';
20
+ import { NAMESPACES } from '../rdf-engine/namespaces.js';
21
+ import { graphScope, type GraphScope, type SparqlBindings } from '../rdf-engine/graph-scope.js';
22
+ import type { ViewpointManager, ViewpointInfo } from './interfaces.js';
23
+
24
+ /**
25
+ * Concrete ViewpointManager backed by SPARQL queries against an RdfStore.
26
+ */
27
+ export class SparqlViewpointManager implements ViewpointManager {
28
+ constructor(private store: RdfStore) {}
29
+
30
+ getViewpoints(): ViewpointInfo[] {
31
+ // One scope for the viewpoint list and every per-viewpoint follow-up.
32
+ const scope = graphScope(this.store);
33
+
34
+ const rows = scope.select(
35
+ (from) => `
36
+ PREFIX rdf: <${NAMESPACES.rdf}>
37
+ PREFIX arch: <${NAMESPACES.arch}>
38
+ PREFIX skos: <${NAMESPACES.skos}>
39
+
40
+ SELECT ?vp ?label
41
+ ${from}
42
+ WHERE {
43
+ ?vp rdf:type arch:Viewpoint .
44
+ ?vp skos:prefLabel ?label .
45
+ }
46
+ `,
47
+ );
48
+
49
+ const viewpoints: ViewpointInfo[] = [];
50
+ const seen = new Set<string>();
51
+
52
+ for (const row of rows) {
53
+ const iri = row['vp']?.value;
54
+ const label = row['label']?.value;
55
+ if (!iri || !label || seen.has(iri)) continue;
56
+ seen.add(iri);
57
+
58
+ const permitted = this.getPermittedTypes(iri, scope);
59
+ viewpoints.push({
60
+ iri,
61
+ label,
62
+ permittedElements: permitted.elements,
63
+ permittedRelationships: permitted.relationships,
64
+ });
65
+ }
66
+
67
+ return viewpoints;
68
+ }
69
+
70
+ /**
71
+ * Concepts a viewpoint names.
72
+ *
73
+ * Published viewpoints use `arch:includesConcept`, whose `rdfs:range` is
74
+ * `arch:ModelConcept` — one predicate for elements and relationship types
75
+ * alike. Verified against `archimate4-viewpoints.ttl`, where all 17 viewpoints
76
+ * use it and `arch:permitsElement` / `arch:permitsRelationship` never appear.
77
+ * Those two are still read so older or hand-written data keeps working.
78
+ *
79
+ * `arch:includesConcept` does not say which kind a concept is, so its class
80
+ * does: a subclass of `arch:QualifiedRelationship` is reported under
81
+ * `relationships`, anything else under `elements`. ArchiMate 4.0's viewpoints
82
+ * name element types only, so theirs come back with no relationships — which
83
+ * the palette reads as "any the metamodel permits between them".
84
+ *
85
+ * A viewpoint that names a class includes its subclasses (`rdfs:subClassOf*`):
86
+ * one naming `c4:Container` offers `c4:Database`, one naming `am4:Access` its
87
+ * kinds of access, and a class an extension adds under an ArchiMate element
88
+ * appears wherever that element does. The named classes come first.
89
+ *
90
+ * @param scope Dataset to query. Supplied by {@link getViewpoints} so the
91
+ * named-graph list is enumerated once per listing rather than per viewpoint;
92
+ * omit it and one is built here.
93
+ */
94
+ getPermittedTypes(
95
+ viewpointIri: string,
96
+ scope: GraphScope = graphScope(this.store),
97
+ ): { elements: string[]; relationships: string[] } {
98
+ const rows = scope.select(
99
+ (from) => `
100
+ PREFIX arch: <${NAMESPACES.arch}>
101
+ PREFIX rdfs: <${NAMESPACES.rdfs}>
102
+
103
+ SELECT ?concept ?relationshipClass ?named
104
+ ${from}
105
+ WHERE {
106
+ {
107
+ { <${viewpointIri}> arch:includesConcept ?named . }
108
+ UNION
109
+ { <${viewpointIri}> arch:permitsElement ?named . }
110
+ ?concept rdfs:subClassOf* ?named .
111
+ OPTIONAL {
112
+ ?concept rdfs:subClassOf+ arch:QualifiedRelationship .
113
+ BIND(true AS ?relationshipClass)
114
+ }
115
+ } UNION {
116
+ <${viewpointIri}> arch:permitsRelationship ?named .
117
+ ?concept rdfs:subClassOf* ?named .
118
+ BIND(true AS ?relationshipClass)
119
+ }
120
+ }
121
+ `,
122
+ );
123
+ // Named classes before their subclasses, so the list reads as the viewpoint
124
+ // states it.
125
+ rows.sort((a, b) => Number(isSubclassRow(a)) - Number(isSubclassRow(b)));
126
+
127
+ const elements: string[] = [];
128
+ const relationships: string[] = [];
129
+
130
+ // The two passes overlap when the same triple sits in both the default graph
131
+ // and a named graph, so membership is checked before appending.
132
+ for (const row of rows) {
133
+ const concept = row['concept']?.value;
134
+ if (!concept) continue;
135
+ const into = row['relationshipClass'] ? relationships : elements;
136
+ if (!into.includes(concept)) into.push(concept);
137
+ }
138
+
139
+ return { elements, relationships };
140
+ }
141
+ }
142
+
143
+ /** A row a subclass of a named class contributed, rather than the named class itself. */
144
+ function isSubclassRow(row: SparqlBindings): boolean {
145
+ const named = row['named']?.value;
146
+ return row['concept']?.value !== named;
147
+ }