@thomasfosterau/effect-rdf 0.0.0 → 0.1.0

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 (776) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +2250 -1
  3. package/dist/Algebra-CGG4oae3.mjs +433 -0
  4. package/dist/Algebra-CGG4oae3.mjs.map +1 -0
  5. package/dist/Algebra-uGsIEOUA.d.mts +446 -0
  6. package/dist/Ast-CPRZmBvk.mjs +552 -0
  7. package/dist/Ast-CPRZmBvk.mjs.map +1 -0
  8. package/dist/Ast-vcw2W-lf.d.mts +827 -0
  9. package/dist/Bindings-Ck3m7JRC.mjs +249 -0
  10. package/dist/Bindings-Ck3m7JRC.mjs.map +1 -0
  11. package/dist/Bindings-DiKpBd7f.d.mts +153 -0
  12. package/dist/ClientErrors-CpXdFX5u.mjs +128 -0
  13. package/dist/ClientErrors-CpXdFX5u.mjs.map +1 -0
  14. package/dist/ClientErrors-D4IZHUM-.d.mts +101 -0
  15. package/dist/ClientFormats-CXomkXLV.mjs +73 -0
  16. package/dist/ClientFormats-CXomkXLV.mjs.map +1 -0
  17. package/dist/ClientFormats-Dm57ZPwR.d.mts +36 -0
  18. package/dist/Csv2Json-DynEcwCh.mjs +194 -0
  19. package/dist/Csv2Json-DynEcwCh.mjs.map +1 -0
  20. package/dist/Csv2Json-aXNVDoXQ.d.mts +40 -0
  21. package/dist/Csv2Rdf-8maXP6mt.d.mts +41 -0
  22. package/dist/Csv2Rdf-DuSEkaKE.mjs +161 -0
  23. package/dist/Csv2Rdf-DuSEkaKE.mjs.map +1 -0
  24. package/dist/Dataset-BlmlcI7J.mjs +782 -0
  25. package/dist/Dataset-BlmlcI7J.mjs.map +1 -0
  26. package/dist/Dataset-DS3ESOcO.d.mts +426 -0
  27. package/dist/Dataset.d.mts +2 -0
  28. package/dist/Dataset.mjs +1 -0
  29. package/dist/Datatype-CxMpamHC.d.mts +212 -0
  30. package/dist/Datatype-DQvkNkiH.mjs +1001 -0
  31. package/dist/Datatype-DQvkNkiH.mjs.map +1 -0
  32. package/dist/Dialect-8ChFj5EX.d.mts +113 -0
  33. package/dist/Dialect-CzVH38uo.mjs +165 -0
  34. package/dist/Dialect-CzVH38uo.mjs.map +1 -0
  35. package/dist/DocumentLoader-D3lZREnB.mjs +346 -0
  36. package/dist/DocumentLoader-D3lZREnB.mjs.map +1 -0
  37. package/dist/DocumentLoader-ZUCEVrW5.d.mts +178 -0
  38. package/dist/DublinCore-AnwqxRx6.mjs +137 -0
  39. package/dist/DublinCore-AnwqxRx6.mjs.map +1 -0
  40. package/dist/DublinCore-Dq-tVA5d.d.mts +119 -0
  41. package/dist/Engine-CYPB3g4h.d.mts +144 -0
  42. package/dist/Engine-DF8PN7g-.mjs +872 -0
  43. package/dist/Engine-DF8PN7g-.mjs.map +1 -0
  44. package/dist/Errors-CMdV1RhU.mjs +37 -0
  45. package/dist/Errors-CMdV1RhU.mjs.map +1 -0
  46. package/dist/Errors-u2bDjUeM.d.mts +30 -0
  47. package/dist/Evaluator-DEsU4d1o.d.mts +50 -0
  48. package/dist/Evaluator-DOY2-guC.mjs +281 -0
  49. package/dist/Evaluator-DOY2-guC.mjs.map +1 -0
  50. package/dist/Exif-CpqniYQd.d.mts +78 -0
  51. package/dist/Exif-DjkCfEB-.mjs +89 -0
  52. package/dist/Exif-DjkCfEB-.mjs.map +1 -0
  53. package/dist/Expression-BIMMvduQ.mjs +230 -0
  54. package/dist/Expression-BIMMvduQ.mjs.map +1 -0
  55. package/dist/Expression-W8A9cyX7.d.mts +89 -0
  56. package/dist/Extract-Bop85jES.mjs +220 -0
  57. package/dist/Extract-Bop85jES.mjs.map +1 -0
  58. package/dist/Extract-C_pCvuTC.d.mts +88 -0
  59. package/dist/Federation-BcNrozc1.d.mts +52 -0
  60. package/dist/Federation-CHScBkaK.mjs +130 -0
  61. package/dist/Federation-CHScBkaK.mjs.map +1 -0
  62. package/dist/Functions-AvjNcId_.mjs +1346 -0
  63. package/dist/Functions-AvjNcId_.mjs.map +1 -0
  64. package/dist/Functions-OQJZP-F6.d.mts +111 -0
  65. package/dist/Generator-C52mmq01.d.mts +50 -0
  66. package/dist/Generator-D3utCJC7.mjs +205 -0
  67. package/dist/Generator-D3utCJC7.mjs.map +1 -0
  68. package/dist/Grammar-CPlSxGH6.mjs +200 -0
  69. package/dist/Grammar-CPlSxGH6.mjs.map +1 -0
  70. package/dist/Grammar-CRhnRoCu.d.mts +148 -0
  71. package/dist/Grammar-D6jZdJQ3.d.mts +169 -0
  72. package/dist/Grammar-mQ8CgE1M.mjs +258 -0
  73. package/dist/Grammar-mQ8CgE1M.mjs.map +1 -0
  74. package/dist/GraphStore-DhUa4nFO.d.mts +45 -0
  75. package/dist/GraphStore-DvbqwKy1.mjs +212 -0
  76. package/dist/GraphStore-DvbqwKy1.mjs.map +1 -0
  77. package/dist/Iri-BB8Ks-BF.d.mts +84 -0
  78. package/dist/Iri-Cr92gsQV.mjs +232 -0
  79. package/dist/Iri-Cr92gsQV.mjs.map +1 -0
  80. package/dist/Iri.d.mts +2 -0
  81. package/dist/Iri.mjs +1 -0
  82. package/dist/Isomorphism-B6qTY-xy.d.mts +28 -0
  83. package/dist/Isomorphism-BmqxhKyJ.mjs +232 -0
  84. package/dist/Isomorphism-BmqxhKyJ.mjs.map +1 -0
  85. package/dist/Isomorphism-DInKnWIy.mjs +390 -0
  86. package/dist/Isomorphism-DInKnWIy.mjs.map +1 -0
  87. package/dist/Isomorphism-DvSfZXLR.d.mts +37 -0
  88. package/dist/Isomorphism.d.mts +2 -0
  89. package/dist/Isomorphism.mjs +1 -0
  90. package/dist/JsonLd-DOwS2FHg.mjs +2836 -0
  91. package/dist/JsonLd-DOwS2FHg.mjs.map +1 -0
  92. package/dist/JsonLd-DobFrQNa.d.mts +242 -0
  93. package/dist/JsonLdError-C9J-BxfG.mjs +106 -0
  94. package/dist/JsonLdError-C9J-BxfG.mjs.map +1 -0
  95. package/dist/JsonLdError-DSOfHkOy.d.mts +43 -0
  96. package/dist/LanguageTag-BCu8rcmX.d.mts +38 -0
  97. package/dist/LanguageTag-BcOpMGZ4.mjs +89 -0
  98. package/dist/LanguageTag-BcOpMGZ4.mjs.map +1 -0
  99. package/dist/LanguageTag.d.mts +2 -0
  100. package/dist/LanguageTag.mjs +1 -0
  101. package/dist/Lexical-Cg0JHrf6.mjs +243 -0
  102. package/dist/Lexical-Cg0JHrf6.mjs.map +1 -0
  103. package/dist/Lexical-D3zySYVS.d.mts +163 -0
  104. package/dist/Manifest-B6xf6mUc.mjs +148 -0
  105. package/dist/Manifest-B6xf6mUc.mjs.map +1 -0
  106. package/dist/Manifest-DQUMRBFr.d.mts +98 -0
  107. package/dist/Mapping-BgG74x3U.d.mts +63 -0
  108. package/dist/Mapping-Dc1ZGirk.mjs +259 -0
  109. package/dist/Mapping-Dc1ZGirk.mjs.map +1 -0
  110. package/dist/Mcp-1DwTTKOK.mjs +48 -0
  111. package/dist/Mcp-1DwTTKOK.mjs.map +1 -0
  112. package/dist/Mcp-d-pX9erx.d.mts +25 -0
  113. package/dist/Message-CK_DGQuu.mjs +95 -0
  114. package/dist/Message-CK_DGQuu.mjs.map +1 -0
  115. package/dist/Message-fIvTJSXM.d.mts +49 -0
  116. package/dist/Metadata-BbffwGDZ.mjs +445 -0
  117. package/dist/Metadata-BbffwGDZ.mjs.map +1 -0
  118. package/dist/Metadata-CEt3yc1-.d.mts +901 -0
  119. package/dist/Metadata-D4HsQNXr.mjs +1273 -0
  120. package/dist/Metadata-D4HsQNXr.mjs.map +1 -0
  121. package/dist/Metadata-nzS7QKRj.d.mts +350 -0
  122. package/dist/Model-DaMmxurZ.d.mts +293 -0
  123. package/dist/Model-DlPzRYhF.mjs +528 -0
  124. package/dist/Model-DlPzRYhF.mjs.map +1 -0
  125. package/dist/N3-BzyV-KIH.mjs +974 -0
  126. package/dist/N3-BzyV-KIH.mjs.map +1 -0
  127. package/dist/N3-DSLnonDn.d.mts +100 -0
  128. package/dist/NQuads-C1VBOJ3-.mjs +117 -0
  129. package/dist/NQuads-C1VBOJ3-.mjs.map +1 -0
  130. package/dist/NQuads-FjFZikFg.d.mts +76 -0
  131. package/dist/NTriples-D-kLSEAf.mjs +120 -0
  132. package/dist/NTriples-D-kLSEAf.mjs.map +1 -0
  133. package/dist/NTriples-D34OspfW.d.mts +76 -0
  134. package/dist/Namespace-ClTUO_ya.d.mts +42 -0
  135. package/dist/Namespace-DHFIsORd.mjs +75 -0
  136. package/dist/Namespace-DHFIsORd.mjs.map +1 -0
  137. package/dist/Namespace.d.mts +2 -0
  138. package/dist/Namespace.mjs +1 -0
  139. package/dist/Namespaces-Bz85vpjW.mjs +235 -0
  140. package/dist/Namespaces-Bz85vpjW.mjs.map +1 -0
  141. package/dist/Namespaces-C1jW6EDo.d.mts +178 -0
  142. package/dist/Optimizer-BWWQRQPY.mjs +168 -0
  143. package/dist/Optimizer-BWWQRQPY.mjs.map +1 -0
  144. package/dist/Optimizer-DUpUow6k.d.mts +26 -0
  145. package/dist/Options-BLBGL4HE.mjs +72 -0
  146. package/dist/Options-BLBGL4HE.mjs.map +1 -0
  147. package/dist/Options-BommQwP9.d.mts +127 -0
  148. package/dist/Packet-CA76wVX3.mjs +197 -0
  149. package/dist/Packet-CA76wVX3.mjs.map +1 -0
  150. package/dist/Packet-Cy5g6XuW.d.mts +130 -0
  151. package/dist/Parser-p1Gyr0QN.d.mts +85 -0
  152. package/dist/Parser-xARsOWXk.mjs +1317 -0
  153. package/dist/Parser-xARsOWXk.mjs.map +1 -0
  154. package/dist/Path-B20Yp8KE.mjs +284 -0
  155. package/dist/Path-B20Yp8KE.mjs.map +1 -0
  156. package/dist/Path-DRB8e-Zn.d.mts +181 -0
  157. package/dist/Pdf-B9RZn--8.d.mts +77 -0
  158. package/dist/Pdf-CKK6dkZn.mjs +89 -0
  159. package/dist/Pdf-CKK6dkZn.mjs.map +1 -0
  160. package/dist/PdfA-CUjSuntT.d.mts +109 -0
  161. package/dist/PdfA-CleOhuL6.mjs +124 -0
  162. package/dist/PdfA-CleOhuL6.mjs.map +1 -0
  163. package/dist/Photoshop-CiHo80qV.mjs +233 -0
  164. package/dist/Photoshop-CiHo80qV.mjs.map +1 -0
  165. package/dist/Photoshop-udKZ0I3N.d.mts +204 -0
  166. package/dist/PrefixMap-BHFPDLO-.mjs +103 -0
  167. package/dist/PrefixMap-BHFPDLO-.mjs.map +1 -0
  168. package/dist/PrefixMap-BMlXrWNd.d.mts +64 -0
  169. package/dist/PrefixMap.d.mts +2 -0
  170. package/dist/PrefixMap.mjs +1 -0
  171. package/dist/Processor-CMmecFsb.mjs +198 -0
  172. package/dist/Processor-CMmecFsb.mjs.map +1 -0
  173. package/dist/Processor-FJPvO0CB.d.mts +435 -0
  174. package/dist/Protocol-BA7OkNgp.mjs +202 -0
  175. package/dist/Protocol-BA7OkNgp.mjs.map +1 -0
  176. package/dist/Protocol-DlSoiIKB.d.mts +108 -0
  177. package/dist/ProtocolErrors-Ckfejnl6.d.mts +84 -0
  178. package/dist/ProtocolErrors-czDPVcX5.mjs +129 -0
  179. package/dist/ProtocolErrors-czDPVcX5.mjs.map +1 -0
  180. package/dist/Query-D9A6LOpP.mjs +364 -0
  181. package/dist/Query-D9A6LOpP.mjs.map +1 -0
  182. package/dist/Query-KqSkTYyG.d.mts +96 -0
  183. package/dist/QueryBuilder-BLK9Vfbz.mjs +674 -0
  184. package/dist/QueryBuilder-BLK9Vfbz.mjs.map +1 -0
  185. package/dist/QueryBuilder-DUqh4ECe.d.mts +529 -0
  186. package/dist/RdfJs-D6-49XB5.mjs +86 -0
  187. package/dist/RdfJs-D6-49XB5.mjs.map +1 -0
  188. package/dist/RdfJs-DXFqdWrd.d.mts +76 -0
  189. package/dist/RdfJs.d.mts +2 -0
  190. package/dist/RdfJs.mjs +1 -0
  191. package/dist/RdfJson-5aKPDlPS.d.mts +297 -0
  192. package/dist/RdfJson-BNocgW4f.mjs +548 -0
  193. package/dist/RdfJson-BNocgW4f.mjs.map +1 -0
  194. package/dist/RdfXml-DJ9G4gOq.mjs +1014 -0
  195. package/dist/RdfXml-DJ9G4gOq.mjs.map +1 -0
  196. package/dist/RdfXml-_N7yxWEp.d.mts +149 -0
  197. package/dist/Rdfs-BRVPsAjc.d.mts +84 -0
  198. package/dist/Rdfs-CyY2wVHI.mjs +167 -0
  199. package/dist/Rdfs-CyY2wVHI.mjs.map +1 -0
  200. package/dist/Rdfs.d.mts +2 -0
  201. package/dist/Rdfs.mjs +1 -0
  202. package/dist/Reasoner-BxYhx9s7.d.mts +94 -0
  203. package/dist/Reasoner-Cw90zrjv.mjs +798 -0
  204. package/dist/Reasoner-Cw90zrjv.mjs.map +1 -0
  205. package/dist/Reification-BmN4EfnM.d.mts +40 -0
  206. package/dist/Reification-dpqQvjDE.mjs +82 -0
  207. package/dist/Reification-dpqQvjDE.mjs.map +1 -0
  208. package/dist/Reification.d.mts +2 -0
  209. package/dist/Reification.mjs +1 -0
  210. package/dist/Report-XHs8htzK.mjs +121 -0
  211. package/dist/Report-XHs8htzK.mjs.map +1 -0
  212. package/dist/Report-hcXsc_19.d.mts +115 -0
  213. package/dist/Resource-B1cI8FyJ.d.mts +218 -0
  214. package/dist/Resource-sIEeNh15.mjs +374 -0
  215. package/dist/Resource-sIEeNh15.mjs.map +1 -0
  216. package/dist/Resource.d.mts +2 -0
  217. package/dist/Resource.mjs +1 -0
  218. package/dist/Results-BVNEC-Wt.d.mts +277 -0
  219. package/dist/Results-peJjGA2V.mjs +621 -0
  220. package/dist/Results-peJjGA2V.mjs.map +1 -0
  221. package/dist/ResultsStream-BhF0OcNn.mjs +639 -0
  222. package/dist/ResultsStream-BhF0OcNn.mjs.map +1 -0
  223. package/dist/ResultsStream-toYMXrOe.d.mts +100 -0
  224. package/dist/SemAct-CDchtk49.d.mts +96 -0
  225. package/dist/SemAct-CmyT4yI8.mjs +118 -0
  226. package/dist/SemAct-CmyT4yI8.mjs.map +1 -0
  227. package/dist/Serialization-DP9H5bYQ.mjs +514 -0
  228. package/dist/Serialization-DP9H5bYQ.mjs.map +1 -0
  229. package/dist/Serialization-Df8iVauT.d.mts +392 -0
  230. package/dist/Serialization.d.mts +2 -0
  231. package/dist/Serialization.mjs +1 -0
  232. package/dist/ServerFormats-CrRnjjf6.mjs +64 -0
  233. package/dist/ServerFormats-CrRnjjf6.mjs.map +1 -0
  234. package/dist/ServerFormats-DjC9NsO_.d.mts +36 -0
  235. package/dist/ServiceDescription-BERsvg-k.d.mts +54 -0
  236. package/dist/ServiceDescription-Dq5hxeGy.mjs +97 -0
  237. package/dist/ServiceDescription-Dq5hxeGy.mjs.map +1 -0
  238. package/dist/ShExC-Ctf-06CL.d.mts +67 -0
  239. package/dist/ShExC-DJbB19i3.mjs +1181 -0
  240. package/dist/ShExC-DJbB19i3.mjs.map +1 -0
  241. package/dist/ShExError-BeYFD9rv.d.mts +61 -0
  242. package/dist/ShExError-CVtq2NnM.mjs +64 -0
  243. package/dist/ShExError-CVtq2NnM.mjs.map +1 -0
  244. package/dist/ShExJ-C1u_wgyD.d.mts +531 -0
  245. package/dist/ShExJ-COiPd9Xw.mjs +532 -0
  246. package/dist/ShExJ-COiPd9Xw.mjs.map +1 -0
  247. package/dist/ShExR-ByR4mCh-.mjs +480 -0
  248. package/dist/ShExR-ByR4mCh-.mjs.map +1 -0
  249. package/dist/ShExR-CqONNNBz.d.mts +40 -0
  250. package/dist/ShapeMap-C422pxKl.d.mts +140 -0
  251. package/dist/ShapeMap-CsgKxB2G.mjs +181 -0
  252. package/dist/ShapeMap-CsgKxB2G.mjs.map +1 -0
  253. package/dist/Shapes-18GjfyBV.mjs +597 -0
  254. package/dist/Shapes-18GjfyBV.mjs.map +1 -0
  255. package/dist/Shapes-BQFDFc4Q.d.mts +306 -0
  256. package/dist/Sparql-BiYFMSpl.mjs +29 -0
  257. package/dist/Sparql-BiYFMSpl.mjs.map +1 -0
  258. package/dist/Sparql-DecpWTPh.d.mts +97 -0
  259. package/dist/SparqlClient-C_CjXbwj.mjs +333 -0
  260. package/dist/SparqlClient-C_CjXbwj.mjs.map +1 -0
  261. package/dist/SparqlClient-UPc88SHy.d.mts +290 -0
  262. package/dist/SparqlServer-CbUW-pVj.d.mts +71 -0
  263. package/dist/SparqlServer-Db7w7Cll.mjs +308 -0
  264. package/dist/SparqlServer-Db7w7Cll.mjs.map +1 -0
  265. package/dist/SqlStore-BBqFx-Wl.mjs +684 -0
  266. package/dist/SqlStore-BBqFx-Wl.mjs.map +1 -0
  267. package/dist/SqlStore-CCJo5I-e.d.mts +117 -0
  268. package/dist/Store-D0jmVfb3.d.mts +166 -0
  269. package/dist/Store-DH3Ow1GO.mjs +162 -0
  270. package/dist/Store-DH3Ow1GO.mjs.map +1 -0
  271. package/dist/Structure-BjMo4Bkc.mjs +334 -0
  272. package/dist/Structure-BjMo4Bkc.mjs.map +1 -0
  273. package/dist/Structure-n4CmDiab.d.mts +63 -0
  274. package/dist/Table-BGgm9nbM.mjs +538 -0
  275. package/dist/Table-BGgm9nbM.mjs.map +1 -0
  276. package/dist/Table-C3reiVrb.d.mts +261 -0
  277. package/dist/Term-B_4ezyXq.d.mts +619 -0
  278. package/dist/Term-CFLG1qu4.mjs +991 -0
  279. package/dist/Term-CFLG1qu4.mjs.map +1 -0
  280. package/dist/Term.d.mts +2 -0
  281. package/dist/Term.mjs +1 -0
  282. package/dist/TermCodec-CDZiEztW.mjs +397 -0
  283. package/dist/TermCodec-CDZiEztW.mjs.map +1 -0
  284. package/dist/TermCodec-_03bDXr0.d.mts +209 -0
  285. package/dist/TermCodec.d.mts +2 -0
  286. package/dist/TermCodec.mjs +1 -0
  287. package/dist/TermJson-BOPe0yve.d.mts +232 -0
  288. package/dist/TermJson-FAg3lvjl.mjs +142 -0
  289. package/dist/TermJson-FAg3lvjl.mjs.map +1 -0
  290. package/dist/TermJson.d.mts +2 -0
  291. package/dist/TermJson.mjs +1 -0
  292. package/dist/TermSchema-Bn9CoaYA.mjs +30 -0
  293. package/dist/TermSchema-Bn9CoaYA.mjs.map +1 -0
  294. package/dist/TermSchema-DBO6MroX.d.mts +6 -0
  295. package/dist/Testing-B-aPCpmu.mjs +63 -0
  296. package/dist/Testing-B-aPCpmu.mjs.map +1 -0
  297. package/dist/Testing-CF6s8P3O.d.mts +53 -0
  298. package/dist/Tiff-CR-2QeSI.d.mts +148 -0
  299. package/dist/Tiff-DlsOlZPM.mjs +169 -0
  300. package/dist/Tiff-DlsOlZPM.mjs.map +1 -0
  301. package/dist/Tools-7MdRKccr.d.mts +583 -0
  302. package/dist/Tools-ryxphZbI.mjs +329 -0
  303. package/dist/Tools-ryxphZbI.mjs.map +1 -0
  304. package/dist/Translate-B0YKKANS.d.mts +37 -0
  305. package/dist/Translate-gzWPq0Ia.mjs +308 -0
  306. package/dist/Translate-gzWPq0Ia.mjs.map +1 -0
  307. package/dist/Translation-DC9rLm2y.mjs +1535 -0
  308. package/dist/Translation-DC9rLm2y.mjs.map +1 -0
  309. package/dist/Translation-K4L9XBqX.d.mts +103 -0
  310. package/dist/TriG-BkqtqZ6Y.mjs +125 -0
  311. package/dist/TriG-BkqtqZ6Y.mjs.map +1 -0
  312. package/dist/TriG-xDjdDatp.d.mts +86 -0
  313. package/dist/Turtle-Bv1_bisW.d.mts +85 -0
  314. package/dist/Turtle-CZVUOtwl.mjs +133 -0
  315. package/dist/Turtle-CZVUOtwl.mjs.map +1 -0
  316. package/dist/ValidationReport-DBdJshW5.mjs +285 -0
  317. package/dist/ValidationReport-DBdJshW5.mjs.map +1 -0
  318. package/dist/ValidationReport-Dx3WxY0h.d.mts +192 -0
  319. package/dist/Validator-227ff9Rn.d.mts +179 -0
  320. package/dist/Validator-BzXMKDeJ.mjs +1162 -0
  321. package/dist/Validator-BzXMKDeJ.mjs.map +1 -0
  322. package/dist/Validator-Dl8cih5V.d.mts +207 -0
  323. package/dist/Validator-DmUfMbpL.mjs +568 -0
  324. package/dist/Validator-DmUfMbpL.mjs.map +1 -0
  325. package/dist/Vocab-DceKywpq.mjs +168 -0
  326. package/dist/Vocab-DceKywpq.mjs.map +1 -0
  327. package/dist/Vocab-Df-L-IwZ.d.mts +46 -0
  328. package/dist/Vocab-Do56UgBX.d.mts +81 -0
  329. package/dist/Vocab-TfpWG1Ne.mjs +118 -0
  330. package/dist/Vocab-TfpWG1Ne.mjs.map +1 -0
  331. package/dist/Vocab.d.mts +2 -0
  332. package/dist/Vocab.mjs +1 -0
  333. package/dist/Vocabulary-C6-GPOy4.d.mts +22 -0
  334. package/dist/Vocabulary-CnQl-_Z4.mjs +179 -0
  335. package/dist/Vocabulary-CnQl-_Z4.mjs.map +1 -0
  336. package/dist/Xml-B7iihYCS.mjs +976 -0
  337. package/dist/Xml-B7iihYCS.mjs.map +1 -0
  338. package/dist/Xml-CmfHS7SW.d.mts +267 -0
  339. package/dist/Xmp-D7CKA7MZ.d.mts +111 -0
  340. package/dist/Xmp-DCGN9pOD.mjs +307 -0
  341. package/dist/Xmp-DCGN9pOD.mjs.map +1 -0
  342. package/dist/XmpBasic-CP38jpR_.mjs +73 -0
  343. package/dist/XmpBasic-CP38jpR_.mjs.map +1 -0
  344. package/dist/XmpBasic-Cmbe53rQ.d.mts +64 -0
  345. package/dist/XmpMM-BfL_TgJF.mjs +73 -0
  346. package/dist/XmpMM-BfL_TgJF.mjs.map +1 -0
  347. package/dist/XmpMM-Dqm3IX8p.d.mts +63 -0
  348. package/dist/XmpRights-BKPtoI5L.mjs +73 -0
  349. package/dist/XmpRights-BKPtoI5L.mjs.map +1 -0
  350. package/dist/XmpRights-CaALZQz2.d.mts +63 -0
  351. package/dist/Xsd-Cdgx5zRB.mjs +405 -0
  352. package/dist/Xsd-Cdgx5zRB.mjs.map +1 -0
  353. package/dist/Xsd-D2elNhSm.d.mts +187 -0
  354. package/dist/Xsd.d.mts +2 -0
  355. package/dist/Xsd.mjs +1 -0
  356. package/dist/accessors-CEjaojuQ.mjs +28 -0
  357. package/dist/accessors-CEjaojuQ.mjs.map +1 -0
  358. package/dist/codec-Lb2T96rv.d.mts +20 -0
  359. package/dist/codec-QNo7IdJF.mjs +389 -0
  360. package/dist/codec-QNo7IdJF.mjs.map +1 -0
  361. package/dist/csvw/Csv2Json.d.mts +2 -0
  362. package/dist/csvw/Csv2Json.mjs +1 -0
  363. package/dist/csvw/Csv2Rdf.d.mts +2 -0
  364. package/dist/csvw/Csv2Rdf.mjs +1 -0
  365. package/dist/csvw/Datatype.d.mts +2 -0
  366. package/dist/csvw/Datatype.mjs +1 -0
  367. package/dist/csvw/Metadata.d.mts +2 -0
  368. package/dist/csvw/Metadata.mjs +1 -0
  369. package/dist/csvw/Processor.d.mts +2 -0
  370. package/dist/csvw/Processor.mjs +1 -0
  371. package/dist/csvw/Report.d.mts +2 -0
  372. package/dist/csvw/Report.mjs +1 -0
  373. package/dist/csvw/Table.d.mts +2 -0
  374. package/dist/csvw/Table.mjs +1 -0
  375. package/dist/csvw/index.d.mts +8 -0
  376. package/dist/csvw/index.mjs +8 -0
  377. package/dist/index-Cms2TYfC.d.mts +16 -0
  378. package/dist/index-Ct8xFmRs.d.mts +7 -0
  379. package/dist/index-D4QFwOjm.d.mts +28 -0
  380. package/dist/index.d.mts +18 -0
  381. package/dist/index.mjs +17 -0
  382. package/dist/jsonld/DocumentLoader.d.mts +2 -0
  383. package/dist/jsonld/DocumentLoader.mjs +1 -0
  384. package/dist/jsonld/JsonLd.d.mts +2 -0
  385. package/dist/jsonld/JsonLd.mjs +1 -0
  386. package/dist/jsonld/JsonLdError.d.mts +2 -0
  387. package/dist/jsonld/JsonLdError.mjs +1 -0
  388. package/dist/jsonld/index.d.mts +4 -0
  389. package/dist/jsonld/index.mjs +4 -0
  390. package/dist/lists-D-OpQ0Ir.mjs +77 -0
  391. package/dist/lists-D-OpQ0Ir.mjs.map +1 -0
  392. package/dist/loop-D5-gNx9K.mjs +21 -0
  393. package/dist/loop-D5-gNx9K.mjs.map +1 -0
  394. package/dist/loop-DZ2hXlr_.mjs +21 -0
  395. package/dist/loop-DZ2hXlr_.mjs.map +1 -0
  396. package/dist/n3/Isomorphism.d.mts +2 -0
  397. package/dist/n3/Isomorphism.mjs +1 -0
  398. package/dist/n3/Mapping.d.mts +2 -0
  399. package/dist/n3/Mapping.mjs +1 -0
  400. package/dist/n3/Model.d.mts +2 -0
  401. package/dist/n3/Model.mjs +1 -0
  402. package/dist/n3/N3.d.mts +2 -0
  403. package/dist/n3/N3.mjs +1 -0
  404. package/dist/n3/Reasoner.d.mts +2 -0
  405. package/dist/n3/Reasoner.mjs +2 -0
  406. package/dist/n3/Vocab.d.mts +2 -0
  407. package/dist/n3/Vocab.mjs +1 -0
  408. package/dist/n3/index.d.mts +7 -0
  409. package/dist/n3/index.mjs +7 -0
  410. package/dist/ntriples/Grammar.d.mts +2 -0
  411. package/dist/ntriples/Grammar.mjs +1 -0
  412. package/dist/ntriples/Lexical.d.mts +2 -0
  413. package/dist/ntriples/Lexical.mjs +1 -0
  414. package/dist/ntriples/NQuads.d.mts +2 -0
  415. package/dist/ntriples/NQuads.mjs +1 -0
  416. package/dist/ntriples/NTriples.d.mts +2 -0
  417. package/dist/ntriples/NTriples.mjs +1 -0
  418. package/dist/ntriples/index.d.mts +5 -0
  419. package/dist/ntriples/index.mjs +5 -0
  420. package/dist/rdfjson/RdfJson.d.mts +2 -0
  421. package/dist/rdfjson/RdfJson.mjs +1 -0
  422. package/dist/rdfjson/index.d.mts +2 -0
  423. package/dist/rdfjson/index.mjs +1 -0
  424. package/dist/rdfxml/RdfXml.d.mts +2 -0
  425. package/dist/rdfxml/RdfXml.mjs +1 -0
  426. package/dist/rdfxml/Xml.d.mts +2 -0
  427. package/dist/rdfxml/Xml.mjs +1 -0
  428. package/dist/rdfxml/index.d.mts +3 -0
  429. package/dist/rdfxml/index.mjs +3 -0
  430. package/dist/rolldown-runtime-D8jQpDG7.mjs +12 -0
  431. package/dist/serialize-96KBvKaf.mjs +1463 -0
  432. package/dist/serialize-96KBvKaf.mjs.map +1 -0
  433. package/dist/serialize-DsoXdM6n.d.mts +37 -0
  434. package/dist/shacl/Message.d.mts +2 -0
  435. package/dist/shacl/Message.mjs +1 -0
  436. package/dist/shacl/Path.d.mts +2 -0
  437. package/dist/shacl/Path.mjs +1 -0
  438. package/dist/shacl/Shapes.d.mts +2 -0
  439. package/dist/shacl/Shapes.mjs +1 -0
  440. package/dist/shacl/Sparql.d.mts +2 -0
  441. package/dist/shacl/Sparql.mjs +1 -0
  442. package/dist/shacl/ValidationReport.d.mts +2 -0
  443. package/dist/shacl/ValidationReport.mjs +1 -0
  444. package/dist/shacl/Validator.d.mts +2 -0
  445. package/dist/shacl/Validator.mjs +1 -0
  446. package/dist/shacl/Vocabulary.d.mts +2 -0
  447. package/dist/shacl/Vocabulary.mjs +1 -0
  448. package/dist/shacl/index.d.mts +9 -0
  449. package/dist/shacl/index.mjs +8 -0
  450. package/dist/shex/SemAct.d.mts +2 -0
  451. package/dist/shex/SemAct.mjs +1 -0
  452. package/dist/shex/ShExC.d.mts +2 -0
  453. package/dist/shex/ShExC.mjs +1 -0
  454. package/dist/shex/ShExError.d.mts +2 -0
  455. package/dist/shex/ShExError.mjs +1 -0
  456. package/dist/shex/ShExJ.d.mts +2 -0
  457. package/dist/shex/ShExJ.mjs +2 -0
  458. package/dist/shex/ShExR.d.mts +2 -0
  459. package/dist/shex/ShExR.mjs +1 -0
  460. package/dist/shex/ShapeMap.d.mts +2 -0
  461. package/dist/shex/ShapeMap.mjs +1 -0
  462. package/dist/shex/Structure.d.mts +2 -0
  463. package/dist/shex/Structure.mjs +2 -0
  464. package/dist/shex/Validator.d.mts +2 -0
  465. package/dist/shex/Validator.mjs +4 -0
  466. package/dist/shex/index.d.mts +9 -0
  467. package/dist/shex/index.mjs +9 -0
  468. package/dist/sparql/Algebra.d.mts +2 -0
  469. package/dist/sparql/Algebra.mjs +1 -0
  470. package/dist/sparql/Ast.d.mts +2 -0
  471. package/dist/sparql/Ast.mjs +1 -0
  472. package/dist/sparql/Bindings.d.mts +2 -0
  473. package/dist/sparql/Bindings.mjs +1 -0
  474. package/dist/sparql/ClientErrors.d.mts +2 -0
  475. package/dist/sparql/ClientErrors.mjs +1 -0
  476. package/dist/sparql/ClientFormats.d.mts +2 -0
  477. package/dist/sparql/ClientFormats.mjs +1 -0
  478. package/dist/sparql/Engine.d.mts +2 -0
  479. package/dist/sparql/Engine.mjs +1 -0
  480. package/dist/sparql/Errors.d.mts +2 -0
  481. package/dist/sparql/Errors.mjs +1 -0
  482. package/dist/sparql/Expression.d.mts +2 -0
  483. package/dist/sparql/Expression.mjs +1 -0
  484. package/dist/sparql/Federation.d.mts +2 -0
  485. package/dist/sparql/Federation.mjs +1 -0
  486. package/dist/sparql/Functions.d.mts +2 -0
  487. package/dist/sparql/Functions.mjs +1 -0
  488. package/dist/sparql/Generator.d.mts +2 -0
  489. package/dist/sparql/Generator.mjs +1 -0
  490. package/dist/sparql/GraphStore.d.mts +2 -0
  491. package/dist/sparql/GraphStore.mjs +1 -0
  492. package/dist/sparql/Optimizer.d.mts +2 -0
  493. package/dist/sparql/Optimizer.mjs +1 -0
  494. package/dist/sparql/Options.d.mts +2 -0
  495. package/dist/sparql/Options.mjs +1 -0
  496. package/dist/sparql/Parser.d.mts +2 -0
  497. package/dist/sparql/Parser.mjs +1 -0
  498. package/dist/sparql/Protocol.d.mts +2 -0
  499. package/dist/sparql/Protocol.mjs +1 -0
  500. package/dist/sparql/ProtocolErrors.d.mts +2 -0
  501. package/dist/sparql/ProtocolErrors.mjs +1 -0
  502. package/dist/sparql/QueryBuilder.d.mts +2 -0
  503. package/dist/sparql/QueryBuilder.mjs +1 -0
  504. package/dist/sparql/Results.d.mts +2 -0
  505. package/dist/sparql/Results.mjs +1 -0
  506. package/dist/sparql/ResultsStream.d.mts +2 -0
  507. package/dist/sparql/ResultsStream.mjs +1 -0
  508. package/dist/sparql/ServerFormats.d.mts +2 -0
  509. package/dist/sparql/ServerFormats.mjs +1 -0
  510. package/dist/sparql/ServiceDescription.d.mts +2 -0
  511. package/dist/sparql/ServiceDescription.mjs +1 -0
  512. package/dist/sparql/SparqlClient.d.mts +2 -0
  513. package/dist/sparql/SparqlClient.mjs +1 -0
  514. package/dist/sparql/SparqlServer.d.mts +2 -0
  515. package/dist/sparql/SparqlServer.mjs +1 -0
  516. package/dist/sparql/Store.d.mts +2 -0
  517. package/dist/sparql/Store.mjs +1 -0
  518. package/dist/sparql/TermSchema.d.mts +3 -0
  519. package/dist/sparql/TermSchema.mjs +2 -0
  520. package/dist/sparql/Testing.d.mts +2 -0
  521. package/dist/sparql/Testing.mjs +1 -0
  522. package/dist/sparql/Translate.d.mts +2 -0
  523. package/dist/sparql/Translate.mjs +1 -0
  524. package/dist/sparql/ai/Mcp.d.mts +2 -0
  525. package/dist/sparql/ai/Mcp.mjs +1 -0
  526. package/dist/sparql/ai/Tools.d.mts +2 -0
  527. package/dist/sparql/ai/Tools.mjs +1 -0
  528. package/dist/sparql/ai/index.d.mts +3 -0
  529. package/dist/sparql/ai/index.mjs +3 -0
  530. package/dist/sparql/index.d.mts +30 -0
  531. package/dist/sparql/index.mjs +29 -0
  532. package/dist/sparql/shacl/Evaluator.d.mts +2 -0
  533. package/dist/sparql/shacl/Evaluator.mjs +1 -0
  534. package/dist/sparql/shacl/Query.d.mts +2 -0
  535. package/dist/sparql/shacl/Query.mjs +1 -0
  536. package/dist/sparql/shacl/index.d.mts +3 -0
  537. package/dist/sparql/shacl/index.mjs +3 -0
  538. package/dist/sparql/sql/Dialect.d.mts +2 -0
  539. package/dist/sparql/sql/Dialect.mjs +1 -0
  540. package/dist/sparql/sql/SqlStore.d.mts +2 -0
  541. package/dist/sparql/sql/SqlStore.mjs +1 -0
  542. package/dist/sparql/sql/Translation.d.mts +2 -0
  543. package/dist/sparql/sql/Translation.mjs +1 -0
  544. package/dist/sparql/sql/index.d.mts +4 -0
  545. package/dist/sparql/sql/index.mjs +4 -0
  546. package/dist/stringMap-D5YIpYtR.mjs +38 -0
  547. package/dist/stringMap-D5YIpYtR.mjs.map +1 -0
  548. package/dist/tokens-C6BzeodQ.mjs +24 -0
  549. package/dist/tokens-C6BzeodQ.mjs.map +1 -0
  550. package/dist/turtle/Grammar.d.mts +3 -0
  551. package/dist/turtle/Grammar.mjs +3 -0
  552. package/dist/turtle/Manifest.d.mts +2 -0
  553. package/dist/turtle/Manifest.mjs +1 -0
  554. package/dist/turtle/TriG.d.mts +2 -0
  555. package/dist/turtle/TriG.mjs +1 -0
  556. package/dist/turtle/Turtle.d.mts +2 -0
  557. package/dist/turtle/Turtle.mjs +1 -0
  558. package/dist/turtle/index.d.mts +5 -0
  559. package/dist/turtle/index.mjs +5 -0
  560. package/dist/xmp/DublinCore.d.mts +2 -0
  561. package/dist/xmp/DublinCore.mjs +1 -0
  562. package/dist/xmp/Exif.d.mts +2 -0
  563. package/dist/xmp/Exif.mjs +1 -0
  564. package/dist/xmp/Extract.d.mts +2 -0
  565. package/dist/xmp/Extract.mjs +1 -0
  566. package/dist/xmp/Metadata.d.mts +2 -0
  567. package/dist/xmp/Metadata.mjs +1 -0
  568. package/dist/xmp/Namespaces.d.mts +2 -0
  569. package/dist/xmp/Namespaces.mjs +1 -0
  570. package/dist/xmp/Packet.d.mts +2 -0
  571. package/dist/xmp/Packet.mjs +1 -0
  572. package/dist/xmp/Pdf.d.mts +2 -0
  573. package/dist/xmp/Pdf.mjs +1 -0
  574. package/dist/xmp/PdfA.d.mts +2 -0
  575. package/dist/xmp/PdfA.mjs +1 -0
  576. package/dist/xmp/Photoshop.d.mts +2 -0
  577. package/dist/xmp/Photoshop.mjs +1 -0
  578. package/dist/xmp/Tiff.d.mts +2 -0
  579. package/dist/xmp/Tiff.mjs +1 -0
  580. package/dist/xmp/Xmp.d.mts +2 -0
  581. package/dist/xmp/Xmp.mjs +3 -0
  582. package/dist/xmp/XmpBasic.d.mts +2 -0
  583. package/dist/xmp/XmpBasic.mjs +1 -0
  584. package/dist/xmp/XmpMM.d.mts +2 -0
  585. package/dist/xmp/XmpMM.mjs +1 -0
  586. package/dist/xmp/XmpRights.d.mts +2 -0
  587. package/dist/xmp/XmpRights.mjs +1 -0
  588. package/dist/xmp/index.d.mts +15 -0
  589. package/dist/xmp/index.mjs +15 -0
  590. package/package.json +187 -3
  591. package/src/Dataset.ts +1085 -0
  592. package/src/Iri.ts +322 -0
  593. package/src/Isomorphism.ts +319 -0
  594. package/src/LanguageTag.ts +98 -0
  595. package/src/Namespace.ts +100 -0
  596. package/src/PrefixMap.ts +117 -0
  597. package/src/RdfJs.ts +146 -0
  598. package/src/Rdfs.ts +241 -0
  599. package/src/Reification.ts +103 -0
  600. package/src/Resource.ts +873 -0
  601. package/src/Serialization.ts +775 -0
  602. package/src/Term.ts +1300 -0
  603. package/src/TermCodec.ts +505 -0
  604. package/src/TermJson.ts +313 -0
  605. package/src/Vocab.ts +161 -0
  606. package/src/Xsd.ts +573 -0
  607. package/src/csvw/Csv2Json.ts +265 -0
  608. package/src/csvw/Csv2Rdf.ts +268 -0
  609. package/src/csvw/Datatype.ts +589 -0
  610. package/src/csvw/Metadata.ts +1523 -0
  611. package/src/csvw/Processor.ts +276 -0
  612. package/src/csvw/Report.ts +135 -0
  613. package/src/csvw/Table.ts +759 -0
  614. package/src/csvw/index.ts +22 -0
  615. package/src/csvw/internal/dateFormat.ts +202 -0
  616. package/src/csvw/internal/json.ts +104 -0
  617. package/src/csvw/internal/numberFormat.ts +369 -0
  618. package/src/csvw/internal/object.ts +23 -0
  619. package/src/csvw/internal/uriTemplate.ts +130 -0
  620. package/src/csvw/internal/url.ts +93 -0
  621. package/src/csvw/internal/vocab.ts +282 -0
  622. package/src/index.ts +40 -0
  623. package/src/internal/arbitrary.ts +148 -0
  624. package/src/internal/loop.ts +24 -0
  625. package/src/internal/pending.ts +20 -0
  626. package/src/internal/textDecoder.ts +183 -0
  627. package/src/jsonld/DocumentLoader.ts +512 -0
  628. package/src/jsonld/JsonLd.ts +847 -0
  629. package/src/jsonld/JsonLdError.ts +105 -0
  630. package/src/jsonld/index.ts +13 -0
  631. package/src/jsonld/internal/compact.ts +852 -0
  632. package/src/jsonld/internal/context.ts +781 -0
  633. package/src/jsonld/internal/expand.ts +614 -0
  634. package/src/jsonld/internal/flatten.ts +243 -0
  635. package/src/jsonld/internal/frame.ts +559 -0
  636. package/src/jsonld/internal/iri.ts +52 -0
  637. package/src/jsonld/internal/json.ts +19 -0
  638. package/src/jsonld/internal/linkHeader.ts +60 -0
  639. package/src/jsonld/internal/rdf.ts +481 -0
  640. package/src/jsonld/internal/util.ts +367 -0
  641. package/src/n3/Isomorphism.ts +476 -0
  642. package/src/n3/Mapping.ts +332 -0
  643. package/src/n3/Model.ts +696 -0
  644. package/src/n3/N3.ts +237 -0
  645. package/src/n3/Reasoner.ts +568 -0
  646. package/src/n3/Vocab.ts +111 -0
  647. package/src/n3/index.ts +21 -0
  648. package/src/n3/internal/builtins.ts +668 -0
  649. package/src/n3/internal/guards.ts +23 -0
  650. package/src/n3/internal/lists.ts +106 -0
  651. package/src/n3/internal/loop.ts +28 -0
  652. package/src/n3/internal/parser.ts +1032 -0
  653. package/src/n3/internal/writer.ts +344 -0
  654. package/src/ntriples/Grammar.ts +317 -0
  655. package/src/ntriples/Lexical.ts +321 -0
  656. package/src/ntriples/NQuads.ts +140 -0
  657. package/src/ntriples/NTriples.ts +143 -0
  658. package/src/ntriples/index.ts +14 -0
  659. package/src/ntriples/internal/codec.ts +229 -0
  660. package/src/ntriples/internal/lineParser.ts +326 -0
  661. package/src/ntriples/internal/loop.ts +14 -0
  662. package/src/rdfjson/RdfJson.ts +806 -0
  663. package/src/rdfjson/index.ts +9 -0
  664. package/src/rdfjson/internal/json.ts +19 -0
  665. package/src/rdfxml/RdfXml.ts +1408 -0
  666. package/src/rdfxml/Xml.ts +419 -0
  667. package/src/rdfxml/index.ts +11 -0
  668. package/src/rdfxml/internal/chars.ts +73 -0
  669. package/src/rdfxml/internal/loop.ts +24 -0
  670. package/src/rdfxml/internal/parser.ts +1265 -0
  671. package/src/shacl/Message.ts +102 -0
  672. package/src/shacl/Path.ts +483 -0
  673. package/src/shacl/Shapes.ts +913 -0
  674. package/src/shacl/Sparql.ts +128 -0
  675. package/src/shacl/ValidationReport.ts +438 -0
  676. package/src/shacl/Validator.ts +1156 -0
  677. package/src/shacl/Vocabulary.ts +180 -0
  678. package/src/shacl/index.ts +22 -0
  679. package/src/shacl/internal/compare.ts +128 -0
  680. package/src/shacl/internal/regex.ts +56 -0
  681. package/src/shex/SemAct.ts +197 -0
  682. package/src/shex/ShExC.ts +415 -0
  683. package/src/shex/ShExError.ts +71 -0
  684. package/src/shex/ShExJ.ts +893 -0
  685. package/src/shex/ShExR.ts +640 -0
  686. package/src/shex/ShapeMap.ts +385 -0
  687. package/src/shex/Structure.ts +467 -0
  688. package/src/shex/Validator.ts +395 -0
  689. package/src/shex/index.ts +24 -0
  690. package/src/shex/internal/engine.ts +682 -0
  691. package/src/shex/internal/iterate.ts +14 -0
  692. package/src/shex/internal/json.ts +12 -0
  693. package/src/shex/internal/lexer.ts +56 -0
  694. package/src/shex/internal/nodeConstraint.ts +368 -0
  695. package/src/shex/internal/shexcLexer.ts +387 -0
  696. package/src/shex/internal/shexcParser.ts +1312 -0
  697. package/src/shex/internal/tokens.ts +41 -0
  698. package/src/shex/internal/xpathRegex.ts +290 -0
  699. package/src/sparql/Algebra.ts +914 -0
  700. package/src/sparql/Ast.ts +1344 -0
  701. package/src/sparql/Bindings.ts +272 -0
  702. package/src/sparql/ClientErrors.ts +156 -0
  703. package/src/sparql/ClientFormats.ts +70 -0
  704. package/src/sparql/Engine.ts +699 -0
  705. package/src/sparql/Errors.ts +30 -0
  706. package/src/sparql/Expression.ts +360 -0
  707. package/src/sparql/Federation.ts +187 -0
  708. package/src/sparql/Functions.ts +689 -0
  709. package/src/sparql/Generator.ts +426 -0
  710. package/src/sparql/GraphStore.ts +341 -0
  711. package/src/sparql/Optimizer.ts +230 -0
  712. package/src/sparql/Options.ts +191 -0
  713. package/src/sparql/Parser.ts +173 -0
  714. package/src/sparql/Protocol.ts +342 -0
  715. package/src/sparql/ProtocolErrors.ts +113 -0
  716. package/src/sparql/QueryBuilder.ts +953 -0
  717. package/src/sparql/Results.ts +844 -0
  718. package/src/sparql/ResultsStream.ts +771 -0
  719. package/src/sparql/ServerFormats.ts +75 -0
  720. package/src/sparql/ServiceDescription.ts +130 -0
  721. package/src/sparql/SparqlClient.ts +947 -0
  722. package/src/sparql/SparqlServer.ts +528 -0
  723. package/src/sparql/Store.ts +311 -0
  724. package/src/sparql/TermSchema.ts +20 -0
  725. package/src/sparql/Testing.ts +114 -0
  726. package/src/sparql/Translate.ts +407 -0
  727. package/src/sparql/ai/Mcp.ts +43 -0
  728. package/src/sparql/ai/Tools.ts +481 -0
  729. package/src/sparql/ai/index.ts +11 -0
  730. package/src/sparql/index.ts +64 -0
  731. package/src/sparql/internal/evaluator.ts +947 -0
  732. package/src/sparql/internal/hash.ts +418 -0
  733. package/src/sparql/internal/json.ts +12 -0
  734. package/src/sparql/internal/lexer.ts +488 -0
  735. package/src/sparql/internal/loop.ts +24 -0
  736. package/src/sparql/internal/parser.ts +2215 -0
  737. package/src/sparql/internal/prefetch.ts +46 -0
  738. package/src/sparql/internal/stringMap.ts +39 -0
  739. package/src/sparql/internal/textResults.ts +226 -0
  740. package/src/sparql/internal/values.ts +550 -0
  741. package/src/sparql/shacl/Evaluator.ts +478 -0
  742. package/src/sparql/shacl/Query.ts +574 -0
  743. package/src/sparql/shacl/index.ts +12 -0
  744. package/src/sparql/sql/Dialect.ts +246 -0
  745. package/src/sparql/sql/SqlStore.ts +1080 -0
  746. package/src/sparql/sql/Translation.ts +1898 -0
  747. package/src/sparql/sql/index.ts +17 -0
  748. package/src/sparql/sql/internal/encoding.ts +313 -0
  749. package/src/turtle/Grammar.ts +286 -0
  750. package/src/turtle/Manifest.ts +215 -0
  751. package/src/turtle/TriG.ts +158 -0
  752. package/src/turtle/Turtle.ts +166 -0
  753. package/src/turtle/index.ts +14 -0
  754. package/src/turtle/internal/loop.ts +23 -0
  755. package/src/turtle/internal/parse.ts +112 -0
  756. package/src/turtle/internal/parser.ts +1303 -0
  757. package/src/turtle/internal/serialize.ts +79 -0
  758. package/src/turtle/internal/streamWriter.ts +128 -0
  759. package/src/turtle/internal/writer.ts +898 -0
  760. package/src/xmp/DublinCore.ts +147 -0
  761. package/src/xmp/Exif.ts +109 -0
  762. package/src/xmp/Extract.ts +351 -0
  763. package/src/xmp/Metadata.ts +703 -0
  764. package/src/xmp/Namespaces.ts +228 -0
  765. package/src/xmp/Packet.ts +297 -0
  766. package/src/xmp/Pdf.ts +99 -0
  767. package/src/xmp/PdfA.ts +280 -0
  768. package/src/xmp/Photoshop.ts +275 -0
  769. package/src/xmp/Tiff.ts +196 -0
  770. package/src/xmp/Xmp.ts +430 -0
  771. package/src/xmp/XmpBasic.ts +90 -0
  772. package/src/xmp/XmpMM.ts +82 -0
  773. package/src/xmp/XmpRights.ts +83 -0
  774. package/src/xmp/index.ts +36 -0
  775. package/src/xmp/internal/accessors.ts +72 -0
  776. package/src/xmp/internal/xml.ts +63 -0
