@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,462 @@
1
+ /**
2
+ * The relationship graph around an element — what the Graph tab draws.
3
+ *
4
+ * Two ways to get the same triples:
5
+ *
6
+ * - {@link buildGraphQuery} writes the "query behind the graph" the tab exports,
7
+ * as a `CONSTRUCT` (the triples: RDF, to save or query again) or a `SELECT`
8
+ * (the same `WHERE`, one row per relationship: a table). It is standard SPARQL
9
+ * 1.1, so it runs on any store holding the model.
10
+ * - {@link traverseGraph} walks the store with indexed lookups, breadth first.
11
+ * This is what the tab draws from.
12
+ *
13
+ * The walk is what is drawn because it touches only what it reaches: a few
14
+ * milliseconds where the query, even in the shape chosen for Oxigraph, takes
15
+ * tens to hundreds (seconds around a hub of a large model). Tests run both on
16
+ * the same models and require the same triples, so the exported query stays
17
+ * honest: run on the same model, it returns exactly the exported Turtle, which
18
+ * is exactly what is drawn.
19
+ *
20
+ * ## What is in the graph
21
+ *
22
+ * Every qualified relationship (a resource with `arch:source` and
23
+ * `arch:target`) within `depth` hops of the root, in either direction:
24
+ *
25
+ * 1. The elements within `depth − 1` hops are found level by level.
26
+ * 2. One more hop from them gives the relationships, and their ends.
27
+ *
28
+ * Filters prune the traversal, not only the drawing: a relationship type left
29
+ * out is not followed, and an element type left out is not stepped onto. The
30
+ * ends of a relationship are elements — an association to a relationship is not
31
+ * followed.
32
+ *
33
+ * Both read the model as the default graph, which is how la-gram holds it;
34
+ * against a store holding the DD-15 graphs, run the query with a union default
35
+ * graph.
36
+ */
37
+
38
+ import type { Quad } from '@rdfjs/types';
39
+ import type { PrefixMap, RdfStore } from '../rdf-engine/interfaces.js';
40
+ import { NAMESPACES } from '../rdf-engine/namespaces.js';
41
+ import { IRI } from './vocabulary.js';
42
+
43
+ /** What to draw. */
44
+ export interface GraphQueryOptions {
45
+ /** The element in the middle. */
46
+ rootIri: string;
47
+ /** Hops from the root, 1 or more. */
48
+ depth: number;
49
+ /** Element types stepped onto; `undefined` for all. */
50
+ elementTypes?: readonly string[];
51
+ /** Relationship types followed; `undefined` for all. */
52
+ relationshipTypes?: readonly string[];
53
+ /** A name for the root, for the query's header comment. */
54
+ rootLabel?: string;
55
+ }
56
+
57
+ /** An element in the graph. */
58
+ export interface GraphNode {
59
+ iri: string;
60
+ typeIri?: string;
61
+ label: string;
62
+ /** Hops from the root (0 for the root). */
63
+ depth: number;
64
+ }
65
+
66
+ /** A relationship in the graph. */
67
+ export interface GraphEdge {
68
+ iri: string;
69
+ typeIri?: string;
70
+ /** The relationship's own name, when it has one. */
71
+ label?: string;
72
+ source: string;
73
+ target: string;
74
+ }
75
+
76
+ /** The query, the triples it returns, and the graph read from them. */
77
+ export interface RelationshipGraph {
78
+ /** The `CONSTRUCT`: returns {@link quads}. */
79
+ query: string;
80
+ /** The same `WHERE` as a `SELECT`: one row per relationship. */
81
+ selectQuery: string;
82
+ quads: Quad[];
83
+ nodes: GraphNode[];
84
+ edges: GraphEdge[];
85
+ }
86
+
87
+ /**
88
+ * Of a concept's types, the one to draw it by. A converted model types each
89
+ * concept with the core classes too (`a arch:Element, arch:ModelConcept,
90
+ * am:ValueStream`); drawn by the first, a node lost its icon and a line read
91
+ * "Model Concept".
92
+ */
93
+ export type TypeChooser = (types: readonly string[]) => string | undefined;
94
+
95
+ /** Without the class hierarchy: the first type that is not a core class, else the first. */
96
+ export const notCoreType: TypeChooser = (types) => types.find((t) => !t.startsWith(NAMESPACES.arch)) ?? types[0];
97
+
98
+ /** With the class hierarchy: the most specific type — the one with the most superclasses — as the model tree takes it. */
99
+ export function mostSpecificType(closure: (typeIri: string) => readonly string[]): TypeChooser {
100
+ return (types) => [...types].sort((a, b) => closure(b).length - closure(a).length || notCoreFirst(a, b))[0];
101
+ }
102
+
103
+ function notCoreFirst(a: string, b: string): number {
104
+ return Number(a.startsWith(NAMESPACES.arch)) - Number(b.startsWith(NAMESPACES.arch));
105
+ }
106
+
107
+ /** Deepest the graph goes: each level of the query is a nested subquery. */
108
+ export const MAX_GRAPH_DEPTH = 5;
109
+
110
+ const PREFIX_NAMES = ['rdf', 'skos', 'arch'] as const;
111
+
112
+ /** `<iri>` for a SPARQL query, refusing what cannot be written as one. */
113
+ function iriRef(iri: string): string {
114
+ if (/[<>"{}|\\^`\s]/.test(iri)) throw new Error(`Not an IRI that can be queried: ${iri}`);
115
+ return `<${iri}>`;
116
+ }
117
+
118
+ /** An `IN (…)` list; the prefixed form where a prefix covers the IRI. */
119
+ function inList(iris: readonly string[], prefixes: PrefixMap): string {
120
+ return iris.map((iri) => curieOr(iri, prefixes)).join(', ');
121
+ }
122
+
123
+ function curieOr(iri: string, prefixes: PrefixMap): string {
124
+ for (const [prefix, ns] of Object.entries(prefixes)) {
125
+ const local = iri.slice(ns.length);
126
+ if (iri.startsWith(ns) && /^[A-Za-z_][\w-]*$/.test(local)) return `${prefix}:${local}`;
127
+ }
128
+ return iriRef(iri);
129
+ }
130
+
131
+ /** The form of the graph query: triples, or a table of relationships. */
132
+ export type GraphQueryForm = 'construct' | 'select';
133
+
134
+ /**
135
+ * The SPARQL query for the graph — readable, commented, and returning what
136
+ * {@link traverseGraph} returns: as triples (`CONSTRUCT`), or as a table of
137
+ * relationships, one row each (`SELECT`), from the same `WHERE`.
138
+ *
139
+ * Its shape is chosen for Oxigraph, where the obvious shapes took seconds to
140
+ * minutes from a few hundred elements (measured 2026-09-27; see the design's
141
+ * *Relationship graph*). Oxigraph joins a bound variable into plain triple
142
+ * patterns, property paths and filters one lookup at a time, but evaluates a
143
+ * `UNION` or `BIND` on the right of a join over the whole model, and it reorders
144
+ * a join so that a subquery (a level) is re-run for every relationship in the
145
+ * model. So: the two directions of a hop are one property path; the other end
146
+ * is picked by a filter, not a `BIND`; and every hop is written
147
+ * `OPTIONAL { … } FILTER(BOUND(?r))` — the same rows as a join, in an order the
148
+ * optimizer keeps: the elements first, then their relationships.
149
+ *
150
+ * @param prefixes Prefixes to declare and to write type IRIs with (the model's
151
+ * and the vocabularies'); `rdf:`, `skos:` and `arch:` are always declared.
152
+ */
153
+ export function buildGraphQuery(options: GraphQueryOptions, prefixes: PrefixMap = {}, form: GraphQueryForm = 'construct'): string {
154
+ const depth = Math.max(1, Math.min(MAX_GRAPH_DEPTH, Math.floor(options.depth)));
155
+ const declared: PrefixMap = {};
156
+ for (const name of PREFIX_NAMES) declared[name] = NAMESPACES[name];
157
+ const used = [...(options.elementTypes ?? []), ...(options.relationshipTypes ?? [])];
158
+ for (const [prefix, ns] of Object.entries(prefixes)) {
159
+ if (prefix in declared) continue;
160
+ if (used.some((iri) => iri.startsWith(ns))) declared[prefix] = ns;
161
+ }
162
+
163
+ const root = iriRef(options.rootIri);
164
+ const relFilter = options.relationshipTypes ? ` FILTER(?rt IN (${inList(options.relationshipTypes, declared)}))` : '';
165
+ const elemFilter = options.elementTypes ? ` FILTER(?nt IN (${inList(options.elementTypes, declared)}))` : '';
166
+ const indented = (indent: string, lines: string[]) => lines.map((line) => indent + line).join('\n');
167
+ const plural = (n: number) => `${n} hop${n === 1 ? '' : 's'}`;
168
+
169
+ /**
170
+ * One hop from ?p over ?r, to ?n: a join the optimizer does not reorder (see
171
+ * above). The group it is in must end with it: a group's FILTER applies after
172
+ * all of its OPTIONALs, and a later OPTIONAL would bind ?r where this one did not.
173
+ */
174
+ const hop = (indent: string, lines: string[]): string =>
175
+ indented(indent, ['OPTIONAL { # joined, elements first', ...lines.map((line) => ' ' + line), '}', 'FILTER(BOUND(?r))']);
176
+
177
+ /** Elements within `k` hops of the root (k ≥ 1), projected as ?n; the root only when it passes the filters. */
178
+ const within = (k: number, indent: string): string => {
179
+ const from = k === 1 ? [`VALUES ?p { ${root} }`] : [`{ SELECT (?n AS ?p) WHERE {`, within(k - 1, ' '), `} }`];
180
+ return [
181
+ indented(indent, [`# within ${plural(k)}: the level before, and its neighbours`, `{ SELECT DISTINCT ?n WHERE {`]),
182
+ indented(indent + ' ', from),
183
+ hop(indent + ' ', [
184
+ `?p ^(arch:source|arch:target) ?r . # a relationship at ?p …`,
185
+ `?r a ?rt .${relFilter}`,
186
+ `?r arch:source|arch:target ?n . # … and its ends, ?p among them`,
187
+ `?n a ?nt .${elemFilter}`,
188
+ `FILTER NOT EXISTS { ?n arch:source ?nSource } # an element, not a relationship`,
189
+ ]),
190
+ indented(indent, [`} }`]),
191
+ ].join('\n');
192
+ };
193
+
194
+ const title = options.rootLabel ? `"${options.rootLabel.replace(/\s+/g, ' ')}"` : root;
195
+ const header = [
196
+ `# Relationships within ${plural(depth)} of ${title} — la-gram`,
197
+ `# Root: ${options.rootIri}`,
198
+ `# Relationship types: ${options.relationshipTypes ? options.relationshipTypes.length : 'all'}; element types: ${options.elementTypes ? options.elementTypes.length : 'all'}.`,
199
+ `# Reads the model as the default graph.`,
200
+ ];
201
+ const result =
202
+ form === 'select'
203
+ ? [
204
+ 'SELECT DISTINCT (?s AS ?source) (?sLabel AS ?sourceName)',
205
+ ' (?r AS ?relationship) (?rt AS ?relationshipType) (?rLabel AS ?relationshipName)',
206
+ ' (?t AS ?target) (?tLabel AS ?targetName)',
207
+ ]
208
+ : [
209
+ 'CONSTRUCT {',
210
+ ' ?r a ?rt ; arch:source ?s ; arch:target ?t ; skos:prefLabel ?rLabel .',
211
+ ' ?s a ?st ; skos:prefLabel ?sLabel .',
212
+ ' ?t a ?tt ; skos:prefLabel ?tLabel .',
213
+ '}',
214
+ ];
215
+
216
+ return [
217
+ ...header,
218
+ ...Object.entries(declared).map(([p, ns]) => `PREFIX ${p}: <${ns}>`),
219
+ '',
220
+ ...result,
221
+ 'WHERE {',
222
+ ' {',
223
+ depth === 1 ? ' # ?p: the root' : ` # ?p: the root, and the elements within ${plural(depth - 1)} of it`,
224
+ ` { VALUES ?p { ${root} } }`,
225
+ ...(depth === 1 ? [] : [' UNION', ' { SELECT (?n AS ?p) WHERE {', within(depth - 1, ' '), ' } }']),
226
+ ' # One more hop: the relationships at ?p, and their other ends',
227
+ hop(' ', [
228
+ '?p ^(arch:source|arch:target) ?r .',
229
+ `?r a ?rt .${relFilter}`,
230
+ '?r arch:source ?s ; arch:target ?t .',
231
+ '?s a ?st . ?t a ?tt .',
232
+ '?r arch:source|arch:target ?n .',
233
+ 'FILTER(!sameTerm(?n, ?p) || sameTerm(?s, ?t)) # the other end (?p itself on a loop)',
234
+ `?n a ?nt .${elemFilter}`,
235
+ 'FILTER NOT EXISTS { ?n arch:source ?nSource } # an element, not a relationship',
236
+ ]),
237
+ ' }',
238
+ ' OPTIONAL { ?r skos:prefLabel ?rLabel }',
239
+ ' OPTIONAL { ?s skos:prefLabel ?sLabel }',
240
+ ' OPTIONAL { ?t skos:prefLabel ?tLabel }',
241
+ '}',
242
+ ...(form === 'select' ? ['ORDER BY ?sLabel ?rt ?tLabel'] : []),
243
+ '',
244
+ ].join('\n');
245
+ }
246
+
247
+ /** The graph for the Graph tab: walked, with the queries that return the same. */
248
+ export function relationshipGraph(
249
+ store: RdfStore,
250
+ options: GraphQueryOptions,
251
+ prefixes: PrefixMap = {},
252
+ typeOf: TypeChooser = notCoreType,
253
+ ): RelationshipGraph {
254
+ const quads = traverseGraph(store, options);
255
+ return { ...queries(options, prefixes), quads, ...readGraph(quads, options.rootIri, store, typeOf) };
256
+ }
257
+
258
+ function queries(options: GraphQueryOptions, prefixes: PrefixMap): { query: string; selectQuery: string } {
259
+ return { query: buildGraphQuery(options, prefixes), selectQuery: buildGraphQuery(options, prefixes, 'select') };
260
+ }
261
+
262
+ /**
263
+ * Run the graph query on the store and read the graph from what it returns.
264
+ * Slow on large models (see the module comment); {@link relationshipGraph} is
265
+ * what the tab uses. The root is always a node, related to anything or not.
266
+ */
267
+ export function runGraphQuery(
268
+ store: RdfStore,
269
+ options: GraphQueryOptions,
270
+ prefixes: PrefixMap = {},
271
+ typeOf: TypeChooser = notCoreType,
272
+ ): RelationshipGraph {
273
+ const both = queries(options, prefixes);
274
+ const result = store.query(both.query);
275
+ const quads = result.type === 'quads' ? result.quads : [];
276
+ return { ...both, quads, ...readGraph(quads, options.rootIri, store, typeOf) };
277
+ }
278
+
279
+ /**
280
+ * The triples {@link buildGraphQuery}'s `CONSTRUCT` returns, found by walking
281
+ * the store breadth first with indexed lookups, in the model (default) graph.
282
+ * Each step mirrors a part of the query; keep them in step.
283
+ */
284
+ export function traverseGraph(store: Pick<RdfStore, 'getQuads'>, options: GraphQueryOptions): Quad[] {
285
+ const depth = Math.max(1, Math.min(MAX_GRAPH_DEPTH, Math.floor(options.depth)));
286
+ const relTypes = options.relationshipTypes && new Set(options.relationshipTypes);
287
+ const elemTypes = options.elementTypes && new Set(options.elementTypes);
288
+
289
+ const node = (iri: string) => ({ termType: 'NamedNode', value: iri }) as never;
290
+ const DEFAULT_GRAPH = { termType: 'DefaultGraph', value: '' } as never;
291
+ const lookups = new Map<string, Quad[]>();
292
+ /** Model quads with this subject and predicate, or this predicate and object. */
293
+ const match = (subject: string | null, predicate: string, object: string | null = null): Quad[] => {
294
+ const key = `${subject ?? ''}\n${predicate}\n${object ?? ''}`;
295
+ let found = lookups.get(key);
296
+ if (!found) {
297
+ found = store.getQuads(subject ? node(subject) : null, node(predicate), object ? node(object) : null, DEFAULT_GRAPH);
298
+ lookups.set(key, found);
299
+ }
300
+ return found;
301
+ };
302
+ const typed = (iri: string, allowed?: Set<string>) =>
303
+ match(iri, IRI.rdfType).filter((q) => !allowed || allowed.has(q.object.value));
304
+
305
+ /** `?r` from `?p` to `?n`, either direction, with the query's hop checks: the quads for `?r a ?rt`. */
306
+ const hops = (p: string): Array<{ r: string; n: string; rTypes: Quad[] }> => {
307
+ const out: Array<{ r: string; n: string; rTypes: Quad[] }> = [];
308
+ const step = (from: string, to: string) => {
309
+ for (const q of match(null, from, p)) {
310
+ const r = q.subject.value;
311
+ const rTypes = typed(r, relTypes); // ?r a ?rt, FILTER(?rt IN …)
312
+ if (rTypes.length === 0) continue;
313
+ for (const end of match(r, to)) {
314
+ if (end.object.termType !== 'NamedNode') continue;
315
+ const n = end.object.value;
316
+ if (typed(n, elemTypes).length === 0) continue; // ?n a ?nt, FILTER(?nt IN …)
317
+ if (match(n, IRI.source).length > 0) continue; // an element, not a relationship
318
+ out.push({ r, n, rTypes });
319
+ }
320
+ }
321
+ };
322
+ step(IRI.source, IRI.target);
323
+ step(IRI.target, IRI.source);
324
+ return out;
325
+ };
326
+
327
+ // The elements within depth − 1 hops.
328
+ const reached = new Set([options.rootIri]);
329
+ let frontier = [options.rootIri];
330
+ for (let level = 1; level < depth; level++) {
331
+ const next: string[] = [];
332
+ for (const p of frontier) {
333
+ for (const { n } of hops(p)) {
334
+ if (!reached.has(n)) {
335
+ reached.add(n);
336
+ next.push(n);
337
+ }
338
+ }
339
+ }
340
+ frontier = next;
341
+ }
342
+
343
+ // One more hop, and what the template writes for each relationship and its ends.
344
+ const out = new Map<string, Quad>();
345
+ const emit = (quads: Quad[]) => {
346
+ for (const q of quads) out.set(`${q.subject.value} ${q.predicate.value} ${termKey(q.object)}`, q);
347
+ };
348
+ const described = new Set<string>();
349
+ const describe = (iri: string) => {
350
+ if (described.has(iri)) return;
351
+ described.add(iri);
352
+ emit(typed(iri));
353
+ emit(match(iri, IRI.prefLabel));
354
+ };
355
+ const drawn = new Set<string>();
356
+ for (const p of reached) {
357
+ for (const { r, rTypes } of hops(p)) {
358
+ if (drawn.has(r)) continue;
359
+ drawn.add(r);
360
+ // ?r arch:source ?s ; arch:target ?t . ?s a ?st . ?t a ?tt — every typed
361
+ // pair; no pair (an untyped root), no row.
362
+ const sources = match(r, IRI.source).filter((q) => typed(q.object.value).length > 0);
363
+ const targets = match(r, IRI.target).filter((q) => typed(q.object.value).length > 0);
364
+ if (sources.length === 0 || targets.length === 0) continue;
365
+ emit(rTypes);
366
+ emit(sources);
367
+ emit(targets);
368
+ emit(match(r, IRI.prefLabel));
369
+ for (const q of [...sources, ...targets]) describe(q.object.value);
370
+ }
371
+ }
372
+ return [...out.values()];
373
+ }
374
+
375
+ function termKey(term: Quad['object']): string {
376
+ if (term.termType !== 'Literal') return `${term.termType}:${term.value}`;
377
+ return `"${term.value}"@${term.language}^^${term.datatype.value}`;
378
+ }
379
+
380
+ /** Nodes and edges from the constructed triples; depths by breadth-first search from the root. */
381
+ export function readGraph(
382
+ quads: readonly Quad[],
383
+ rootIri: string,
384
+ store?: Pick<RdfStore, 'getQuads'>,
385
+ typeOf: TypeChooser = notCoreType,
386
+ ): { nodes: GraphNode[]; edges: GraphEdge[] } {
387
+ const bySubject = new Map<string, Quad[]>();
388
+ for (const q of quads) {
389
+ const list = bySubject.get(q.subject.value);
390
+ if (list) list.push(q);
391
+ else bySubject.set(q.subject.value, [q]);
392
+ }
393
+ const value = (subject: string, predicate: string) =>
394
+ bySubject.get(subject)?.find((q) => q.predicate.value === predicate)?.object.value;
395
+ /** The type to draw a concept by, of those given (else the store's). */
396
+ const typeOfSubject = (subject: string): string | undefined => {
397
+ const given = (bySubject.get(subject) ?? []).filter((q) => q.predicate.value === IRI.rdfType).map((q) => q.object.value);
398
+ return typeOf(given.length > 0 ? given : storeValues(store, subject, IRI.rdfType));
399
+ };
400
+
401
+ const edges: GraphEdge[] = [];
402
+ for (const [subject] of bySubject) {
403
+ const source = value(subject, IRI.source);
404
+ const target = value(subject, IRI.target);
405
+ if (!source || !target) continue;
406
+ const typeIri = typeOfSubject(subject);
407
+ const label = value(subject, IRI.prefLabel);
408
+ edges.push({ iri: subject, source, target, ...(typeIri ? { typeIri } : {}), ...(label ? { label } : {}) });
409
+ }
410
+ edges.sort((a, b) => a.iri.localeCompare(b.iri));
411
+
412
+ // Depth: hops from the root over the edges, either direction.
413
+ const neighbours = new Map<string, Set<string>>();
414
+ const link = (a: string, b: string) => {
415
+ if (!neighbours.has(a)) neighbours.set(a, new Set());
416
+ neighbours.get(a)!.add(b);
417
+ };
418
+ for (const e of edges) {
419
+ link(e.source, e.target);
420
+ link(e.target, e.source);
421
+ }
422
+ const depth = new Map<string, number>([[rootIri, 0]]);
423
+ const queue = [rootIri];
424
+ while (queue.length > 0) {
425
+ const at = queue.shift()!;
426
+ for (const next of neighbours.get(at) ?? []) {
427
+ if (!depth.has(next)) {
428
+ depth.set(next, depth.get(at)! + 1);
429
+ queue.push(next);
430
+ }
431
+ }
432
+ }
433
+
434
+ const describe = (iri: string): { typeIri?: string; label?: string } => {
435
+ const typeIri = typeOfSubject(iri);
436
+ const label = value(iri, IRI.prefLabel) ?? storeValue(store, iri, IRI.prefLabel);
437
+ return { ...(typeIri ? { typeIri } : {}), ...(label ? { label } : {}) };
438
+ };
439
+ const nodes: GraphNode[] = [...depth.keys()].map((iri) => {
440
+ const d = describe(iri);
441
+ return { iri, label: d.label ?? localPart(iri), depth: depth.get(iri)!, ...(d.typeIri ? { typeIri: d.typeIri } : {}) };
442
+ });
443
+ nodes.sort((a, b) => a.depth - b.depth || a.label.localeCompare(b.label));
444
+ return { nodes, edges };
445
+ }
446
+
447
+ function storeValue(store: Pick<RdfStore, 'getQuads'> | undefined, subject: string, predicate: string): string | undefined {
448
+ return storeValues(store, subject, predicate)[0];
449
+ }
450
+
451
+ function storeValues(store: Pick<RdfStore, 'getQuads'> | undefined, subject: string, predicate: string): string[] {
452
+ if (!store) return [];
453
+ const nn = (v: string) => ({ termType: 'NamedNode', value: v }) as never;
454
+ return store
455
+ .getQuads(nn(subject), nn(predicate))
456
+ .filter((q) => q.graph.termType === 'DefaultGraph')
457
+ .map((q) => q.object.value);
458
+ }
459
+
460
+ function localPart(iri: string): string {
461
+ return iri.replace(/^.*[/#:]/, '') || iri;
462
+ }