@@ -0,0 +1,847 @@
1
+ /**
2
+ * The JSON-LD 1.1 processor: expansion, compaction, flattening, framing and
3
+ * conversion to and from RDF, plus a `Serialization.Codec` for the
4
+ * `application/ld+json` media type.
5
+ *
6
+ * Remote documents and contexts are loaded through the `DocumentLoader`
7
+ * service when it is provided (or through `options.documentLoader`); without
8
+ * one, any remote reference fails with `loading remote context failed` /
9
+ * `loading document failed`.
10
+ *
11
+ * @since 0.1.0
12
+ */
13
+ import * as Dataset from '../Dataset.ts';
14
+ import * as PrefixMap from '../PrefixMap.ts';
15
+ import * as Serialization from '../Serialization.ts';
16
+ import * as Term from '../Term.ts';
17
+ import * as Arr from 'effect/Array';
18
+ import * as Effect from 'effect/Effect';
19
+ import * as MutableHashMap from 'effect/MutableHashMap';
20
+ import * as Option from 'effect/Option';
21
+ import * as Record from 'effect/Record';
22
+ import * as Result from 'effect/Result';
23
+ import * as Schema from 'effect/Schema';
24
+ import * as DocumentLoader from './DocumentLoader.ts';
25
+ import * as JsonLdError from './JsonLdError.ts';
26
+ import { compactElement, compactIri } from './internal/compact.ts';
27
+ import {
28
+ type ActiveContext,
29
+ type Env,
30
+ type LoadedDocument,
31
+ NeedDocument,
32
+ type ProcessingMode,
33
+ expandIri,
34
+ initialContext,
35
+ processContext,
36
+ } from './internal/context.ts';
37
+ import { expandElement } from './internal/expand.ts';
38
+ import { flattenExpanded } from './internal/flatten.ts';
39
+ import { cleanupNull, frame as frameAlgorithm } from './internal/frame.ts';
40
+ import * as Rdf from './internal/rdf.ts';
41
+ import {
42
+ type Json,
43
+ type JsonObject,
44
+ fail,
45
+ isEmptyObject,
46
+ isObject,
47
+ isString,
48
+ loop,
49
+ } from './internal/util.ts';
50
+ import { parseJson } from './internal/json.ts';
51
+ import * as Predicate from 'effect/Predicate';
52
+
53
+ /** An empty context (`{}` or `[]`), which compaction leaves out of the output. */
54
+ const isEmptyContext = (context: Json): boolean =>
55
+ isEmptyObject(context) || (Array.isArray(context) && Arr.isReadonlyArrayEmpty(context));
56
+
57
+ /**
58
+ * Any JSON value.
59
+ *
60
+ * @since 0.1.0
61
+ * @category models
62
+ */
63
+ export type JsonValue = null | boolean | number | string | JsonArray | JsonObjectValue;
64
+
65
+ /**
66
+ * @since 0.1.0
67
+ * @category models
68
+ */
69
+ export interface JsonArray extends ReadonlyArray<JsonValue> {}
70
+
71
+ /**
72
+ * @since 0.1.0
73
+ * @category models
74
+ */
75
+ export interface JsonObjectValue {
76
+ readonly [key: string]: JsonValue;
77
+ }
78
+
79
+ /**
80
+ * The input of the JSON-LD algorithms: a JSON document (object or array), the
81
+ * URL of a document to load, or an already loaded `RemoteDocument`.
82
+ *
83
+ * @since 0.1.0
84
+ * @category models
85
+ */
86
+ export type Input = JsonValue | DocumentLoader.RemoteDocument | object;
87
+
88
+ /**
89
+ * Options shared by all JSON-LD algorithms (the `JsonLdOptions` of the
90
+ * JSON-LD API).
91
+ *
92
+ * @since 0.1.0
93
+ * @category options
94
+ */
95
+ export interface Options {
96
+ /** The base IRI. Defaults to the URL of the input document, if any. */
97
+ readonly base?: string | null | undefined;
98
+ /** `json-ld-1.1` (default) or `json-ld-1.0`. */
99
+ readonly processingMode?: ProcessingMode | undefined;
100
+ /** A context to apply before expanding the input. */
101
+ readonly expandContext?: unknown;
102
+ /** Process map entries in lexicographical order. Defaults to `false`. */
103
+ readonly ordered?: boolean | undefined;
104
+ /** Replace single-element arrays by their element. Defaults to `true`. */
105
+ readonly compactArrays?: boolean | undefined;
106
+ /** Make IRIs relative to the base IRI when compacting. Defaults to `true`. */
107
+ readonly compactToRelative?: boolean | undefined;
108
+ /** Extract all JSON-LD script elements from HTML input. */
109
+ readonly extractAllScripts?: boolean | undefined;
110
+ /**
111
+ * A document loader to use instead of the `DocumentLoader` service from
112
+ * the environment.
113
+ */
114
+ readonly documentLoader?: DocumentLoader.Loader | undefined;
115
+ }
116
+
117
+ /**
118
+ * Options for `toRdf`.
119
+ *
120
+ * @since 0.1.0
121
+ * @category options
122
+ */
123
+ export interface ToRdfOptions extends Options {
124
+ /**
125
+ * How to represent `@direction`: as `i18n-datatype` literals, as
126
+ * `compound-literal` blank nodes, or not at all (default).
127
+ */
128
+ readonly rdfDirection?: 'i18n-datatype' | 'compound-literal' | null | undefined;
129
+ /**
130
+ * Generalized RDF (blank node predicates) cannot be represented by the
131
+ * core term model; such triples are always dropped.
132
+ */
133
+ readonly produceGeneralizedRdf?: boolean | undefined;
134
+ }
135
+
136
+ /**
137
+ * Options for `fromRdf`.
138
+ *
139
+ * @since 0.1.0
140
+ * @category options
141
+ */
142
+ export interface FromRdfOptions {
143
+ readonly processingMode?: ProcessingMode | undefined;
144
+ readonly ordered?: boolean | undefined;
145
+ /** Convert `xsd:boolean`, `xsd:integer` and `xsd:double` to native JSON values. */
146
+ readonly useNativeTypes?: boolean | undefined;
147
+ /** Keep `rdf:type` as a regular property instead of `@type`. */
148
+ readonly useRdfType?: boolean | undefined;
149
+ readonly rdfDirection?: 'i18n-datatype' | 'compound-literal' | null | undefined;
150
+ }
151
+
152
+ /**
153
+ * Options for `frame`.
154
+ *
155
+ * @since 0.1.0
156
+ * @category options
157
+ */
158
+ export interface FrameOptions extends Options {
159
+ /** The default `@embed` flag: `@once` (default), `@always`, `@never` or `@link`. */
160
+ readonly embed?: '@once' | '@always' | '@never' | '@link' | undefined;
161
+ /** The default `@explicit` flag. */
162
+ readonly explicit?: boolean | undefined;
163
+ /** The default `@omitDefault` flag. */
164
+ readonly omitDefault?: boolean | undefined;
165
+ /** The default `@requireAll` flag. */
166
+ readonly requireAll?: boolean | undefined;
167
+ /** Omit `@graph` when the result is a single node. Defaults to `false` in 1.1. */
168
+ readonly omitGraph?: boolean | undefined;
169
+ }
170
+
171
+ // -----------------------------------------------------------------------------
172
+ // Driver
173
+ // -----------------------------------------------------------------------------
174
+
175
+ type DocResult = Result.Result<LoadedDocument, JsonLdError.JsonLdError>;
176
+
177
+ const getLoader = (options?: Options) =>
178
+ options?.documentLoader !== undefined
179
+ ? Effect.succeed(options.documentLoader)
180
+ : Effect.map(Effect.serviceOption(DocumentLoader.DocumentLoader), (o) =>
181
+ Option.getOrElse(o, () => DocumentLoader.none),
182
+ );
183
+
184
+ /**
185
+ * The environment of one algorithm run: documents come from `docs`, and a
186
+ * document not loaded yet aborts the run with `NeedDocument`.
187
+ */
188
+ const makeEnv = (
189
+ docs: MutableHashMap.MutableHashMap<string, DocResult>,
190
+ options?: Options,
191
+ ): Env => ({
192
+ processingMode: options?.processingMode ?? 'json-ld-1.1',
193
+ contextCache: MutableHashMap.empty(),
194
+ load: (url) => {
195
+ const hit = MutableHashMap.get(docs, url);
196
+ if (Option.isNone(hit)) throw new NeedDocument(url);
197
+ if (Result.isFailure(hit.value)) throw hit.value.failure;
198
+ return hit.value.success;
199
+ },
200
+ });
201
+
202
+ /**
203
+ * Runs the algorithm once. A `NeedDocument` or `JsonLdError` it throws is the
204
+ * failure; anything else is a bug and propagates (a defect in `run`).
205
+ */
206
+ const attempt = <A>(
207
+ f: (env: Env) => A,
208
+ env: Env,
209
+ ): Result.Result<A, NeedDocument | JsonLdError.JsonLdError> =>
210
+ Result.try({
211
+ try: () => f(env),
212
+ catch: (e) => {
213
+ if (e instanceof NeedDocument || JsonLdError.isJsonLdError(e)) return e;
214
+ throw e;
215
+ },
216
+ });
217
+
218
+ /**
219
+ * Runs a pure algorithm, loading documents on demand: when the algorithm
220
+ * needs a document that has not been loaded yet it aborts with
221
+ * `NeedDocument`, the document is loaded, and the algorithm is restarted.
222
+ */
223
+ const run = <A>(f: (env: Env) => A, options?: Options): Effect.Effect<A, JsonLdError.JsonLdError> =>
224
+ Effect.gen(function* () {
225
+ const loader = yield* getLoader(options);
226
+ const docs = MutableHashMap.empty<string, DocResult>();
227
+ const env = makeEnv(docs, options);
228
+ // Re-run `f` until it no longer stops on a document it has not seen: each
229
+ // stop loads that one document into `docs`, which `f` reads on the next run.
230
+ const go: Effect.Effect<A, JsonLdError.JsonLdError> = Effect.suspend(() => {
231
+ const step = attempt(f, env);
232
+ if (Result.isSuccess(step)) return Effect.succeed(step.success);
233
+ const failure = step.failure;
234
+ if (!(failure instanceof NeedDocument)) return Effect.fail(failure);
235
+ return Effect.flatMap(
236
+ Effect.result(
237
+ loader.load(failure.url, { profile: 'http://www.w3.org/ns/json-ld#context' }),
238
+ ),
239
+ (r) => {
240
+ MutableHashMap.set(docs, failure.url, r);
241
+ return go;
242
+ },
243
+ );
244
+ });
245
+ return yield* go;
246
+ });
247
+
248
+ interface ResolvedInput {
249
+ readonly document: Json;
250
+ /** The URL of the document, which is the base IRI (`null`: none) unless one is given. */
251
+ readonly documentUrl: string | null;
252
+ /** A context referenced by an HTTP `Link` header. */
253
+ readonly contextUrl: Option.Option<string>;
254
+ }
255
+
256
+ const isRemoteDocument = (u: unknown): u is DocumentLoader.RemoteDocument =>
257
+ isObject(u) && Predicate.isString(u['documentUrl']) && 'document' in u;
258
+
259
+ /** Resolves an input (an `Input`, or a frame, which is any JSON-LD input). */
260
+ const resolveInput = (
261
+ input: unknown,
262
+ options?: Options,
263
+ ): Effect.Effect<ResolvedInput, JsonLdError.JsonLdError> =>
264
+ Effect.gen(function* () {
265
+ if (isString(input)) {
266
+ const loader = yield* getLoader(options);
267
+ const doc = yield* loader
268
+ .load(input, { extractAllScripts: options?.extractAllScripts })
269
+ .pipe(
270
+ Effect.mapError((e) =>
271
+ e.code === 'loading document failed' || e.code === 'multiple context link headers'
272
+ ? e
273
+ : JsonLdError.make('loading document failed', e.message),
274
+ ),
275
+ );
276
+ return {
277
+ document: doc.document,
278
+ documentUrl: doc.documentUrl,
279
+ contextUrl: Option.fromUndefinedOr(doc.contextUrl),
280
+ };
281
+ }
282
+ if (isRemoteDocument(input)) {
283
+ return {
284
+ document: input.document,
285
+ documentUrl: input.documentUrl,
286
+ contextUrl: Option.fromUndefinedOr(input.contextUrl),
287
+ };
288
+ }
289
+ return { document: input, documentUrl: null, contextUrl: Option.none() };
290
+ });
291
+
292
+ const expandSync = (
293
+ env: Env,
294
+ input: ResolvedInput,
295
+ frameExpansion: boolean,
296
+ options?: Options,
297
+ ): Array<JsonObject> => {
298
+ const base = options?.base !== undefined ? options.base : input.documentUrl;
299
+ let active: ActiveContext = initialContext(base);
300
+ if (options?.expandContext !== undefined && options.expandContext !== null) {
301
+ // `expandContext` is a JSON value supplied by the caller.
302
+ let ctx: Json = options.expandContext;
303
+ if (isObject(ctx) && '@context' in ctx) ctx = ctx['@context'];
304
+ active = processContext(env, active, ctx, active.originalBase);
305
+ }
306
+ if (Option.isSome(input.contextUrl)) {
307
+ const contextUrl = input.contextUrl.value;
308
+ active = processContext(env, active, contextUrl, contextUrl);
309
+ }
310
+ let expanded = expandElement(
311
+ env,
312
+ active,
313
+ Option.none(),
314
+ input.document,
315
+ input.documentUrl ?? base,
316
+ {
317
+ frameExpansion,
318
+ ordered: options?.ordered ?? false,
319
+ },
320
+ );
321
+ if (isObject(expanded) && Record.keys(expanded).length === 1 && '@graph' in expanded) {
322
+ expanded = expanded['@graph'];
323
+ }
324
+ if (expanded === null || expanded === undefined) expanded = [];
325
+ if (!Array.isArray(expanded)) expanded = [expanded];
326
+ return expanded;
327
+ };
328
+
329
+ const compactSync = (
330
+ env: Env,
331
+ expanded: Json,
332
+ context: Json,
333
+ documentUrl: string | null,
334
+ options?: Options,
335
+ ): JsonObject => {
336
+ if (isObject(context) && '@context' in context) context = context['@context'];
337
+ const compactToRelative = options?.compactToRelative ?? true;
338
+ const base =
339
+ options?.base !== undefined && options.base !== null
340
+ ? options.base
341
+ : compactToRelative
342
+ ? documentUrl
343
+ : null;
344
+ const contextBase = isString(context) ? context : (options?.base ?? documentUrl ?? null);
345
+ let active = initialContext(base);
346
+ active = processContext(env, active, context ?? null, contextBase);
347
+ const compactOptions = {
348
+ compactArrays: options?.compactArrays ?? true,
349
+ ordered: options?.ordered ?? false,
350
+ compactToRelative,
351
+ };
352
+ let compacted = compactElement(env, active, Option.none(), expanded, compactOptions);
353
+ if (Array.isArray(compacted)) {
354
+ compacted = Arr.isReadonlyArrayEmpty(compacted)
355
+ ? {}
356
+ : { [compactIri(env, active, '@graph', null, true, false, compactOptions)]: compacted };
357
+ }
358
+ if (compacted === null || compacted === undefined) compacted = {};
359
+ if (context !== null && context !== undefined && !isEmptyContext(context)) {
360
+ compacted = { '@context': context, ...compacted };
361
+ }
362
+ return compacted;
363
+ };
364
+
365
+ // -----------------------------------------------------------------------------
366
+ // API
367
+ // -----------------------------------------------------------------------------
368
+
369
+ /**
370
+ * Expands a JSON-LD document (JSON-LD 1.1 API, Expansion Algorithm).
371
+ *
372
+ * @since 0.1.0
373
+ * @category algorithms
374
+ */
375
+ export const expand = (
376
+ input: Input,
377
+ options?: Options,
378
+ ): Effect.Effect<Array<JsonObjectValue>, JsonLdError.JsonLdError> =>
379
+ Effect.flatMap(resolveInput(input, options), (resolved) =>
380
+ run((env) => expandSync(env, resolved, false, options), options),
381
+ );
382
+
383
+ /**
384
+ * Compacts a JSON-LD document against a context (JSON-LD 1.1 API,
385
+ * Compaction Algorithm). The context may be a context definition, an array
386
+ * of contexts, an IRI, or a document with an `@context` entry.
387
+ *
388
+ * @since 0.1.0
389
+ * @category algorithms
390
+ */
391
+ export const compact = (
392
+ input: Input,
393
+ context: unknown,
394
+ options?: Options,
395
+ ): Effect.Effect<JsonObjectValue, JsonLdError.JsonLdError> =>
396
+ Effect.flatMap(resolveInput(input, options), (resolved) =>
397
+ run((env) => {
398
+ const expanded = expandSync(env, resolved, false, { ...options, ordered: false });
399
+ return compactSync(env, expanded, context, resolved.documentUrl, options);
400
+ }, options),
401
+ );
402
+
403
+ /**
404
+ * Flattens a JSON-LD document (JSON-LD 1.1 API, Flattening Algorithm),
405
+ * optionally compacting the result.
406
+ *
407
+ * @since 0.1.0
408
+ * @category algorithms
409
+ */
410
+ export const flatten = (
411
+ input: Input,
412
+ context?: unknown,
413
+ options?: Options,
414
+ ): Effect.Effect<JsonValue, JsonLdError.JsonLdError> =>
415
+ Effect.flatMap(resolveInput(input, options), (resolved) =>
416
+ run((env) => {
417
+ const expanded = expandSync(env, resolved, false, options);
418
+ const flattened = flattenExpanded(expanded, options?.ordered ?? false);
419
+ if (context === undefined || context === null) return flattened;
420
+ const compacted = compactSync(env, flattened, context, resolved.documentUrl, options);
421
+ return compacted;
422
+ }, options),
423
+ );
424
+
425
+ /**
426
+ * Frames a JSON-LD document (JSON-LD 1.1 Framing).
427
+ *
428
+ * @since 0.1.0
429
+ * @category algorithms
430
+ */
431
+ export const frame = (
432
+ input: Input,
433
+ frameInput: unknown,
434
+ options?: FrameOptions,
435
+ ): Effect.Effect<JsonObjectValue, JsonLdError.JsonLdError> =>
436
+ Effect.gen(function* () {
437
+ const resolved = yield* resolveInput(input, options);
438
+ // A frame is a JSON-LD input (document, URL or object), as `resolveInput` takes.
439
+ const resolvedFrame = yield* resolveInput(frameInput, options);
440
+ return yield* run((env) => frameSync(env, resolved, resolvedFrame, options), options);
441
+ });
442
+
443
+ /** The `@context` entry of a document (`null` when it has none). */
444
+ const contextOf = (document: JsonObject): Json => document['@context'] ?? null;
445
+
446
+ const frameSync = (
447
+ env: Env,
448
+ resolved: ResolvedInput,
449
+ resolvedFrame: ResolvedInput,
450
+ options?: FrameOptions,
451
+ ): JsonObject => {
452
+ const frameDocument: Json = resolvedFrame.document;
453
+ if (!isObject(frameDocument) && !Array.isArray(frameDocument)) {
454
+ return fail('invalid frame', 'a frame must be a JSON object');
455
+ }
456
+ const context: Json = isObject(frameDocument) ? contextOf(frameDocument) : null;
457
+ const base = options?.base !== undefined ? options.base : resolved.documentUrl;
458
+ const frameBase = resolvedFrame.documentUrl ?? base;
459
+ const frameContext = processContext(env, initialContext(frameBase), context, frameBase);
460
+ const merged = !(
461
+ isObject(frameDocument) &&
462
+ Record.keys(frameDocument).some((k) => expandIri(env, frameContext, k, true) === '@graph')
463
+ );
464
+ const expanded = expandSync(env, resolved, false, { ...options, ordered: false });
465
+ const expandedFrame = expandSync(env, resolvedFrame, true, { ...options, ordered: false });
466
+ const is11 = env.processingMode !== 'json-ld-1.0';
467
+ const framed = frameAlgorithm(expanded, expandedFrame, {
468
+ embed: options?.embed ?? '@once',
469
+ explicit: options?.explicit ?? false,
470
+ omitDefault: options?.omitDefault ?? false,
471
+ requireAll: options?.requireAll ?? false,
472
+ ordered: options?.ordered ?? false,
473
+ merged,
474
+ is11,
475
+ });
476
+ const compactToRelative = options?.compactToRelative ?? true;
477
+ let active = initialContext(
478
+ options?.base != null ? options.base : compactToRelative ? resolved.documentUrl : null,
479
+ );
480
+ active = processContext(env, active, context, frameBase);
481
+ const compactOptions = {
482
+ compactArrays: options?.compactArrays ?? true,
483
+ ordered: options?.ordered ?? false,
484
+ compactToRelative,
485
+ };
486
+ const omitGraph = options?.omitGraph ?? is11;
487
+ let compacted = compactElement(env, active, Option.none(), framed, compactOptions);
488
+ if (omitGraph && Array.isArray(compacted)) {
489
+ if (compacted.length === 1 && compactOptions.compactArrays) compacted = compacted[0];
490
+ } else if (!omitGraph && isObject(compacted)) {
491
+ compacted = [compacted];
492
+ }
493
+ if (Array.isArray(compacted)) {
494
+ const graphKey = compactIri(env, active, '@graph', null, true, false, compactOptions);
495
+ compacted = { [graphKey]: compacted };
496
+ }
497
+ if (compacted === null || compacted === undefined) compacted = {};
498
+ if (context !== null && !isEmptyContext(context)) {
499
+ compacted = { '@context': context, ...compacted };
500
+ }
501
+ return cleanupNull(compacted);
502
+ };
503
+
504
+ /**
505
+ * Converts a JSON-LD document to an RDF dataset (Deserialize JSON-LD to RDF
506
+ * Algorithm).
507
+ *
508
+ * @since 0.1.0
509
+ * @category algorithms
510
+ */
511
+ export const toRdf = (
512
+ input: Input,
513
+ options?: ToRdfOptions,
514
+ ): Effect.Effect<Dataset.Dataset, JsonLdError.JsonLdError> =>
515
+ Effect.map(toQuads(input, options), Dataset.fromIterable);
516
+
517
+ /**
518
+ * Like `toRdf`, but returns the quads in document order.
519
+ *
520
+ * @since 0.1.0
521
+ * @category algorithms
522
+ */
523
+ export const toQuads = (
524
+ input: Input,
525
+ options?: ToRdfOptions,
526
+ ): Effect.Effect<ReadonlyArray<Term.Quad>, JsonLdError.JsonLdError> => quadsOf(input, options);
527
+
528
+ /** `toQuads` over any parsed JSON document. */
529
+ const quadsOf = (
530
+ input: unknown,
531
+ options?: ToRdfOptions,
532
+ ): Effect.Effect<ReadonlyArray<Term.Quad>, JsonLdError.JsonLdError> =>
533
+ Effect.flatMap(resolveInput(input, options), (resolved) =>
534
+ run((env) => {
535
+ const expanded = expandSync(env, resolved, false, options);
536
+ return Rdf.toRdf(expanded, {
537
+ produceGeneralizedRdf: options?.produceGeneralizedRdf ?? false,
538
+ rdfDirection: Option.fromNullishOr(options?.rdfDirection),
539
+ });
540
+ }, options),
541
+ );
542
+
543
+ /**
544
+ * Converts RDF quads to expanded JSON-LD (Serialize RDF as JSON-LD
545
+ * Algorithm).
546
+ *
547
+ * @since 0.1.0
548
+ * @category algorithms
549
+ */
550
+ export const fromRdf = (
551
+ quads: Iterable<Term.Quad>,
552
+ options?: FromRdfOptions,
553
+ ): Effect.Effect<Array<JsonObjectValue>, JsonLdError.JsonLdError> =>
554
+ Effect.try({
555
+ try: () =>
556
+ Rdf.fromRdf(quads, {
557
+ rdfDirection: Option.fromNullishOr(options?.rdfDirection),
558
+ useNativeTypes: options?.useNativeTypes ?? false,
559
+ useRdfType: options?.useRdfType ?? false,
560
+ ordered: options?.ordered ?? false,
561
+ processingMode: options?.processingMode ?? 'json-ld-1.1',
562
+ }),
563
+ catch: (e) =>
564
+ JsonLdError.isJsonLdError(e) ? e : JsonLdError.make('invalid JSON literal', String(e)),
565
+ });
566
+
567
+ // -----------------------------------------------------------------------------
568
+ // Codec
569
+ // -----------------------------------------------------------------------------
570
+
571
+ /**
572
+ * The JSON-LD format.
573
+ *
574
+ * @since 0.1.0
575
+ * @category formats
576
+ */
577
+ export const format: Serialization.Format = Serialization.makeFormat({
578
+ name: 'JSON-LD',
579
+ mediaType: 'application/ld+json',
580
+ extensions: ['jsonld'],
581
+ datasets: true,
582
+ });
583
+
584
+ // Spans are named `JsonLd.parse`, `JsonLd.serialize`.
585
+ const trace: Serialization.SpanTarget = { module: 'JsonLd', format };
586
+
587
+ /**
588
+ * Options for parsing JSON-LD documents to RDF.
589
+ *
590
+ * @since 0.1.0
591
+ * @category options
592
+ */
593
+ export interface ParseOptions extends Serialization.ParseOptions, ToRdfOptions {}
594
+
595
+ /**
596
+ * Options for serialising RDF as JSON-LD.
597
+ *
598
+ * @since 0.1.0
599
+ * @category options
600
+ */
601
+ export interface SerializeOptions extends Serialization.SerializeOptions, FromRdfOptions {
602
+ /** A context to compact the output with. */
603
+ readonly context?: unknown;
604
+ /** Replace single-element arrays by their element. Defaults to `true`. */
605
+ readonly compactArrays?: boolean | undefined;
606
+ /** JSON indentation. Defaults to 2; use 0 for compact output. */
607
+ readonly indent?: number | undefined;
608
+ readonly documentLoader?: DocumentLoader.Loader | undefined;
609
+ }
610
+
611
+ // A sticky scanner for `jsonErrorOffset`: JSON whitespace.
612
+ const JSON_WS = /[ \t\n\r]*/y;
613
+
614
+ /** Finds the offset of the first JSON syntax error in `input`. */
615
+ const jsonErrorOffset = (input: string): number => {
616
+ let i = 0;
617
+ const scan = (re: RegExp) => {
618
+ re.lastIndex = i;
619
+ re.exec(input);
620
+ i = re.lastIndex;
621
+ };
622
+ const ws = () => scan(JSON_WS);
623
+ const stop = (): never => {
624
+ throw i;
625
+ };
626
+ const literal = (word: string) => {
627
+ if (input.startsWith(word, i)) i += word.length;
628
+ else stop();
629
+ };
630
+ const string = () => {
631
+ i++;
632
+ // One character (or escape) per step, up to the closing quote.
633
+ loop(true, () => {
634
+ if (i >= input.length || input[i] === '"') return Option.none();
635
+ if (input[i] === '\\') i++;
636
+ else if (input.charCodeAt(i) < 0x20) stop();
637
+ i++;
638
+ return Option.some(true);
639
+ });
640
+ if (i >= input.length) stop();
641
+ i++;
642
+ };
643
+ const value = (): void => {
644
+ ws();
645
+ const c = input[i];
646
+ if (c === '{' || c === '[') {
647
+ const close = c === '{' ? '}' : ']';
648
+ i++;
649
+ ws();
650
+ if (input[i] === close) {
651
+ i++;
652
+ return;
653
+ }
654
+ // One member per step, until the closing bracket.
655
+ loop(true, () => {
656
+ if (c === '{') {
657
+ ws();
658
+ if (input[i] !== '"') stop();
659
+ string();
660
+ ws();
661
+ if (input[i] !== ':') stop();
662
+ i++;
663
+ }
664
+ value();
665
+ ws();
666
+ if (input[i] === ',') {
667
+ i++;
668
+ return Option.some(true);
669
+ }
670
+ if (input[i] !== close) stop();
671
+ i++;
672
+ return Option.none();
673
+ });
674
+ } else if (c === '"') string();
675
+ else if (c === 't') literal('true');
676
+ else if (c === 'f') literal('false');
677
+ else if (c === 'n') literal('null');
678
+ else {
679
+ const m = /^-?(0|[1-9][0-9]*)(\.[0-9]+)?([eE][+-]?[0-9]+)?/.exec(input.slice(i));
680
+ if (m === null || m[0] === '') return stop();
681
+ i += m[0].length;
682
+ }
683
+ };
684
+ // `stop` throws at the offending offset, which is `i`.
685
+ return Result.merge(
686
+ Result.try({
687
+ try: () => {
688
+ value();
689
+ ws();
690
+ return i;
691
+ },
692
+ catch: () => i,
693
+ }),
694
+ );
695
+ };
696
+
697
+ const positionOf = (input: string) => {
698
+ const pos = jsonErrorOffset(input);
699
+ const before = input.slice(0, pos);
700
+ return { line: before.split('\n').length, column: pos - before.lastIndexOf('\n') };
701
+ };
702
+
703
+ /**
704
+ * Parses a JSON-LD document into RDF.
705
+ *
706
+ * @since 0.1.0
707
+ * @category parsing
708
+ */
709
+ export const parse = (
710
+ input: string,
711
+ options?: ParseOptions,
712
+ ): Effect.Effect<Serialization.ParseResult, Serialization.RdfParseError> =>
713
+ Effect.gen(function* () {
714
+ const json = yield* Effect.fromResult(parseJson(input)).pipe(
715
+ Effect.mapError(
716
+ (e) =>
717
+ new Serialization.RdfParseError({
718
+ format: format.name,
719
+ message: `invalid JSON: ${String(e)}`,
720
+ ...positionOf(input),
721
+ }),
722
+ ),
723
+ );
724
+ const base = options?.base !== undefined ? options.base : (options?.baseIri ?? null);
725
+ const quads = yield* quadsOf(json, { ...options, base }).pipe(
726
+ Effect.mapError(
727
+ (e) => new Serialization.RdfParseError({ format: format.name, message: e.message }),
728
+ ),
729
+ );
730
+ const prefix = options?.blankNodePrefix ?? Serialization.freshBlankNodePrefix();
731
+ const graph = options?.graph;
732
+ const relabel = (t: Term.Term): Term.Term =>
733
+ Term.isBlankNode(t) ? Term.blankNode(`${prefix}${t.value}`) : t;
734
+ const dataset = Dataset.fromIterable(
735
+ quads.map((q) => {
736
+ const relabelled = Term.mapTerms(q, relabel);
737
+ return graph !== undefined && Term.isDefaultGraph(relabelled.graph)
738
+ ? Term.quad(relabelled.subject, relabelled.predicate, relabelled.object, graph)
739
+ : relabelled;
740
+ }),
741
+ );
742
+ return {
743
+ dataset,
744
+ prefixes: prefixesOf(json),
745
+ baseIri: base ?? undefined,
746
+ };
747
+ }).pipe(Serialization.withParseSpan(trace, input));
748
+
749
+ const prefixesOf = (json: Json): PrefixMap.PrefixMap => {
750
+ const entries: Array<[string, string]> = [];
751
+ const visit = (ctx: Json): void => {
752
+ if (Array.isArray(ctx)) ctx.forEach(visit);
753
+ else if (isObject(ctx)) {
754
+ Record.keys(ctx).forEach((k) => {
755
+ if (k.startsWith('@') || k.includes(':')) return;
756
+ const v = ctx[k];
757
+ const iri = isString(v) ? v : isObject(v) && isString(v['@id']) ? v['@id'] : undefined;
758
+ if (iri !== undefined && /[/#:]$/.test(iri) && /^[a-z][a-z0-9+.-]*:/i.test(iri)) {
759
+ entries.push([k, iri]);
760
+ }
761
+ });
762
+ }
763
+ };
764
+ if (isObject(json)) visit(json['@context']);
765
+ return PrefixMap.make(entries);
766
+ };
767
+
768
+ /**
769
+ * Serialises quads as a JSON-LD document. Without a context (and without
770
+ * prefixes) the output is expanded JSON-LD; otherwise it is compacted with
771
+ * the given context, extended with one term per prefix.
772
+ *
773
+ * @since 0.1.0
774
+ * @category serializing
775
+ */
776
+ export const serialize = (
777
+ quads: Iterable<Term.Quad>,
778
+ options?: SerializeOptions,
779
+ ): Effect.Effect<string, Serialization.RdfSerializeError> =>
780
+ Effect.gen(function* () {
781
+ const expanded = yield* fromRdf(quads, options);
782
+ let context: Json = options?.context ?? null;
783
+ if (isObject(context) && '@context' in context) context = context['@context'];
784
+ if (options?.prefixes !== undefined && options.prefixes.prefixes.size > 0) {
785
+ const prefixContext: JsonObject = {};
786
+ options.prefixes.prefixes.forEach((namespace, prefix) => {
787
+ prefixContext[prefix] = namespace;
788
+ });
789
+ if (options.baseIri !== undefined) prefixContext['@base'] = options.baseIri;
790
+ context =
791
+ context === null
792
+ ? prefixContext
793
+ : Array.isArray(context)
794
+ ? [prefixContext, ...context]
795
+ : [prefixContext, context];
796
+ }
797
+ const output: Json =
798
+ context === null
799
+ ? expanded
800
+ : yield* compact(expanded, context, {
801
+ base: options?.baseIri ?? null,
802
+ compactArrays: options?.compactArrays,
803
+ processingMode: options?.processingMode,
804
+ documentLoader: options?.documentLoader,
805
+ });
806
+ return yield* Schema.encodeEffect(
807
+ Schema.fromJsonString(Schema.Unknown, { space: options?.indent ?? 2 }),
808
+ )(output);
809
+ }).pipe(
810
+ Effect.mapError(
811
+ (e) => new Serialization.RdfSerializeError({ format: format.name, message: e.message }),
812
+ ),
813
+ Serialization.withSerializeSpan(trace),
814
+ );
815
+
816
+ /**
817
+ * The JSON-LD parser.
818
+ *
819
+ * @since 0.1.0
820
+ * @category parsing
821
+ */
822
+ export const parser: Serialization.Parser<ParseOptions> = Serialization.makeParser({
823
+ format,
824
+ parse,
825
+ });
826
+
827
+ /**
828
+ * The JSON-LD serializer.
829
+ *
830
+ * @since 0.1.0
831
+ * @category serializing
832
+ */
833
+ export const serializer: Serialization.Serializer<SerializeOptions> = Serialization.makeSerializer({
834
+ format,
835
+ serialize,
836
+ });
837
+
838
+ /**
839
+ * The JSON-LD codec.
840
+ *
841
+ * @since 0.1.0
842
+ * @category codecs
843
+ */
844
+ export const codec: Serialization.Codec<ParseOptions, SerializeOptions> = Serialization.makeCodec(
845
+ parser,
846
+ serializer,
847
+ );