@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.
- package/LICENSE +21 -0
- package/README.md +2250 -1
- package/dist/Algebra-CGG4oae3.mjs +433 -0
- package/dist/Algebra-CGG4oae3.mjs.map +1 -0
- package/dist/Algebra-uGsIEOUA.d.mts +446 -0
- package/dist/Ast-CPRZmBvk.mjs +552 -0
- package/dist/Ast-CPRZmBvk.mjs.map +1 -0
- package/dist/Ast-vcw2W-lf.d.mts +827 -0
- package/dist/Bindings-Ck3m7JRC.mjs +249 -0
- package/dist/Bindings-Ck3m7JRC.mjs.map +1 -0
- package/dist/Bindings-DiKpBd7f.d.mts +153 -0
- package/dist/ClientErrors-CpXdFX5u.mjs +128 -0
- package/dist/ClientErrors-CpXdFX5u.mjs.map +1 -0
- package/dist/ClientErrors-D4IZHUM-.d.mts +101 -0
- package/dist/ClientFormats-CXomkXLV.mjs +73 -0
- package/dist/ClientFormats-CXomkXLV.mjs.map +1 -0
- package/dist/ClientFormats-Dm57ZPwR.d.mts +36 -0
- package/dist/Csv2Json-DynEcwCh.mjs +194 -0
- package/dist/Csv2Json-DynEcwCh.mjs.map +1 -0
- package/dist/Csv2Json-aXNVDoXQ.d.mts +40 -0
- package/dist/Csv2Rdf-8maXP6mt.d.mts +41 -0
- package/dist/Csv2Rdf-DuSEkaKE.mjs +161 -0
- package/dist/Csv2Rdf-DuSEkaKE.mjs.map +1 -0
- package/dist/Dataset-BlmlcI7J.mjs +782 -0
- package/dist/Dataset-BlmlcI7J.mjs.map +1 -0
- package/dist/Dataset-DS3ESOcO.d.mts +426 -0
- package/dist/Dataset.d.mts +2 -0
- package/dist/Dataset.mjs +1 -0
- package/dist/Datatype-CxMpamHC.d.mts +212 -0
- package/dist/Datatype-DQvkNkiH.mjs +1001 -0
- package/dist/Datatype-DQvkNkiH.mjs.map +1 -0
- package/dist/Dialect-8ChFj5EX.d.mts +113 -0
- package/dist/Dialect-CzVH38uo.mjs +165 -0
- package/dist/Dialect-CzVH38uo.mjs.map +1 -0
- package/dist/DocumentLoader-D3lZREnB.mjs +346 -0
- package/dist/DocumentLoader-D3lZREnB.mjs.map +1 -0
- package/dist/DocumentLoader-ZUCEVrW5.d.mts +178 -0
- package/dist/DublinCore-AnwqxRx6.mjs +137 -0
- package/dist/DublinCore-AnwqxRx6.mjs.map +1 -0
- package/dist/DublinCore-Dq-tVA5d.d.mts +119 -0
- package/dist/Engine-CYPB3g4h.d.mts +144 -0
- package/dist/Engine-DF8PN7g-.mjs +872 -0
- package/dist/Engine-DF8PN7g-.mjs.map +1 -0
- package/dist/Errors-CMdV1RhU.mjs +37 -0
- package/dist/Errors-CMdV1RhU.mjs.map +1 -0
- package/dist/Errors-u2bDjUeM.d.mts +30 -0
- package/dist/Evaluator-DEsU4d1o.d.mts +50 -0
- package/dist/Evaluator-DOY2-guC.mjs +281 -0
- package/dist/Evaluator-DOY2-guC.mjs.map +1 -0
- package/dist/Exif-CpqniYQd.d.mts +78 -0
- package/dist/Exif-DjkCfEB-.mjs +89 -0
- package/dist/Exif-DjkCfEB-.mjs.map +1 -0
- package/dist/Expression-BIMMvduQ.mjs +230 -0
- package/dist/Expression-BIMMvduQ.mjs.map +1 -0
- package/dist/Expression-W8A9cyX7.d.mts +89 -0
- package/dist/Extract-Bop85jES.mjs +220 -0
- package/dist/Extract-Bop85jES.mjs.map +1 -0
- package/dist/Extract-C_pCvuTC.d.mts +88 -0
- package/dist/Federation-BcNrozc1.d.mts +52 -0
- package/dist/Federation-CHScBkaK.mjs +130 -0
- package/dist/Federation-CHScBkaK.mjs.map +1 -0
- package/dist/Functions-AvjNcId_.mjs +1346 -0
- package/dist/Functions-AvjNcId_.mjs.map +1 -0
- package/dist/Functions-OQJZP-F6.d.mts +111 -0
- package/dist/Generator-C52mmq01.d.mts +50 -0
- package/dist/Generator-D3utCJC7.mjs +205 -0
- package/dist/Generator-D3utCJC7.mjs.map +1 -0
- package/dist/Grammar-CPlSxGH6.mjs +200 -0
- package/dist/Grammar-CPlSxGH6.mjs.map +1 -0
- package/dist/Grammar-CRhnRoCu.d.mts +148 -0
- package/dist/Grammar-D6jZdJQ3.d.mts +169 -0
- package/dist/Grammar-mQ8CgE1M.mjs +258 -0
- package/dist/Grammar-mQ8CgE1M.mjs.map +1 -0
- package/dist/GraphStore-DhUa4nFO.d.mts +45 -0
- package/dist/GraphStore-DvbqwKy1.mjs +212 -0
- package/dist/GraphStore-DvbqwKy1.mjs.map +1 -0
- package/dist/Iri-BB8Ks-BF.d.mts +84 -0
- package/dist/Iri-Cr92gsQV.mjs +232 -0
- package/dist/Iri-Cr92gsQV.mjs.map +1 -0
- package/dist/Iri.d.mts +2 -0
- package/dist/Iri.mjs +1 -0
- package/dist/Isomorphism-B6qTY-xy.d.mts +28 -0
- package/dist/Isomorphism-BmqxhKyJ.mjs +232 -0
- package/dist/Isomorphism-BmqxhKyJ.mjs.map +1 -0
- package/dist/Isomorphism-DInKnWIy.mjs +390 -0
- package/dist/Isomorphism-DInKnWIy.mjs.map +1 -0
- package/dist/Isomorphism-DvSfZXLR.d.mts +37 -0
- package/dist/Isomorphism.d.mts +2 -0
- package/dist/Isomorphism.mjs +1 -0
- package/dist/JsonLd-DOwS2FHg.mjs +2836 -0
- package/dist/JsonLd-DOwS2FHg.mjs.map +1 -0
- package/dist/JsonLd-DobFrQNa.d.mts +242 -0
- package/dist/JsonLdError-C9J-BxfG.mjs +106 -0
- package/dist/JsonLdError-C9J-BxfG.mjs.map +1 -0
- package/dist/JsonLdError-DSOfHkOy.d.mts +43 -0
- package/dist/LanguageTag-BCu8rcmX.d.mts +38 -0
- package/dist/LanguageTag-BcOpMGZ4.mjs +89 -0
- package/dist/LanguageTag-BcOpMGZ4.mjs.map +1 -0
- package/dist/LanguageTag.d.mts +2 -0
- package/dist/LanguageTag.mjs +1 -0
- package/dist/Lexical-Cg0JHrf6.mjs +243 -0
- package/dist/Lexical-Cg0JHrf6.mjs.map +1 -0
- package/dist/Lexical-D3zySYVS.d.mts +163 -0
- package/dist/Manifest-B6xf6mUc.mjs +148 -0
- package/dist/Manifest-B6xf6mUc.mjs.map +1 -0
- package/dist/Manifest-DQUMRBFr.d.mts +98 -0
- package/dist/Mapping-BgG74x3U.d.mts +63 -0
- package/dist/Mapping-Dc1ZGirk.mjs +259 -0
- package/dist/Mapping-Dc1ZGirk.mjs.map +1 -0
- package/dist/Mcp-1DwTTKOK.mjs +48 -0
- package/dist/Mcp-1DwTTKOK.mjs.map +1 -0
- package/dist/Mcp-d-pX9erx.d.mts +25 -0
- package/dist/Message-CK_DGQuu.mjs +95 -0
- package/dist/Message-CK_DGQuu.mjs.map +1 -0
- package/dist/Message-fIvTJSXM.d.mts +49 -0
- package/dist/Metadata-BbffwGDZ.mjs +445 -0
- package/dist/Metadata-BbffwGDZ.mjs.map +1 -0
- package/dist/Metadata-CEt3yc1-.d.mts +901 -0
- package/dist/Metadata-D4HsQNXr.mjs +1273 -0
- package/dist/Metadata-D4HsQNXr.mjs.map +1 -0
- package/dist/Metadata-nzS7QKRj.d.mts +350 -0
- package/dist/Model-DaMmxurZ.d.mts +293 -0
- package/dist/Model-DlPzRYhF.mjs +528 -0
- package/dist/Model-DlPzRYhF.mjs.map +1 -0
- package/dist/N3-BzyV-KIH.mjs +974 -0
- package/dist/N3-BzyV-KIH.mjs.map +1 -0
- package/dist/N3-DSLnonDn.d.mts +100 -0
- package/dist/NQuads-C1VBOJ3-.mjs +117 -0
- package/dist/NQuads-C1VBOJ3-.mjs.map +1 -0
- package/dist/NQuads-FjFZikFg.d.mts +76 -0
- package/dist/NTriples-D-kLSEAf.mjs +120 -0
- package/dist/NTriples-D-kLSEAf.mjs.map +1 -0
- package/dist/NTriples-D34OspfW.d.mts +76 -0
- package/dist/Namespace-ClTUO_ya.d.mts +42 -0
- package/dist/Namespace-DHFIsORd.mjs +75 -0
- package/dist/Namespace-DHFIsORd.mjs.map +1 -0
- package/dist/Namespace.d.mts +2 -0
- package/dist/Namespace.mjs +1 -0
- package/dist/Namespaces-Bz85vpjW.mjs +235 -0
- package/dist/Namespaces-Bz85vpjW.mjs.map +1 -0
- package/dist/Namespaces-C1jW6EDo.d.mts +178 -0
- package/dist/Optimizer-BWWQRQPY.mjs +168 -0
- package/dist/Optimizer-BWWQRQPY.mjs.map +1 -0
- package/dist/Optimizer-DUpUow6k.d.mts +26 -0
- package/dist/Options-BLBGL4HE.mjs +72 -0
- package/dist/Options-BLBGL4HE.mjs.map +1 -0
- package/dist/Options-BommQwP9.d.mts +127 -0
- package/dist/Packet-CA76wVX3.mjs +197 -0
- package/dist/Packet-CA76wVX3.mjs.map +1 -0
- package/dist/Packet-Cy5g6XuW.d.mts +130 -0
- package/dist/Parser-p1Gyr0QN.d.mts +85 -0
- package/dist/Parser-xARsOWXk.mjs +1317 -0
- package/dist/Parser-xARsOWXk.mjs.map +1 -0
- package/dist/Path-B20Yp8KE.mjs +284 -0
- package/dist/Path-B20Yp8KE.mjs.map +1 -0
- package/dist/Path-DRB8e-Zn.d.mts +181 -0
- package/dist/Pdf-B9RZn--8.d.mts +77 -0
- package/dist/Pdf-CKK6dkZn.mjs +89 -0
- package/dist/Pdf-CKK6dkZn.mjs.map +1 -0
- package/dist/PdfA-CUjSuntT.d.mts +109 -0
- package/dist/PdfA-CleOhuL6.mjs +124 -0
- package/dist/PdfA-CleOhuL6.mjs.map +1 -0
- package/dist/Photoshop-CiHo80qV.mjs +233 -0
- package/dist/Photoshop-CiHo80qV.mjs.map +1 -0
- package/dist/Photoshop-udKZ0I3N.d.mts +204 -0
- package/dist/PrefixMap-BHFPDLO-.mjs +103 -0
- package/dist/PrefixMap-BHFPDLO-.mjs.map +1 -0
- package/dist/PrefixMap-BMlXrWNd.d.mts +64 -0
- package/dist/PrefixMap.d.mts +2 -0
- package/dist/PrefixMap.mjs +1 -0
- package/dist/Processor-CMmecFsb.mjs +198 -0
- package/dist/Processor-CMmecFsb.mjs.map +1 -0
- package/dist/Processor-FJPvO0CB.d.mts +435 -0
- package/dist/Protocol-BA7OkNgp.mjs +202 -0
- package/dist/Protocol-BA7OkNgp.mjs.map +1 -0
- package/dist/Protocol-DlSoiIKB.d.mts +108 -0
- package/dist/ProtocolErrors-Ckfejnl6.d.mts +84 -0
- package/dist/ProtocolErrors-czDPVcX5.mjs +129 -0
- package/dist/ProtocolErrors-czDPVcX5.mjs.map +1 -0
- package/dist/Query-D9A6LOpP.mjs +364 -0
- package/dist/Query-D9A6LOpP.mjs.map +1 -0
- package/dist/Query-KqSkTYyG.d.mts +96 -0
- package/dist/QueryBuilder-BLK9Vfbz.mjs +674 -0
- package/dist/QueryBuilder-BLK9Vfbz.mjs.map +1 -0
- package/dist/QueryBuilder-DUqh4ECe.d.mts +529 -0
- package/dist/RdfJs-D6-49XB5.mjs +86 -0
- package/dist/RdfJs-D6-49XB5.mjs.map +1 -0
- package/dist/RdfJs-DXFqdWrd.d.mts +76 -0
- package/dist/RdfJs.d.mts +2 -0
- package/dist/RdfJs.mjs +1 -0
- package/dist/RdfJson-5aKPDlPS.d.mts +297 -0
- package/dist/RdfJson-BNocgW4f.mjs +548 -0
- package/dist/RdfJson-BNocgW4f.mjs.map +1 -0
- package/dist/RdfXml-DJ9G4gOq.mjs +1014 -0
- package/dist/RdfXml-DJ9G4gOq.mjs.map +1 -0
- package/dist/RdfXml-_N7yxWEp.d.mts +149 -0
- package/dist/Rdfs-BRVPsAjc.d.mts +84 -0
- package/dist/Rdfs-CyY2wVHI.mjs +167 -0
- package/dist/Rdfs-CyY2wVHI.mjs.map +1 -0
- package/dist/Rdfs.d.mts +2 -0
- package/dist/Rdfs.mjs +1 -0
- package/dist/Reasoner-BxYhx9s7.d.mts +94 -0
- package/dist/Reasoner-Cw90zrjv.mjs +798 -0
- package/dist/Reasoner-Cw90zrjv.mjs.map +1 -0
- package/dist/Reification-BmN4EfnM.d.mts +40 -0
- package/dist/Reification-dpqQvjDE.mjs +82 -0
- package/dist/Reification-dpqQvjDE.mjs.map +1 -0
- package/dist/Reification.d.mts +2 -0
- package/dist/Reification.mjs +1 -0
- package/dist/Report-XHs8htzK.mjs +121 -0
- package/dist/Report-XHs8htzK.mjs.map +1 -0
- package/dist/Report-hcXsc_19.d.mts +115 -0
- package/dist/Resource-B1cI8FyJ.d.mts +218 -0
- package/dist/Resource-sIEeNh15.mjs +374 -0
- package/dist/Resource-sIEeNh15.mjs.map +1 -0
- package/dist/Resource.d.mts +2 -0
- package/dist/Resource.mjs +1 -0
- package/dist/Results-BVNEC-Wt.d.mts +277 -0
- package/dist/Results-peJjGA2V.mjs +621 -0
- package/dist/Results-peJjGA2V.mjs.map +1 -0
- package/dist/ResultsStream-BhF0OcNn.mjs +639 -0
- package/dist/ResultsStream-BhF0OcNn.mjs.map +1 -0
- package/dist/ResultsStream-toYMXrOe.d.mts +100 -0
- package/dist/SemAct-CDchtk49.d.mts +96 -0
- package/dist/SemAct-CmyT4yI8.mjs +118 -0
- package/dist/SemAct-CmyT4yI8.mjs.map +1 -0
- package/dist/Serialization-DP9H5bYQ.mjs +514 -0
- package/dist/Serialization-DP9H5bYQ.mjs.map +1 -0
- package/dist/Serialization-Df8iVauT.d.mts +392 -0
- package/dist/Serialization.d.mts +2 -0
- package/dist/Serialization.mjs +1 -0
- package/dist/ServerFormats-CrRnjjf6.mjs +64 -0
- package/dist/ServerFormats-CrRnjjf6.mjs.map +1 -0
- package/dist/ServerFormats-DjC9NsO_.d.mts +36 -0
- package/dist/ServiceDescription-BERsvg-k.d.mts +54 -0
- package/dist/ServiceDescription-Dq5hxeGy.mjs +97 -0
- package/dist/ServiceDescription-Dq5hxeGy.mjs.map +1 -0
- package/dist/ShExC-Ctf-06CL.d.mts +67 -0
- package/dist/ShExC-DJbB19i3.mjs +1181 -0
- package/dist/ShExC-DJbB19i3.mjs.map +1 -0
- package/dist/ShExError-BeYFD9rv.d.mts +61 -0
- package/dist/ShExError-CVtq2NnM.mjs +64 -0
- package/dist/ShExError-CVtq2NnM.mjs.map +1 -0
- package/dist/ShExJ-C1u_wgyD.d.mts +531 -0
- package/dist/ShExJ-COiPd9Xw.mjs +532 -0
- package/dist/ShExJ-COiPd9Xw.mjs.map +1 -0
- package/dist/ShExR-ByR4mCh-.mjs +480 -0
- package/dist/ShExR-ByR4mCh-.mjs.map +1 -0
- package/dist/ShExR-CqONNNBz.d.mts +40 -0
- package/dist/ShapeMap-C422pxKl.d.mts +140 -0
- package/dist/ShapeMap-CsgKxB2G.mjs +181 -0
- package/dist/ShapeMap-CsgKxB2G.mjs.map +1 -0
- package/dist/Shapes-18GjfyBV.mjs +597 -0
- package/dist/Shapes-18GjfyBV.mjs.map +1 -0
- package/dist/Shapes-BQFDFc4Q.d.mts +306 -0
- package/dist/Sparql-BiYFMSpl.mjs +29 -0
- package/dist/Sparql-BiYFMSpl.mjs.map +1 -0
- package/dist/Sparql-DecpWTPh.d.mts +97 -0
- package/dist/SparqlClient-C_CjXbwj.mjs +333 -0
- package/dist/SparqlClient-C_CjXbwj.mjs.map +1 -0
- package/dist/SparqlClient-UPc88SHy.d.mts +290 -0
- package/dist/SparqlServer-CbUW-pVj.d.mts +71 -0
- package/dist/SparqlServer-Db7w7Cll.mjs +308 -0
- package/dist/SparqlServer-Db7w7Cll.mjs.map +1 -0
- package/dist/SqlStore-BBqFx-Wl.mjs +684 -0
- package/dist/SqlStore-BBqFx-Wl.mjs.map +1 -0
- package/dist/SqlStore-CCJo5I-e.d.mts +117 -0
- package/dist/Store-D0jmVfb3.d.mts +166 -0
- package/dist/Store-DH3Ow1GO.mjs +162 -0
- package/dist/Store-DH3Ow1GO.mjs.map +1 -0
- package/dist/Structure-BjMo4Bkc.mjs +334 -0
- package/dist/Structure-BjMo4Bkc.mjs.map +1 -0
- package/dist/Structure-n4CmDiab.d.mts +63 -0
- package/dist/Table-BGgm9nbM.mjs +538 -0
- package/dist/Table-BGgm9nbM.mjs.map +1 -0
- package/dist/Table-C3reiVrb.d.mts +261 -0
- package/dist/Term-B_4ezyXq.d.mts +619 -0
- package/dist/Term-CFLG1qu4.mjs +991 -0
- package/dist/Term-CFLG1qu4.mjs.map +1 -0
- package/dist/Term.d.mts +2 -0
- package/dist/Term.mjs +1 -0
- package/dist/TermCodec-CDZiEztW.mjs +397 -0
- package/dist/TermCodec-CDZiEztW.mjs.map +1 -0
- package/dist/TermCodec-_03bDXr0.d.mts +209 -0
- package/dist/TermCodec.d.mts +2 -0
- package/dist/TermCodec.mjs +1 -0
- package/dist/TermJson-BOPe0yve.d.mts +232 -0
- package/dist/TermJson-FAg3lvjl.mjs +142 -0
- package/dist/TermJson-FAg3lvjl.mjs.map +1 -0
- package/dist/TermJson.d.mts +2 -0
- package/dist/TermJson.mjs +1 -0
- package/dist/TermSchema-Bn9CoaYA.mjs +30 -0
- package/dist/TermSchema-Bn9CoaYA.mjs.map +1 -0
- package/dist/TermSchema-DBO6MroX.d.mts +6 -0
- package/dist/Testing-B-aPCpmu.mjs +63 -0
- package/dist/Testing-B-aPCpmu.mjs.map +1 -0
- package/dist/Testing-CF6s8P3O.d.mts +53 -0
- package/dist/Tiff-CR-2QeSI.d.mts +148 -0
- package/dist/Tiff-DlsOlZPM.mjs +169 -0
- package/dist/Tiff-DlsOlZPM.mjs.map +1 -0
- package/dist/Tools-7MdRKccr.d.mts +583 -0
- package/dist/Tools-ryxphZbI.mjs +329 -0
- package/dist/Tools-ryxphZbI.mjs.map +1 -0
- package/dist/Translate-B0YKKANS.d.mts +37 -0
- package/dist/Translate-gzWPq0Ia.mjs +308 -0
- package/dist/Translate-gzWPq0Ia.mjs.map +1 -0
- package/dist/Translation-DC9rLm2y.mjs +1535 -0
- package/dist/Translation-DC9rLm2y.mjs.map +1 -0
- package/dist/Translation-K4L9XBqX.d.mts +103 -0
- package/dist/TriG-BkqtqZ6Y.mjs +125 -0
- package/dist/TriG-BkqtqZ6Y.mjs.map +1 -0
- package/dist/TriG-xDjdDatp.d.mts +86 -0
- package/dist/Turtle-Bv1_bisW.d.mts +85 -0
- package/dist/Turtle-CZVUOtwl.mjs +133 -0
- package/dist/Turtle-CZVUOtwl.mjs.map +1 -0
- package/dist/ValidationReport-DBdJshW5.mjs +285 -0
- package/dist/ValidationReport-DBdJshW5.mjs.map +1 -0
- package/dist/ValidationReport-Dx3WxY0h.d.mts +192 -0
- package/dist/Validator-227ff9Rn.d.mts +179 -0
- package/dist/Validator-BzXMKDeJ.mjs +1162 -0
- package/dist/Validator-BzXMKDeJ.mjs.map +1 -0
- package/dist/Validator-Dl8cih5V.d.mts +207 -0
- package/dist/Validator-DmUfMbpL.mjs +568 -0
- package/dist/Validator-DmUfMbpL.mjs.map +1 -0
- package/dist/Vocab-DceKywpq.mjs +168 -0
- package/dist/Vocab-DceKywpq.mjs.map +1 -0
- package/dist/Vocab-Df-L-IwZ.d.mts +46 -0
- package/dist/Vocab-Do56UgBX.d.mts +81 -0
- package/dist/Vocab-TfpWG1Ne.mjs +118 -0
- package/dist/Vocab-TfpWG1Ne.mjs.map +1 -0
- package/dist/Vocab.d.mts +2 -0
- package/dist/Vocab.mjs +1 -0
- package/dist/Vocabulary-C6-GPOy4.d.mts +22 -0
- package/dist/Vocabulary-CnQl-_Z4.mjs +179 -0
- package/dist/Vocabulary-CnQl-_Z4.mjs.map +1 -0
- package/dist/Xml-B7iihYCS.mjs +976 -0
- package/dist/Xml-B7iihYCS.mjs.map +1 -0
- package/dist/Xml-CmfHS7SW.d.mts +267 -0
- package/dist/Xmp-D7CKA7MZ.d.mts +111 -0
- package/dist/Xmp-DCGN9pOD.mjs +307 -0
- package/dist/Xmp-DCGN9pOD.mjs.map +1 -0
- package/dist/XmpBasic-CP38jpR_.mjs +73 -0
- package/dist/XmpBasic-CP38jpR_.mjs.map +1 -0
- package/dist/XmpBasic-Cmbe53rQ.d.mts +64 -0
- package/dist/XmpMM-BfL_TgJF.mjs +73 -0
- package/dist/XmpMM-BfL_TgJF.mjs.map +1 -0
- package/dist/XmpMM-Dqm3IX8p.d.mts +63 -0
- package/dist/XmpRights-BKPtoI5L.mjs +73 -0
- package/dist/XmpRights-BKPtoI5L.mjs.map +1 -0
- package/dist/XmpRights-CaALZQz2.d.mts +63 -0
- package/dist/Xsd-Cdgx5zRB.mjs +405 -0
- package/dist/Xsd-Cdgx5zRB.mjs.map +1 -0
- package/dist/Xsd-D2elNhSm.d.mts +187 -0
- package/dist/Xsd.d.mts +2 -0
- package/dist/Xsd.mjs +1 -0
- package/dist/accessors-CEjaojuQ.mjs +28 -0
- package/dist/accessors-CEjaojuQ.mjs.map +1 -0
- package/dist/codec-Lb2T96rv.d.mts +20 -0
- package/dist/codec-QNo7IdJF.mjs +389 -0
- package/dist/codec-QNo7IdJF.mjs.map +1 -0
- package/dist/csvw/Csv2Json.d.mts +2 -0
- package/dist/csvw/Csv2Json.mjs +1 -0
- package/dist/csvw/Csv2Rdf.d.mts +2 -0
- package/dist/csvw/Csv2Rdf.mjs +1 -0
- package/dist/csvw/Datatype.d.mts +2 -0
- package/dist/csvw/Datatype.mjs +1 -0
- package/dist/csvw/Metadata.d.mts +2 -0
- package/dist/csvw/Metadata.mjs +1 -0
- package/dist/csvw/Processor.d.mts +2 -0
- package/dist/csvw/Processor.mjs +1 -0
- package/dist/csvw/Report.d.mts +2 -0
- package/dist/csvw/Report.mjs +1 -0
- package/dist/csvw/Table.d.mts +2 -0
- package/dist/csvw/Table.mjs +1 -0
- package/dist/csvw/index.d.mts +8 -0
- package/dist/csvw/index.mjs +8 -0
- package/dist/index-Cms2TYfC.d.mts +16 -0
- package/dist/index-Ct8xFmRs.d.mts +7 -0
- package/dist/index-D4QFwOjm.d.mts +28 -0
- package/dist/index.d.mts +18 -0
- package/dist/index.mjs +17 -0
- package/dist/jsonld/DocumentLoader.d.mts +2 -0
- package/dist/jsonld/DocumentLoader.mjs +1 -0
- package/dist/jsonld/JsonLd.d.mts +2 -0
- package/dist/jsonld/JsonLd.mjs +1 -0
- package/dist/jsonld/JsonLdError.d.mts +2 -0
- package/dist/jsonld/JsonLdError.mjs +1 -0
- package/dist/jsonld/index.d.mts +4 -0
- package/dist/jsonld/index.mjs +4 -0
- package/dist/lists-D-OpQ0Ir.mjs +77 -0
- package/dist/lists-D-OpQ0Ir.mjs.map +1 -0
- package/dist/loop-D5-gNx9K.mjs +21 -0
- package/dist/loop-D5-gNx9K.mjs.map +1 -0
- package/dist/loop-DZ2hXlr_.mjs +21 -0
- package/dist/loop-DZ2hXlr_.mjs.map +1 -0
- package/dist/n3/Isomorphism.d.mts +2 -0
- package/dist/n3/Isomorphism.mjs +1 -0
- package/dist/n3/Mapping.d.mts +2 -0
- package/dist/n3/Mapping.mjs +1 -0
- package/dist/n3/Model.d.mts +2 -0
- package/dist/n3/Model.mjs +1 -0
- package/dist/n3/N3.d.mts +2 -0
- package/dist/n3/N3.mjs +1 -0
- package/dist/n3/Reasoner.d.mts +2 -0
- package/dist/n3/Reasoner.mjs +2 -0
- package/dist/n3/Vocab.d.mts +2 -0
- package/dist/n3/Vocab.mjs +1 -0
- package/dist/n3/index.d.mts +7 -0
- package/dist/n3/index.mjs +7 -0
- package/dist/ntriples/Grammar.d.mts +2 -0
- package/dist/ntriples/Grammar.mjs +1 -0
- package/dist/ntriples/Lexical.d.mts +2 -0
- package/dist/ntriples/Lexical.mjs +1 -0
- package/dist/ntriples/NQuads.d.mts +2 -0
- package/dist/ntriples/NQuads.mjs +1 -0
- package/dist/ntriples/NTriples.d.mts +2 -0
- package/dist/ntriples/NTriples.mjs +1 -0
- package/dist/ntriples/index.d.mts +5 -0
- package/dist/ntriples/index.mjs +5 -0
- package/dist/rdfjson/RdfJson.d.mts +2 -0
- package/dist/rdfjson/RdfJson.mjs +1 -0
- package/dist/rdfjson/index.d.mts +2 -0
- package/dist/rdfjson/index.mjs +1 -0
- package/dist/rdfxml/RdfXml.d.mts +2 -0
- package/dist/rdfxml/RdfXml.mjs +1 -0
- package/dist/rdfxml/Xml.d.mts +2 -0
- package/dist/rdfxml/Xml.mjs +1 -0
- package/dist/rdfxml/index.d.mts +3 -0
- package/dist/rdfxml/index.mjs +3 -0
- package/dist/rolldown-runtime-D8jQpDG7.mjs +12 -0
- package/dist/serialize-96KBvKaf.mjs +1463 -0
- package/dist/serialize-96KBvKaf.mjs.map +1 -0
- package/dist/serialize-DsoXdM6n.d.mts +37 -0
- package/dist/shacl/Message.d.mts +2 -0
- package/dist/shacl/Message.mjs +1 -0
- package/dist/shacl/Path.d.mts +2 -0
- package/dist/shacl/Path.mjs +1 -0
- package/dist/shacl/Shapes.d.mts +2 -0
- package/dist/shacl/Shapes.mjs +1 -0
- package/dist/shacl/Sparql.d.mts +2 -0
- package/dist/shacl/Sparql.mjs +1 -0
- package/dist/shacl/ValidationReport.d.mts +2 -0
- package/dist/shacl/ValidationReport.mjs +1 -0
- package/dist/shacl/Validator.d.mts +2 -0
- package/dist/shacl/Validator.mjs +1 -0
- package/dist/shacl/Vocabulary.d.mts +2 -0
- package/dist/shacl/Vocabulary.mjs +1 -0
- package/dist/shacl/index.d.mts +9 -0
- package/dist/shacl/index.mjs +8 -0
- package/dist/shex/SemAct.d.mts +2 -0
- package/dist/shex/SemAct.mjs +1 -0
- package/dist/shex/ShExC.d.mts +2 -0
- package/dist/shex/ShExC.mjs +1 -0
- package/dist/shex/ShExError.d.mts +2 -0
- package/dist/shex/ShExError.mjs +1 -0
- package/dist/shex/ShExJ.d.mts +2 -0
- package/dist/shex/ShExJ.mjs +2 -0
- package/dist/shex/ShExR.d.mts +2 -0
- package/dist/shex/ShExR.mjs +1 -0
- package/dist/shex/ShapeMap.d.mts +2 -0
- package/dist/shex/ShapeMap.mjs +1 -0
- package/dist/shex/Structure.d.mts +2 -0
- package/dist/shex/Structure.mjs +2 -0
- package/dist/shex/Validator.d.mts +2 -0
- package/dist/shex/Validator.mjs +4 -0
- package/dist/shex/index.d.mts +9 -0
- package/dist/shex/index.mjs +9 -0
- package/dist/sparql/Algebra.d.mts +2 -0
- package/dist/sparql/Algebra.mjs +1 -0
- package/dist/sparql/Ast.d.mts +2 -0
- package/dist/sparql/Ast.mjs +1 -0
- package/dist/sparql/Bindings.d.mts +2 -0
- package/dist/sparql/Bindings.mjs +1 -0
- package/dist/sparql/ClientErrors.d.mts +2 -0
- package/dist/sparql/ClientErrors.mjs +1 -0
- package/dist/sparql/ClientFormats.d.mts +2 -0
- package/dist/sparql/ClientFormats.mjs +1 -0
- package/dist/sparql/Engine.d.mts +2 -0
- package/dist/sparql/Engine.mjs +1 -0
- package/dist/sparql/Errors.d.mts +2 -0
- package/dist/sparql/Errors.mjs +1 -0
- package/dist/sparql/Expression.d.mts +2 -0
- package/dist/sparql/Expression.mjs +1 -0
- package/dist/sparql/Federation.d.mts +2 -0
- package/dist/sparql/Federation.mjs +1 -0
- package/dist/sparql/Functions.d.mts +2 -0
- package/dist/sparql/Functions.mjs +1 -0
- package/dist/sparql/Generator.d.mts +2 -0
- package/dist/sparql/Generator.mjs +1 -0
- package/dist/sparql/GraphStore.d.mts +2 -0
- package/dist/sparql/GraphStore.mjs +1 -0
- package/dist/sparql/Optimizer.d.mts +2 -0
- package/dist/sparql/Optimizer.mjs +1 -0
- package/dist/sparql/Options.d.mts +2 -0
- package/dist/sparql/Options.mjs +1 -0
- package/dist/sparql/Parser.d.mts +2 -0
- package/dist/sparql/Parser.mjs +1 -0
- package/dist/sparql/Protocol.d.mts +2 -0
- package/dist/sparql/Protocol.mjs +1 -0
- package/dist/sparql/ProtocolErrors.d.mts +2 -0
- package/dist/sparql/ProtocolErrors.mjs +1 -0
- package/dist/sparql/QueryBuilder.d.mts +2 -0
- package/dist/sparql/QueryBuilder.mjs +1 -0
- package/dist/sparql/Results.d.mts +2 -0
- package/dist/sparql/Results.mjs +1 -0
- package/dist/sparql/ResultsStream.d.mts +2 -0
- package/dist/sparql/ResultsStream.mjs +1 -0
- package/dist/sparql/ServerFormats.d.mts +2 -0
- package/dist/sparql/ServerFormats.mjs +1 -0
- package/dist/sparql/ServiceDescription.d.mts +2 -0
- package/dist/sparql/ServiceDescription.mjs +1 -0
- package/dist/sparql/SparqlClient.d.mts +2 -0
- package/dist/sparql/SparqlClient.mjs +1 -0
- package/dist/sparql/SparqlServer.d.mts +2 -0
- package/dist/sparql/SparqlServer.mjs +1 -0
- package/dist/sparql/Store.d.mts +2 -0
- package/dist/sparql/Store.mjs +1 -0
- package/dist/sparql/TermSchema.d.mts +3 -0
- package/dist/sparql/TermSchema.mjs +2 -0
- package/dist/sparql/Testing.d.mts +2 -0
- package/dist/sparql/Testing.mjs +1 -0
- package/dist/sparql/Translate.d.mts +2 -0
- package/dist/sparql/Translate.mjs +1 -0
- package/dist/sparql/ai/Mcp.d.mts +2 -0
- package/dist/sparql/ai/Mcp.mjs +1 -0
- package/dist/sparql/ai/Tools.d.mts +2 -0
- package/dist/sparql/ai/Tools.mjs +1 -0
- package/dist/sparql/ai/index.d.mts +3 -0
- package/dist/sparql/ai/index.mjs +3 -0
- package/dist/sparql/index.d.mts +30 -0
- package/dist/sparql/index.mjs +29 -0
- package/dist/sparql/shacl/Evaluator.d.mts +2 -0
- package/dist/sparql/shacl/Evaluator.mjs +1 -0
- package/dist/sparql/shacl/Query.d.mts +2 -0
- package/dist/sparql/shacl/Query.mjs +1 -0
- package/dist/sparql/shacl/index.d.mts +3 -0
- package/dist/sparql/shacl/index.mjs +3 -0
- package/dist/sparql/sql/Dialect.d.mts +2 -0
- package/dist/sparql/sql/Dialect.mjs +1 -0
- package/dist/sparql/sql/SqlStore.d.mts +2 -0
- package/dist/sparql/sql/SqlStore.mjs +1 -0
- package/dist/sparql/sql/Translation.d.mts +2 -0
- package/dist/sparql/sql/Translation.mjs +1 -0
- package/dist/sparql/sql/index.d.mts +4 -0
- package/dist/sparql/sql/index.mjs +4 -0
- package/dist/stringMap-D5YIpYtR.mjs +38 -0
- package/dist/stringMap-D5YIpYtR.mjs.map +1 -0
- package/dist/tokens-C6BzeodQ.mjs +24 -0
- package/dist/tokens-C6BzeodQ.mjs.map +1 -0
- package/dist/turtle/Grammar.d.mts +3 -0
- package/dist/turtle/Grammar.mjs +3 -0
- package/dist/turtle/Manifest.d.mts +2 -0
- package/dist/turtle/Manifest.mjs +1 -0
- package/dist/turtle/TriG.d.mts +2 -0
- package/dist/turtle/TriG.mjs +1 -0
- package/dist/turtle/Turtle.d.mts +2 -0
- package/dist/turtle/Turtle.mjs +1 -0
- package/dist/turtle/index.d.mts +5 -0
- package/dist/turtle/index.mjs +5 -0
- package/dist/xmp/DublinCore.d.mts +2 -0
- package/dist/xmp/DublinCore.mjs +1 -0
- package/dist/xmp/Exif.d.mts +2 -0
- package/dist/xmp/Exif.mjs +1 -0
- package/dist/xmp/Extract.d.mts +2 -0
- package/dist/xmp/Extract.mjs +1 -0
- package/dist/xmp/Metadata.d.mts +2 -0
- package/dist/xmp/Metadata.mjs +1 -0
- package/dist/xmp/Namespaces.d.mts +2 -0
- package/dist/xmp/Namespaces.mjs +1 -0
- package/dist/xmp/Packet.d.mts +2 -0
- package/dist/xmp/Packet.mjs +1 -0
- package/dist/xmp/Pdf.d.mts +2 -0
- package/dist/xmp/Pdf.mjs +1 -0
- package/dist/xmp/PdfA.d.mts +2 -0
- package/dist/xmp/PdfA.mjs +1 -0
- package/dist/xmp/Photoshop.d.mts +2 -0
- package/dist/xmp/Photoshop.mjs +1 -0
- package/dist/xmp/Tiff.d.mts +2 -0
- package/dist/xmp/Tiff.mjs +1 -0
- package/dist/xmp/Xmp.d.mts +2 -0
- package/dist/xmp/Xmp.mjs +3 -0
- package/dist/xmp/XmpBasic.d.mts +2 -0
- package/dist/xmp/XmpBasic.mjs +1 -0
- package/dist/xmp/XmpMM.d.mts +2 -0
- package/dist/xmp/XmpMM.mjs +1 -0
- package/dist/xmp/XmpRights.d.mts +2 -0
- package/dist/xmp/XmpRights.mjs +1 -0
- package/dist/xmp/index.d.mts +15 -0
- package/dist/xmp/index.mjs +15 -0
- package/package.json +187 -3
- package/src/Dataset.ts +1085 -0
- package/src/Iri.ts +322 -0
- package/src/Isomorphism.ts +319 -0
- package/src/LanguageTag.ts +98 -0
- package/src/Namespace.ts +100 -0
- package/src/PrefixMap.ts +117 -0
- package/src/RdfJs.ts +146 -0
- package/src/Rdfs.ts +241 -0
- package/src/Reification.ts +103 -0
- package/src/Resource.ts +873 -0
- package/src/Serialization.ts +775 -0
- package/src/Term.ts +1300 -0
- package/src/TermCodec.ts +505 -0
- package/src/TermJson.ts +313 -0
- package/src/Vocab.ts +161 -0
- package/src/Xsd.ts +573 -0
- package/src/csvw/Csv2Json.ts +265 -0
- package/src/csvw/Csv2Rdf.ts +268 -0
- package/src/csvw/Datatype.ts +589 -0
- package/src/csvw/Metadata.ts +1523 -0
- package/src/csvw/Processor.ts +276 -0
- package/src/csvw/Report.ts +135 -0
- package/src/csvw/Table.ts +759 -0
- package/src/csvw/index.ts +22 -0
- package/src/csvw/internal/dateFormat.ts +202 -0
- package/src/csvw/internal/json.ts +104 -0
- package/src/csvw/internal/numberFormat.ts +369 -0
- package/src/csvw/internal/object.ts +23 -0
- package/src/csvw/internal/uriTemplate.ts +130 -0
- package/src/csvw/internal/url.ts +93 -0
- package/src/csvw/internal/vocab.ts +282 -0
- package/src/index.ts +40 -0
- package/src/internal/arbitrary.ts +148 -0
- package/src/internal/loop.ts +24 -0
- package/src/internal/pending.ts +20 -0
- package/src/internal/textDecoder.ts +183 -0
- package/src/jsonld/DocumentLoader.ts +512 -0
- package/src/jsonld/JsonLd.ts +847 -0
- package/src/jsonld/JsonLdError.ts +105 -0
- package/src/jsonld/index.ts +13 -0
- package/src/jsonld/internal/compact.ts +852 -0
- package/src/jsonld/internal/context.ts +781 -0
- package/src/jsonld/internal/expand.ts +614 -0
- package/src/jsonld/internal/flatten.ts +243 -0
- package/src/jsonld/internal/frame.ts +559 -0
- package/src/jsonld/internal/iri.ts +52 -0
- package/src/jsonld/internal/json.ts +19 -0
- package/src/jsonld/internal/linkHeader.ts +60 -0
- package/src/jsonld/internal/rdf.ts +481 -0
- package/src/jsonld/internal/util.ts +367 -0
- package/src/n3/Isomorphism.ts +476 -0
- package/src/n3/Mapping.ts +332 -0
- package/src/n3/Model.ts +696 -0
- package/src/n3/N3.ts +237 -0
- package/src/n3/Reasoner.ts +568 -0
- package/src/n3/Vocab.ts +111 -0
- package/src/n3/index.ts +21 -0
- package/src/n3/internal/builtins.ts +668 -0
- package/src/n3/internal/guards.ts +23 -0
- package/src/n3/internal/lists.ts +106 -0
- package/src/n3/internal/loop.ts +28 -0
- package/src/n3/internal/parser.ts +1032 -0
- package/src/n3/internal/writer.ts +344 -0
- package/src/ntriples/Grammar.ts +317 -0
- package/src/ntriples/Lexical.ts +321 -0
- package/src/ntriples/NQuads.ts +140 -0
- package/src/ntriples/NTriples.ts +143 -0
- package/src/ntriples/index.ts +14 -0
- package/src/ntriples/internal/codec.ts +229 -0
- package/src/ntriples/internal/lineParser.ts +326 -0
- package/src/ntriples/internal/loop.ts +14 -0
- package/src/rdfjson/RdfJson.ts +806 -0
- package/src/rdfjson/index.ts +9 -0
- package/src/rdfjson/internal/json.ts +19 -0
- package/src/rdfxml/RdfXml.ts +1408 -0
- package/src/rdfxml/Xml.ts +419 -0
- package/src/rdfxml/index.ts +11 -0
- package/src/rdfxml/internal/chars.ts +73 -0
- package/src/rdfxml/internal/loop.ts +24 -0
- package/src/rdfxml/internal/parser.ts +1265 -0
- package/src/shacl/Message.ts +102 -0
- package/src/shacl/Path.ts +483 -0
- package/src/shacl/Shapes.ts +913 -0
- package/src/shacl/Sparql.ts +128 -0
- package/src/shacl/ValidationReport.ts +438 -0
- package/src/shacl/Validator.ts +1156 -0
- package/src/shacl/Vocabulary.ts +180 -0
- package/src/shacl/index.ts +22 -0
- package/src/shacl/internal/compare.ts +128 -0
- package/src/shacl/internal/regex.ts +56 -0
- package/src/shex/SemAct.ts +197 -0
- package/src/shex/ShExC.ts +415 -0
- package/src/shex/ShExError.ts +71 -0
- package/src/shex/ShExJ.ts +893 -0
- package/src/shex/ShExR.ts +640 -0
- package/src/shex/ShapeMap.ts +385 -0
- package/src/shex/Structure.ts +467 -0
- package/src/shex/Validator.ts +395 -0
- package/src/shex/index.ts +24 -0
- package/src/shex/internal/engine.ts +682 -0
- package/src/shex/internal/iterate.ts +14 -0
- package/src/shex/internal/json.ts +12 -0
- package/src/shex/internal/lexer.ts +56 -0
- package/src/shex/internal/nodeConstraint.ts +368 -0
- package/src/shex/internal/shexcLexer.ts +387 -0
- package/src/shex/internal/shexcParser.ts +1312 -0
- package/src/shex/internal/tokens.ts +41 -0
- package/src/shex/internal/xpathRegex.ts +290 -0
- package/src/sparql/Algebra.ts +914 -0
- package/src/sparql/Ast.ts +1344 -0
- package/src/sparql/Bindings.ts +272 -0
- package/src/sparql/ClientErrors.ts +156 -0
- package/src/sparql/ClientFormats.ts +70 -0
- package/src/sparql/Engine.ts +699 -0
- package/src/sparql/Errors.ts +30 -0
- package/src/sparql/Expression.ts +360 -0
- package/src/sparql/Federation.ts +187 -0
- package/src/sparql/Functions.ts +689 -0
- package/src/sparql/Generator.ts +426 -0
- package/src/sparql/GraphStore.ts +341 -0
- package/src/sparql/Optimizer.ts +230 -0
- package/src/sparql/Options.ts +191 -0
- package/src/sparql/Parser.ts +173 -0
- package/src/sparql/Protocol.ts +342 -0
- package/src/sparql/ProtocolErrors.ts +113 -0
- package/src/sparql/QueryBuilder.ts +953 -0
- package/src/sparql/Results.ts +844 -0
- package/src/sparql/ResultsStream.ts +771 -0
- package/src/sparql/ServerFormats.ts +75 -0
- package/src/sparql/ServiceDescription.ts +130 -0
- package/src/sparql/SparqlClient.ts +947 -0
- package/src/sparql/SparqlServer.ts +528 -0
- package/src/sparql/Store.ts +311 -0
- package/src/sparql/TermSchema.ts +20 -0
- package/src/sparql/Testing.ts +114 -0
- package/src/sparql/Translate.ts +407 -0
- package/src/sparql/ai/Mcp.ts +43 -0
- package/src/sparql/ai/Tools.ts +481 -0
- package/src/sparql/ai/index.ts +11 -0
- package/src/sparql/index.ts +64 -0
- package/src/sparql/internal/evaluator.ts +947 -0
- package/src/sparql/internal/hash.ts +418 -0
- package/src/sparql/internal/json.ts +12 -0
- package/src/sparql/internal/lexer.ts +488 -0
- package/src/sparql/internal/loop.ts +24 -0
- package/src/sparql/internal/parser.ts +2215 -0
- package/src/sparql/internal/prefetch.ts +46 -0
- package/src/sparql/internal/stringMap.ts +39 -0
- package/src/sparql/internal/textResults.ts +226 -0
- package/src/sparql/internal/values.ts +550 -0
- package/src/sparql/shacl/Evaluator.ts +478 -0
- package/src/sparql/shacl/Query.ts +574 -0
- package/src/sparql/shacl/index.ts +12 -0
- package/src/sparql/sql/Dialect.ts +246 -0
- package/src/sparql/sql/SqlStore.ts +1080 -0
- package/src/sparql/sql/Translation.ts +1898 -0
- package/src/sparql/sql/index.ts +17 -0
- package/src/sparql/sql/internal/encoding.ts +313 -0
- package/src/turtle/Grammar.ts +286 -0
- package/src/turtle/Manifest.ts +215 -0
- package/src/turtle/TriG.ts +158 -0
- package/src/turtle/Turtle.ts +166 -0
- package/src/turtle/index.ts +14 -0
- package/src/turtle/internal/loop.ts +23 -0
- package/src/turtle/internal/parse.ts +112 -0
- package/src/turtle/internal/parser.ts +1303 -0
- package/src/turtle/internal/serialize.ts +79 -0
- package/src/turtle/internal/streamWriter.ts +128 -0
- package/src/turtle/internal/writer.ts +898 -0
- package/src/xmp/DublinCore.ts +147 -0
- package/src/xmp/Exif.ts +109 -0
- package/src/xmp/Extract.ts +351 -0
- package/src/xmp/Metadata.ts +703 -0
- package/src/xmp/Namespaces.ts +228 -0
- package/src/xmp/Packet.ts +297 -0
- package/src/xmp/Pdf.ts +99 -0
- package/src/xmp/PdfA.ts +280 -0
- package/src/xmp/Photoshop.ts +275 -0
- package/src/xmp/Tiff.ts +196 -0
- package/src/xmp/Xmp.ts +430 -0
- package/src/xmp/XmpBasic.ts +90 -0
- package/src/xmp/XmpMM.ts +82 -0
- package/src/xmp/XmpRights.ts +83 -0
- package/src/xmp/index.ts +36 -0
- package/src/xmp/internal/accessors.ts +72 -0
- package/src/xmp/internal/xml.ts +63 -0
|
@@ -0,0 +1,872 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
|
|
2
|
+
import { B as isNamedNode, K as isTriple, N as isBlankNode, O as defaultGraph, P as isDefaultGraph, T as blankNode, V as isObject, W as isSubject, X as mapTerms, d as Quad, o as Literal, q as isVariable, rt as triple, z as isLiteral } from "./Term-CFLG1qu4.mjs";
|
|
3
|
+
import { a as setOf, i as fromEntries, n as empty, r as emptySet, t as copy } from "./stringMap-D5YIpYtR.mjs";
|
|
4
|
+
import { _ as prebind$1, f as join, n as bgp, x as unit } from "./Algebra-CGG4oae3.mjs";
|
|
5
|
+
import { a as empty$1, f as merge, g as sharesVariable, h as set, i as compatible, p as project, t as Bindings } from "./Bindings-Ck3m7JRC.mjs";
|
|
6
|
+
import { n as EvaluationError, r as UpdateError } from "./Errors-CMdV1RhU.mjs";
|
|
7
|
+
import { C as orderCompare, _ as dt, b as fail, f as arithmetic, g as compareTerms, m as catchEvalFailure, w as simple } from "./Functions-AvjNcId_.mjs";
|
|
8
|
+
import { c as makeContext, l as test, o as evaluateOrUndefined } from "./Expression-BIMMvduQ.mjs";
|
|
9
|
+
import { n as optimize } from "./Optimizer-BWWQRQPY.mjs";
|
|
10
|
+
import { i as parseQuery, s as parseUpdate } from "./Parser-xARsOWXk.mjs";
|
|
11
|
+
import { i as layerMemory$1, t as QuadStore } from "./Store-DH3Ow1GO.mjs";
|
|
12
|
+
import { a as translateQuery, i as translatePattern } from "./Translate-gzWPq0Ia.mjs";
|
|
13
|
+
import * as Arr from "effect/Array";
|
|
14
|
+
import * as Option from "effect/Option";
|
|
15
|
+
import * as Predicate from "effect/Predicate";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as Match from "effect/Match";
|
|
18
|
+
import * as Order from "effect/Order";
|
|
19
|
+
import * as Context from "effect/Context";
|
|
20
|
+
import * as Layer from "effect/Layer";
|
|
21
|
+
import * as Stream from "effect/Stream";
|
|
22
|
+
import * as Result from "effect/Result";
|
|
23
|
+
import * as Cause from "effect/Cause";
|
|
24
|
+
// src/sparql/internal/evaluator.ts
|
|
25
|
+
/**
|
|
26
|
+
* The generic, streaming evaluator of the SPARQL algebra over a `QuadStore`.
|
|
27
|
+
*
|
|
28
|
+
* @internal
|
|
29
|
+
*/
|
|
30
|
+
/**
|
|
31
|
+
* Substitutes bound variables: the ground term, or `None` while a variable
|
|
32
|
+
* is unbound. Plain branches rather than `Match`: it runs for every term of
|
|
33
|
+
* every triple pattern per solution.
|
|
34
|
+
*/
|
|
35
|
+
const ground = (t, b) => {
|
|
36
|
+
if (isVariable(t)) return Option.fromUndefinedOr(b.map.get(t.value));
|
|
37
|
+
if (isTriple(t)) {
|
|
38
|
+
const s = ground(t.subject, b);
|
|
39
|
+
if (Option.isNone(s)) return s;
|
|
40
|
+
const p = ground(t.predicate, b);
|
|
41
|
+
if (Option.isNone(p)) return p;
|
|
42
|
+
const o = ground(t.object, b);
|
|
43
|
+
if (Option.isNone(o)) return o;
|
|
44
|
+
return t.subject === s.value && t.predicate === p.value && t.object === o.value ? Option.some(t) : Option.some(triple(s.value, p.value, o.value));
|
|
45
|
+
}
|
|
46
|
+
return isDefaultGraph(t) ? Option.none() : Option.some(t);
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* Unifies a pattern term with a value, extending `map`; false on mismatch.
|
|
50
|
+
* Plain branches rather than `Match`: it runs for every matched quad.
|
|
51
|
+
*/
|
|
52
|
+
const unify = (t, value, map) => {
|
|
53
|
+
if (isVariable(t)) {
|
|
54
|
+
const bound = map.get(t.value);
|
|
55
|
+
if (bound !== void 0) return bound.key === value.key;
|
|
56
|
+
map.set(t.value, value);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
if (isTriple(t)) return isTriple(value) && unify(t.subject, value.subject, map) && unify(t.predicate, value.predicate, map) && unify(t.object, value.object, map);
|
|
60
|
+
return t.key === value.key;
|
|
61
|
+
};
|
|
62
|
+
const dedupeTriples = (quads) => Stream.suspend(() => {
|
|
63
|
+
const seen = emptySet();
|
|
64
|
+
return Stream.filter(quads, (q) => {
|
|
65
|
+
const k = `${q.subject.key} ${q.predicate.key} ${q.object.key}`;
|
|
66
|
+
if (seen.has(k)) return false;
|
|
67
|
+
seen.set(k, true);
|
|
68
|
+
return true;
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
/** Matches a quad pattern (without graph) in the active graph. */
|
|
72
|
+
const matchQuads = (env, pattern) => {
|
|
73
|
+
const active = env.graph;
|
|
74
|
+
if (Predicate.isTagged(active, "NamedGraph")) return env.store.match({
|
|
75
|
+
...pattern,
|
|
76
|
+
graph: active.graph
|
|
77
|
+
});
|
|
78
|
+
const def = env.dataset.defaultGraph;
|
|
79
|
+
if (def === "default") return env.store.match({
|
|
80
|
+
...pattern,
|
|
81
|
+
graph: defaultGraph
|
|
82
|
+
});
|
|
83
|
+
if (def === "union") return dedupeTriples(env.store.match({
|
|
84
|
+
...pattern,
|
|
85
|
+
graph: void 0
|
|
86
|
+
}));
|
|
87
|
+
if (!Arr.isReadonlyArrayNonEmpty(def)) return Stream.empty;
|
|
88
|
+
if (def.length === 1) return env.store.match({
|
|
89
|
+
...pattern,
|
|
90
|
+
graph: Arr.headNonEmpty(def)
|
|
91
|
+
});
|
|
92
|
+
return dedupeTriples(concatAll(def.map((g) => env.store.match({
|
|
93
|
+
...pattern,
|
|
94
|
+
graph: g
|
|
95
|
+
}))));
|
|
96
|
+
};
|
|
97
|
+
const concatAll = (streams) => Arr.isReadonlyArrayEmpty(streams) ? Stream.empty : streams.reduce((a, b) => Stream.concat(a, b));
|
|
98
|
+
const matchTriple = (pattern, env, b) => {
|
|
99
|
+
const s = ground(pattern.subject, b);
|
|
100
|
+
const p = ground(pattern.predicate, b);
|
|
101
|
+
const o = ground(pattern.object, b);
|
|
102
|
+
const unifyS = Option.isNone(s);
|
|
103
|
+
const unifyP = Option.isNone(p);
|
|
104
|
+
const unifyO = Option.isNone(o);
|
|
105
|
+
return matchQuads(env, {
|
|
106
|
+
subject: Option.getOrUndefined(s),
|
|
107
|
+
predicate: Option.getOrUndefined(p),
|
|
108
|
+
object: Option.getOrUndefined(o)
|
|
109
|
+
}).pipe(Stream.filterMap((q) => {
|
|
110
|
+
const map = copy(b.map);
|
|
111
|
+
if ((!unifyS || unify(pattern.subject, q.subject, map)) && (!unifyP || unify(pattern.predicate, q.predicate, map)) && (!unifyO || unify(pattern.object, q.object, map))) return Result.succeed(new Bindings(map));
|
|
112
|
+
return Result.fail(void 0);
|
|
113
|
+
}));
|
|
114
|
+
};
|
|
115
|
+
const evalBgp = (patterns, env, initial) => {
|
|
116
|
+
const start = Stream.succeed(initial);
|
|
117
|
+
return patterns.reduce((stream, p) => Stream.flatMap(stream, (b) => matchTriple(p, env, b)), start);
|
|
118
|
+
};
|
|
119
|
+
/** `Effect.forEach` in order, concatenating each element's results. */
|
|
120
|
+
const forEachFlat = (items, f) => Effect.map(Effect.forEach(items, f, { concurrency: 1 }), (lists) => lists.flat());
|
|
121
|
+
const collect = (env, pattern) => Stream.runCollect(matchQuads(env, pattern));
|
|
122
|
+
const iriValueSet = (list) => setOf(list.map((i) => i.value));
|
|
123
|
+
const distinctTerms = (terms) => {
|
|
124
|
+
const seen = empty();
|
|
125
|
+
terms.forEach((t) => {
|
|
126
|
+
if (!seen.has(t.key)) seen.set(t.key, t);
|
|
127
|
+
});
|
|
128
|
+
return Array.from(seen.values());
|
|
129
|
+
};
|
|
130
|
+
/** Nodes reachable from `start` by `path` (forward) or reaching `start` (backward); a bag. */
|
|
131
|
+
const pathFrom = (env, path, start, forward) => {
|
|
132
|
+
return Match.value(path).pipe(Match.tag("PathLink", (link) => Effect.map(collect(env, forward ? {
|
|
133
|
+
subject: start,
|
|
134
|
+
predicate: link.iri
|
|
135
|
+
} : {
|
|
136
|
+
predicate: link.iri,
|
|
137
|
+
object: start
|
|
138
|
+
}), (qs) => qs.map((q) => forward ? q.object : q.subject))), Match.tag("PathInverse", (inv) => pathFrom(env, inv.path, start, !forward)), Match.tag("PathSequence", (seq) => {
|
|
139
|
+
const steps = forward ? seq.paths : seq.paths.toReversed();
|
|
140
|
+
return Effect.reduce(steps, () => [start], (frontier, step) => forEachFlat(frontier, (n) => pathFrom(env, step, n, forward)));
|
|
141
|
+
}), Match.tag("PathAlternative", (alt) => forEachFlat(alt.paths, (p) => pathFrom(env, p, start, forward))), Match.tag("PathZeroOrOne", (opt) => Effect.map(pathFrom(env, opt.path, start, forward), (ns) => distinctTerms([start, ...ns]))), Match.tag("PathZeroOrMore", "PathOneOrMore", (rep) => closure(env, rep.path, start, forward, Predicate.isTagged(rep, "PathZeroOrMore"))), Match.tag("PathNegated", (neg) => {
|
|
142
|
+
const parts = [];
|
|
143
|
+
if (Arr.isReadonlyArrayNonEmpty(neg.iris) || Arr.isReadonlyArrayEmpty(neg.inverse)) {
|
|
144
|
+
const ex = iriValueSet(neg.iris);
|
|
145
|
+
parts.push(Effect.map(collect(env, forward ? { subject: start } : { object: start }), (qs) => qs.filter((q) => !ex.has(q.predicate.value)).map((q) => forward ? q.object : q.subject)));
|
|
146
|
+
}
|
|
147
|
+
if (Arr.isReadonlyArrayNonEmpty(neg.inverse)) {
|
|
148
|
+
const ex = iriValueSet(neg.inverse);
|
|
149
|
+
parts.push(Effect.map(collect(env, forward ? { object: start } : { subject: start }), (qs) => qs.filter((q) => !ex.has(q.predicate.value)).map((q) => forward ? q.subject : q.object)));
|
|
150
|
+
}
|
|
151
|
+
return Effect.map(Effect.all(parts, { concurrency: 1 }), (lists) => lists.flat());
|
|
152
|
+
}), Match.exhaustive);
|
|
153
|
+
};
|
|
154
|
+
const closure = (env, path, start, forward, includeStart) => Effect.suspend(() => {
|
|
155
|
+
const visited = empty();
|
|
156
|
+
if (includeStart) visited.set(start.key, start);
|
|
157
|
+
const expanded = emptySet();
|
|
158
|
+
/** Expands the frontier's unexpanded nodes, then the nodes they newly reach. */
|
|
159
|
+
const expand = (frontier) => {
|
|
160
|
+
if (Arr.isReadonlyArrayEmpty(frontier)) return Effect.void;
|
|
161
|
+
const next = [];
|
|
162
|
+
const unexpanded = frontier.filter((n) => {
|
|
163
|
+
if (expanded.has(n.key)) return false;
|
|
164
|
+
expanded.set(n.key, true);
|
|
165
|
+
return true;
|
|
166
|
+
});
|
|
167
|
+
return Effect.forEach(unexpanded, (n) => Effect.map(pathFrom(env, path, n, forward), (reached) => reached.forEach((m) => {
|
|
168
|
+
if (!visited.has(m.key)) {
|
|
169
|
+
visited.set(m.key, m);
|
|
170
|
+
next.push(m);
|
|
171
|
+
}
|
|
172
|
+
})), {
|
|
173
|
+
concurrency: 1,
|
|
174
|
+
discard: true
|
|
175
|
+
}).pipe(Effect.flatMap(() => expand(next)));
|
|
176
|
+
};
|
|
177
|
+
return Effect.map(expand([start]), () => Array.from(visited.values()));
|
|
178
|
+
});
|
|
179
|
+
/** All nodes (subjects and objects) of the active graph. */
|
|
180
|
+
const allNodes = (env) => Effect.map(collect(env, {}), (qs) => distinctTerms(qs.flatMap((q) => [q.subject, q.object])));
|
|
181
|
+
const pathAll = (env, path) => {
|
|
182
|
+
return Match.value(path).pipe(Match.tag("PathLink", (link) => Effect.map(collect(env, { predicate: link.iri }), (qs) => qs.map((q) => [q.subject, q.object]))), Match.tag("PathInverse", (inv) => Effect.map(pathAll(env, inv.path), (ps) => ps.map(([a, b]) => [b, a]))), Match.tag("PathSequence", (seq) => {
|
|
183
|
+
const [first, ...rest] = seq.paths;
|
|
184
|
+
if (first === void 0) return Effect.succeed([]);
|
|
185
|
+
return Effect.flatMap(pathAll(env, first), (pairs) => forEachFlat(pairs, ([x, m]) => Effect.map(Arr.isReadonlyArrayEmpty(rest) ? Effect.succeed([m]) : pathFrom(env, {
|
|
186
|
+
_tag: "PathSequence",
|
|
187
|
+
paths: rest
|
|
188
|
+
}, m, true), (ys) => ys.map((y) => [x, y]))));
|
|
189
|
+
}), Match.tag("PathAlternative", (alt) => forEachFlat(alt.paths, (p) => pathAll(env, p))), Match.tag("PathNegated", (neg) => {
|
|
190
|
+
const out = [];
|
|
191
|
+
if (Arr.isReadonlyArrayNonEmpty(neg.iris) || Arr.isReadonlyArrayEmpty(neg.inverse)) {
|
|
192
|
+
const ex = iriValueSet(neg.iris);
|
|
193
|
+
out.push(Effect.map(collect(env, {}), (qs) => qs.filter((q) => !ex.has(q.predicate.value)).map((q) => [q.subject, q.object])));
|
|
194
|
+
}
|
|
195
|
+
if (Arr.isReadonlyArrayNonEmpty(neg.inverse)) {
|
|
196
|
+
const ex = iriValueSet(neg.inverse);
|
|
197
|
+
out.push(Effect.map(collect(env, {}), (qs) => qs.filter((q) => !ex.has(q.predicate.value)).map((q) => [q.object, q.subject])));
|
|
198
|
+
}
|
|
199
|
+
return Effect.map(Effect.all(out, { concurrency: 1 }), (lists) => lists.flat());
|
|
200
|
+
}), Match.orElse((p) => Effect.flatMap(allNodes(env), (nodes) => forEachFlat(nodes, (n) => Effect.map(pathFrom(env, p, n, true), (ys) => ys.map((y) => [n, y]))))));
|
|
201
|
+
};
|
|
202
|
+
/** Whether a path can match with zero length. */
|
|
203
|
+
const nullable = Match.type().pipe(Match.tag("PathZeroOrMore", "PathZeroOrOne", () => true), Match.tag("PathInverse", (p) => nullable(p.path)), Match.tag("PathSequence", (p) => p.paths.every(nullable)), Match.tag("PathAlternative", (p) => p.paths.some(nullable)), Match.orElse(() => false));
|
|
204
|
+
const isGraphNode = (env, term) => Effect.map(Effect.all([Stream.runHead(matchQuads(env, { subject: term })), Stream.runHead(matchQuads(env, { object: term }))], { concurrency: 1 }), ([a, b]) => Option.isSome(a) || Option.isSome(b));
|
|
205
|
+
const evalPath = (op, env, initial) => Stream.fromIterableEffect(Effect.gen(function* () {
|
|
206
|
+
const s = ground(op.subject, initial);
|
|
207
|
+
const o = ground(op.object, initial);
|
|
208
|
+
const out = [];
|
|
209
|
+
if (nullable(op.path)) {
|
|
210
|
+
const endpoints = [[op.subject, s], [op.object, o]];
|
|
211
|
+
const outsideGraph = yield* Effect.findFirst(endpoints, ([term, value]) => Option.isSome(value) && !isNamedNode(term) && !isLiteral(term) ? Effect.map(isGraphNode(env, value.value), (isNode) => !isNode) : Effect.succeed(false));
|
|
212
|
+
if (Option.isSome(outsideGraph)) return out;
|
|
213
|
+
}
|
|
214
|
+
const emit = (x, y) => {
|
|
215
|
+
const map = copy(initial.map);
|
|
216
|
+
if (unify(op.subject, x, map) && unify(op.object, y, map)) out.push(new Bindings(map));
|
|
217
|
+
};
|
|
218
|
+
if (Option.isSome(s)) {
|
|
219
|
+
const from = s.value;
|
|
220
|
+
(yield* pathFrom(env, op.path, from, true)).forEach((y) => emit(from, y));
|
|
221
|
+
} else if (Option.isSome(o)) {
|
|
222
|
+
const to = o.value;
|
|
223
|
+
(yield* pathFrom(env, op.path, to, false)).forEach((x) => emit(x, to));
|
|
224
|
+
} else (yield* pathAll(env, op.path)).forEach(([x, y]) => emit(x, y));
|
|
225
|
+
return out;
|
|
226
|
+
}));
|
|
227
|
+
const collectExists = Match.fn((e, _out) => e).pipe(Match.tag("Exists", (x, _e, out) => {
|
|
228
|
+
out.push(x);
|
|
229
|
+
}), Match.tag("Operation", "FunctionCall", (call, _e, out) => call.args.forEach((a) => collectExists(a, out))), Match.orElse(() => void 0));
|
|
230
|
+
/**
|
|
231
|
+
* Prepares an expression for evaluation: returns a function producing the
|
|
232
|
+
* expression context for a solution (precomputing EXISTS patterns).
|
|
233
|
+
*/
|
|
234
|
+
const prepare = (expression, env) => {
|
|
235
|
+
const nodes = [];
|
|
236
|
+
collectExists(expression, nodes);
|
|
237
|
+
if (Arr.isReadonlyArrayEmpty(nodes)) return () => Effect.succeed(env.expr);
|
|
238
|
+
return (b) => Effect.map(Effect.forEach(nodes, (n) => Effect.map(Stream.runHead(evaluate(n.input, {
|
|
239
|
+
...env,
|
|
240
|
+
context: b
|
|
241
|
+
})), Option.isSome), { concurrency: 1 }), (results) => {
|
|
242
|
+
const table = /* @__PURE__ */ new WeakMap();
|
|
243
|
+
Arr.zip(nodes, results).forEach(([n, r]) => table.set(n, r));
|
|
244
|
+
return {
|
|
245
|
+
...env.expr,
|
|
246
|
+
exists: (e) => table.get(e) ?? false
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
const filterStream = (stream, expression, env) => {
|
|
251
|
+
const ctxFor = prepare(expression, env);
|
|
252
|
+
if (!Algebra_containsExists(expression)) return Stream.filter(stream, (b) => test(expression, b, env.expr));
|
|
253
|
+
return Stream.filterEffect(stream, (b) => Effect.map(ctxFor(b), (ctx) => test(expression, b, ctx)));
|
|
254
|
+
};
|
|
255
|
+
const Algebra_containsExists = (e) => {
|
|
256
|
+
const out = [];
|
|
257
|
+
collectExists(e, out);
|
|
258
|
+
return Arr.isReadonlyArrayNonEmpty(out);
|
|
259
|
+
};
|
|
260
|
+
/** Operators that can be evaluated with an initial solution (bind join). */
|
|
261
|
+
const bindable = (op) => Predicate.isTagged(op, "Bgp") || Predicate.isTagged(op, "Path") || Predicate.isTagged(op, "Service") && isVariable(op.name) || Predicate.isTagged(op, "Join") && bindable(op.left) && bindable(op.right);
|
|
262
|
+
/**
|
|
263
|
+
* Evaluates a bindable operator with an initial solution. Plain branches
|
|
264
|
+
* rather than `Match`: a bind join runs it once per solution of its left
|
|
265
|
+
* side.
|
|
266
|
+
*/
|
|
267
|
+
const evalWith = (op, env, initial) => {
|
|
268
|
+
if (Predicate.isTagged(op, "Bgp")) return evalBgp(op.patterns, env, initial);
|
|
269
|
+
if (Predicate.isTagged(op, "Path")) return evalPath(op, env, initial);
|
|
270
|
+
if (Predicate.isTagged(op, "Join")) return Stream.flatMap(evalWith(op.left, env, initial), (b) => evalWith(op.right, env, b));
|
|
271
|
+
if (Predicate.isTagged(op, "Service")) return evalBoundService(op, env, initial);
|
|
272
|
+
return Stream.die(new Cause.IllegalArgumentError("not bindable"));
|
|
273
|
+
};
|
|
274
|
+
const isUnit = (op) => Predicate.isTagged(op, "Bgp") && Arr.isReadonlyArrayEmpty(op.patterns);
|
|
275
|
+
/** An index of solutions by the values of the variables bound in all of them. */
|
|
276
|
+
/** The index key of a solution: its terms for `vars`, all of which it binds. */
|
|
277
|
+
const indexKey = (sig, vars, b) => `${sig}#${vars.map((v) => b.map.get(v)?.key ?? "").join("")}`;
|
|
278
|
+
var SolutionIndex = class {
|
|
279
|
+
keyVars;
|
|
280
|
+
buckets = empty();
|
|
281
|
+
all;
|
|
282
|
+
constructor(solutions) {
|
|
283
|
+
this.all = solutions;
|
|
284
|
+
const first = solutions[0];
|
|
285
|
+
this.keyVars = first === void 0 ? [] : Array.from(first.map.keys()).filter((v) => solutions.every((s) => s.map.has(v)));
|
|
286
|
+
}
|
|
287
|
+
candidates(b) {
|
|
288
|
+
const vars = this.keyVars.filter((v) => b.map.has(v));
|
|
289
|
+
if (Arr.isReadonlyArrayEmpty(vars)) return this.all;
|
|
290
|
+
const sig = vars.join("|");
|
|
291
|
+
const built = `${sig}#__built`;
|
|
292
|
+
if (!this.buckets.has(built)) {
|
|
293
|
+
this.buckets.set(built, []);
|
|
294
|
+
this.all.forEach((s) => {
|
|
295
|
+
const k = indexKey(sig, vars, s);
|
|
296
|
+
const list = this.buckets.get(k);
|
|
297
|
+
if (list === void 0) this.buckets.set(k, [s]);
|
|
298
|
+
else list.push(s);
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
return this.buckets.get(indexKey(sig, vars, b)) ?? [];
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
const materialize = (op, env) => Stream.runCollect(evaluate(op, env));
|
|
305
|
+
const evalJoin = (op, env) => {
|
|
306
|
+
if (isUnit(op.left)) return bindable(op.right) ? evalWith(op.right, env, env.context) : joinWith(Stream.succeed(env.context), op.right, env);
|
|
307
|
+
if (bindable(op.right)) return Stream.flatMap(evaluate(op.left, env), (b) => evalWith(op.right, env, b));
|
|
308
|
+
return joinWith(evaluate(op.left, env), op.right, env);
|
|
309
|
+
};
|
|
310
|
+
const joinWith = (left, right, env) => Stream.unwrap(Effect.map(materialize(right, env), (rs) => {
|
|
311
|
+
const index = new SolutionIndex(rs);
|
|
312
|
+
return Stream.flatMap(left, (a) => Stream.fromIterable(index.candidates(a).flatMap((r) => {
|
|
313
|
+
const m = merge(a, r);
|
|
314
|
+
return m === void 0 ? [] : [m];
|
|
315
|
+
})));
|
|
316
|
+
}));
|
|
317
|
+
const keepAll = Effect.succeed(true);
|
|
318
|
+
/** Whether a solution passes an `OPTIONAL`'s filter. */
|
|
319
|
+
const keepWhere = (expression, env) => {
|
|
320
|
+
const ctxFor = prepare(expression, env);
|
|
321
|
+
return (b) => Effect.map(ctxFor(b), (ctx) => test(expression, b, ctx));
|
|
322
|
+
};
|
|
323
|
+
const evalLeftJoin = (op, env) => {
|
|
324
|
+
const left = isUnit(op.left) ? Stream.succeed(env.context) : evaluate(op.left, env);
|
|
325
|
+
const expression = op.expression;
|
|
326
|
+
const keep = expression === void 0 ? () => keepAll : keepWhere(expression, env);
|
|
327
|
+
const extend = (a, matches) => Effect.map(Effect.filter(matches, keep), (kept) => Arr.isReadonlyArrayNonEmpty(kept) ? kept : [a]);
|
|
328
|
+
if (bindable(op.right)) return Stream.flatMap(left, (a) => Stream.fromIterableEffect(Effect.flatMap(Stream.runCollect(evalWith(op.right, env, a)), (ms) => extend(a, ms))));
|
|
329
|
+
return Stream.unwrap(Effect.map(materialize(op.right, env), (rs) => {
|
|
330
|
+
const index = new SolutionIndex(rs);
|
|
331
|
+
return Stream.flatMap(left, (a) => {
|
|
332
|
+
const merged = index.candidates(a).flatMap((r) => {
|
|
333
|
+
const m = merge(a, r);
|
|
334
|
+
return m === void 0 ? [] : [m];
|
|
335
|
+
});
|
|
336
|
+
return Stream.fromIterableEffect(extend(a, merged));
|
|
337
|
+
});
|
|
338
|
+
}));
|
|
339
|
+
};
|
|
340
|
+
const evalMinus = (op, env) => Stream.unwrap(Effect.map(materialize(op.right, env), (rs) => Stream.filter(isUnit(op.left) ? Stream.succeed(env.context) : evaluate(op.left, env), (a) => !rs.some((r) => sharesVariable(a, r) && compatible(a, r)))));
|
|
341
|
+
const namedGraphs = (env) => env.dataset.namedGraphs === "all" ? Stream.runCollect(env.store.graphs) : Effect.succeed(env.dataset.namedGraphs);
|
|
342
|
+
const evalGraph = (op, env) => {
|
|
343
|
+
const name = op.name;
|
|
344
|
+
if (isNamedNode(name)) return Stream.unwrap(Effect.map(namedGraphs(env), (graphs) => graphs.some((g) => g.key === name.key) ? evaluate(op.input, {
|
|
345
|
+
...env,
|
|
346
|
+
graph: {
|
|
347
|
+
_tag: "NamedGraph",
|
|
348
|
+
graph: name
|
|
349
|
+
}
|
|
350
|
+
}) : Stream.empty));
|
|
351
|
+
const variable = name.value;
|
|
352
|
+
return Stream.unwrap(Effect.map(namedGraphs(env), (graphs) => concatAll(graphs.map((g) => evaluate(op.input, {
|
|
353
|
+
...env,
|
|
354
|
+
graph: {
|
|
355
|
+
_tag: "NamedGraph",
|
|
356
|
+
graph: g
|
|
357
|
+
}
|
|
358
|
+
}).pipe(Stream.filterMap((b) => {
|
|
359
|
+
const m = merge(b, new Bindings(fromEntries([[variable, g]])));
|
|
360
|
+
return m === void 0 ? Result.fail(void 0) : Result.succeed(m);
|
|
361
|
+
}))))));
|
|
362
|
+
};
|
|
363
|
+
const integerLiteral = (n) => new Literal(String(n), dt.integer);
|
|
364
|
+
/** An aggregate over a group's members; `None` leaves it unbound. */
|
|
365
|
+
const aggregateValue = (agg, members, env) => {
|
|
366
|
+
if (agg.expression === "*") {
|
|
367
|
+
if (agg.name !== "COUNT") return Option.none();
|
|
368
|
+
const n = agg.distinct ? setOf(members.map((m) => m.key)).size : members.length;
|
|
369
|
+
return Option.some(integerLiteral(n));
|
|
370
|
+
}
|
|
371
|
+
const expr = agg.expression;
|
|
372
|
+
const evaluated = members.map((m) => Option.fromUndefinedOr(evaluateOrUndefined(expr, m, env.expr)));
|
|
373
|
+
const seen = emptySet();
|
|
374
|
+
const values = agg.distinct ? evaluated.filter((v) => {
|
|
375
|
+
const k = Option.isNone(v) ? "" : v.value.key;
|
|
376
|
+
if (seen.has(k)) return false;
|
|
377
|
+
seen.set(k, true);
|
|
378
|
+
return true;
|
|
379
|
+
}) : evaluated;
|
|
380
|
+
const defined = Arr.getSomes(values);
|
|
381
|
+
return Option.flatten(Result.getSuccess(catchEvalFailure(() => aggregateOf(agg, values.length, defined))));
|
|
382
|
+
};
|
|
383
|
+
const sum = (values) => values.reduce((acc, v) => arithmetic("+", acc, v), integerLiteral(0));
|
|
384
|
+
/**
|
|
385
|
+
* An aggregate of the values that evaluated (`defined`, of `count`
|
|
386
|
+
* members); `None` leaves it unbound.
|
|
387
|
+
*/
|
|
388
|
+
const aggregateOf = (agg, count, defined) => {
|
|
389
|
+
const complete = defined.length === count;
|
|
390
|
+
return Match.value(agg.name).pipe(Match.when("COUNT", () => Option.some(integerLiteral(defined.length))), Match.when("SUM", () => complete ? Option.some(sum(defined)) : Option.none()), Match.when("AVG", () => {
|
|
391
|
+
if (!complete) return Option.none();
|
|
392
|
+
if (Arr.isReadonlyArrayEmpty(defined)) return Option.some(integerLiteral(0));
|
|
393
|
+
return Option.some(arithmetic("/", sum(defined), integerLiteral(defined.length)));
|
|
394
|
+
}), Match.when(Match.is("MIN", "MAX"), (name) => Option.map(Arr.head(defined), (first) => defined.slice(1).reduce((best, v) => {
|
|
395
|
+
const c = compareTerms(v, best);
|
|
396
|
+
return (name === "MIN" ? c < 0 : c > 0) ? v : best;
|
|
397
|
+
}, first))), Match.when("SAMPLE", () => Arr.head(defined)), Match.when("GROUP_CONCAT", () => {
|
|
398
|
+
if (!complete) return Option.none();
|
|
399
|
+
const lits = defined.map((v) => isLiteral(v) ? v : fail("Not a literal"));
|
|
400
|
+
const sep = agg.separator ?? " ";
|
|
401
|
+
return Option.some(simple(lits.map((l) => l.value).join(sep)));
|
|
402
|
+
}), Match.exhaustive);
|
|
403
|
+
};
|
|
404
|
+
/** Evaluates an expression per solution; `None` on errors. */
|
|
405
|
+
const evaluateOption = (expression, b, ctx) => Option.fromUndefinedOr(evaluateOrUndefined(expression, b, ctx));
|
|
406
|
+
const evalGroup = (op, env) => Stream.fromIterableEffect(Effect.map(materialize(op.input, env), (solutions) => {
|
|
407
|
+
const groups = empty();
|
|
408
|
+
solutions.forEach((s) => {
|
|
409
|
+
const keys = op.keys.map((k) => evaluateOption(k.expression, s, env.expr));
|
|
410
|
+
const id = keys.map((k) => Option.isNone(k) ? "" : k.value.key).join("");
|
|
411
|
+
const g = groups.get(id);
|
|
412
|
+
if (g === void 0) groups.set(id, {
|
|
413
|
+
keys,
|
|
414
|
+
members: [s]
|
|
415
|
+
});
|
|
416
|
+
else g.members.push(s);
|
|
417
|
+
});
|
|
418
|
+
if (groups.size === 0 && Arr.isReadonlyArrayEmpty(op.keys)) groups.set("", {
|
|
419
|
+
keys: [],
|
|
420
|
+
members: []
|
|
421
|
+
});
|
|
422
|
+
return Array.from(groups.values(), (g) => {
|
|
423
|
+
const map = empty();
|
|
424
|
+
Arr.zip(op.keys, g.keys).forEach(([k, v]) => {
|
|
425
|
+
if (Option.isSome(v)) map.set(k.variable.value, v.value);
|
|
426
|
+
});
|
|
427
|
+
op.aggregates.forEach((a) => {
|
|
428
|
+
const v = aggregateValue(a.aggregate, g.members, env);
|
|
429
|
+
if (Option.isSome(v)) map.set(a.variable.value, v.value);
|
|
430
|
+
});
|
|
431
|
+
return new Bindings(map);
|
|
432
|
+
});
|
|
433
|
+
}));
|
|
434
|
+
const unbound = Option.none();
|
|
435
|
+
const evalOrderBy = (op, env) => Stream.fromIterableEffect(Effect.map(materialize(op.input, env), (solutions) => {
|
|
436
|
+
const keyed = solutions.map((s) => ({
|
|
437
|
+
s,
|
|
438
|
+
keys: op.conditions.map((c) => evaluateOption(c.expression, s, env.expr))
|
|
439
|
+
}));
|
|
440
|
+
const byConditions = Order.make((a, b) => {
|
|
441
|
+
let order = 0;
|
|
442
|
+
op.conditions.some((condition, i) => {
|
|
443
|
+
const c = orderCompare(a.keys[i] ?? unbound, b.keys[i] ?? unbound);
|
|
444
|
+
if (c === 0) return false;
|
|
445
|
+
order = c < 0 === condition.descending ? 1 : -1;
|
|
446
|
+
return true;
|
|
447
|
+
});
|
|
448
|
+
return order;
|
|
449
|
+
});
|
|
450
|
+
return Arr.sort(keyed, byConditions).map((k) => k.s);
|
|
451
|
+
}));
|
|
452
|
+
const evalExtend = (op, env) => {
|
|
453
|
+
const name = op.variable.value;
|
|
454
|
+
const ctxFor = prepare(op.expression, env);
|
|
455
|
+
const input = isUnit(op.input) ? Stream.succeed(env.context) : evaluate(op.input, env);
|
|
456
|
+
return Stream.mapEffect(input, (b) => Effect.map(ctxFor(b), (ctx) => {
|
|
457
|
+
if (b.map.has(name)) return b;
|
|
458
|
+
const v = evaluateOrUndefined(op.expression, b, ctx);
|
|
459
|
+
return v === void 0 ? b : set(b, name, v);
|
|
460
|
+
}));
|
|
461
|
+
};
|
|
462
|
+
const runService = (op, env, endpoint) => {
|
|
463
|
+
const handler = env.service;
|
|
464
|
+
const stream = Option.isNone(handler) ? Stream.fail(new EvaluationError({ message: `SERVICE <${endpoint.value}> is not supported` })) : handler.value(endpoint, op, env);
|
|
465
|
+
return op.silent ? Stream.catchCause(stream, () => Stream.succeed(empty$1)) : stream;
|
|
466
|
+
};
|
|
467
|
+
const evalService = (op, env) => {
|
|
468
|
+
const name = op.name;
|
|
469
|
+
if (isVariable(name)) return Stream.fail(new EvaluationError({ message: `SERVICE ?${name.value} needs the endpoint variable to be bound first` }));
|
|
470
|
+
return runService(op, env, name);
|
|
471
|
+
};
|
|
472
|
+
/**
|
|
473
|
+
* `SERVICE ?endpoint { … }` with `?endpoint` bound by an earlier pattern:
|
|
474
|
+
* the remote pattern is evaluated at the bound endpoint and joined with the
|
|
475
|
+
* solution.
|
|
476
|
+
*/
|
|
477
|
+
const mergeWith = (initial, solutions) => Stream.flatMap(solutions, (b) => {
|
|
478
|
+
const m = merge(initial, b);
|
|
479
|
+
return m === void 0 ? Stream.empty : Stream.succeed(m);
|
|
480
|
+
});
|
|
481
|
+
const evalBoundService = (op, env, initial) => {
|
|
482
|
+
const name = op.name;
|
|
483
|
+
if (isNamedNode(name)) return mergeWith(initial, runService(op, env, name));
|
|
484
|
+
const endpoint = initial.map.get(name.value);
|
|
485
|
+
if (!isNamedNode(endpoint)) return op.silent ? Stream.succeed(initial) : Stream.fail(new EvaluationError({ message: `SERVICE ?${name.value} is not bound to an IRI` }));
|
|
486
|
+
return mergeWith(initial, runService(op, env, endpoint));
|
|
487
|
+
};
|
|
488
|
+
/** Evaluates an algebra operator, offering it to the store's query capability first. */
|
|
489
|
+
const evaluate = (op, env) => {
|
|
490
|
+
const capability = env.store.query;
|
|
491
|
+
if (capability !== void 0 && env.context.size === 0) {
|
|
492
|
+
const native = capability.evaluate(op, {
|
|
493
|
+
dataset: env.dataset,
|
|
494
|
+
activeGraph: env.graph,
|
|
495
|
+
evaluate: (o, g) => evaluate(o, g === void 0 ? env : {
|
|
496
|
+
...env,
|
|
497
|
+
graph: g
|
|
498
|
+
})
|
|
499
|
+
});
|
|
500
|
+
if (Option.isSome(native)) return native.value;
|
|
501
|
+
}
|
|
502
|
+
return evaluateGeneric(op, env);
|
|
503
|
+
};
|
|
504
|
+
const evalDistinct = (op, env) => Stream.suspend(() => {
|
|
505
|
+
const seen = emptySet();
|
|
506
|
+
return Stream.filter(evaluate(op.input, env), (b) => {
|
|
507
|
+
const k = b.key;
|
|
508
|
+
if (seen.has(k)) return false;
|
|
509
|
+
seen.set(k, true);
|
|
510
|
+
return true;
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
const evalSlice = (op, env) => {
|
|
514
|
+
const input = evaluate(op.input, env);
|
|
515
|
+
const dropped = op.offset > 0 ? Stream.drop(input, op.offset) : input;
|
|
516
|
+
return op.limit !== void 0 ? Stream.take(dropped, op.limit) : dropped;
|
|
517
|
+
};
|
|
518
|
+
/**
|
|
519
|
+
* Evaluates an operator by its kind. Plain branches rather than `Match`:
|
|
520
|
+
* `EXISTS` patterns and bind joins run it once per solution.
|
|
521
|
+
*/
|
|
522
|
+
const evaluateGeneric = (op, env) => {
|
|
523
|
+
if (Predicate.isTagged(op, "Bgp")) return evalBgp(op.patterns, env, Arr.isReadonlyArrayEmpty(op.patterns) ? env.context : empty$1);
|
|
524
|
+
if (Predicate.isTagged(op, "Join")) return evalJoin(op, env);
|
|
525
|
+
if (Predicate.isTagged(op, "Filter")) return filterStream(evaluate(op.input, env), op.expression, env);
|
|
526
|
+
if (Predicate.isTagged(op, "Project")) {
|
|
527
|
+
const names = op.variables.map((v) => v.value);
|
|
528
|
+
return Stream.map(evaluate(op.input, env), (b) => project(b, names));
|
|
529
|
+
}
|
|
530
|
+
if (Predicate.isTagged(op, "LeftJoin")) return evalLeftJoin(op, env);
|
|
531
|
+
if (Predicate.isTagged(op, "Union")) return Stream.concat(evaluate(op.left, env), evaluate(op.right, env));
|
|
532
|
+
if (Predicate.isTagged(op, "Extend")) return evalExtend(op, env);
|
|
533
|
+
if (Predicate.isTagged(op, "Path")) return evalPath(op, env, empty$1);
|
|
534
|
+
if (Predicate.isTagged(op, "Graph")) return evalGraph(op, env);
|
|
535
|
+
if (Predicate.isTagged(op, "Minus")) return evalMinus(op, env);
|
|
536
|
+
if (Predicate.isTagged(op, "Group")) return evalGroup(op, env);
|
|
537
|
+
if (Predicate.isTagged(op, "OrderBy")) return evalOrderBy(op, env);
|
|
538
|
+
if (Predicate.isTagged(op, "Distinct") || Predicate.isTagged(op, "Reduced")) return evalDistinct(op, env);
|
|
539
|
+
if (Predicate.isTagged(op, "Slice")) return evalSlice(op, env);
|
|
540
|
+
if (Predicate.isTagged(op, "Values")) return Stream.fromIterable(op.bindings);
|
|
541
|
+
return evalService(op, env);
|
|
542
|
+
};
|
|
543
|
+
// src/sparql/Engine.ts
|
|
544
|
+
/**
|
|
545
|
+
* The SPARQL engine service: parses, translates, optimises and evaluates
|
|
546
|
+
* queries and updates against the `QuadStore` service.
|
|
547
|
+
*
|
|
548
|
+
* Query evaluation is streaming: `SELECT` results are a lazy `Stream` of
|
|
549
|
+
* solutions, `CONSTRUCT`/`DESCRIBE` a lazy stream of triples, and `ASK`
|
|
550
|
+
* stops at the first solution. Operators that need all solutions
|
|
551
|
+
* (`ORDER BY`, `GROUP BY`, the right side of joins) materialise as needed.
|
|
552
|
+
*
|
|
553
|
+
* @since 0.1.0
|
|
554
|
+
*/
|
|
555
|
+
var Engine_exports = /* @__PURE__ */ __exportAll({
|
|
556
|
+
SparqlEngine: () => SparqlEngine,
|
|
557
|
+
layer: () => layer,
|
|
558
|
+
layerMemory: () => layerMemory,
|
|
559
|
+
make: () => make
|
|
560
|
+
});
|
|
561
|
+
/**
|
|
562
|
+
* The SPARQL engine service.
|
|
563
|
+
*
|
|
564
|
+
* @since 0.1.0
|
|
565
|
+
* @category services
|
|
566
|
+
*/
|
|
567
|
+
var SparqlEngine = class extends Context.Service()("@thomasfosterau/effect-rdf/sparql/SparqlEngine") {};
|
|
568
|
+
/**
|
|
569
|
+
* A template term instantiated for a solution; `None` where a variable is
|
|
570
|
+
* unbound or a triple term would be ill-formed. Plain branches rather than
|
|
571
|
+
* `Match`: it runs for every template term per solution.
|
|
572
|
+
*/
|
|
573
|
+
const groundTemplateTerm = (t, b, bnodes) => {
|
|
574
|
+
if (isVariable(t)) return Option.fromUndefinedOr(b.map.get(t.value));
|
|
575
|
+
if (isBlankNode(t)) {
|
|
576
|
+
const existing = bnodes.get(t.value);
|
|
577
|
+
if (existing !== void 0) return Option.some(existing);
|
|
578
|
+
const n = blankNode();
|
|
579
|
+
bnodes.set(t.value, n);
|
|
580
|
+
return Option.some(n);
|
|
581
|
+
}
|
|
582
|
+
if (isTriple(t)) return Option.map(groundTriple(t.subject, t.predicate, t.object, b, bnodes), ([s, p, o]) => triple(s, p, o));
|
|
583
|
+
return Option.some(t);
|
|
584
|
+
};
|
|
585
|
+
/** The instantiated subject, predicate and object, if they form a well-formed triple. */
|
|
586
|
+
const groundTriple = (subject, predicate, object, b, bnodes) => {
|
|
587
|
+
const s = groundTemplateTerm(subject, b, bnodes);
|
|
588
|
+
const p = groundTemplateTerm(predicate, b, bnodes);
|
|
589
|
+
const o = groundTemplateTerm(object, b, bnodes);
|
|
590
|
+
if (Option.isNone(s) || Option.isNone(p) || Option.isNone(o)) return Option.none();
|
|
591
|
+
const [sv, pv, ov] = [
|
|
592
|
+
s.value,
|
|
593
|
+
p.value,
|
|
594
|
+
o.value
|
|
595
|
+
];
|
|
596
|
+
return isSubject(sv) && isNamedNode(pv) && isObject(ov) ? Option.some([
|
|
597
|
+
sv,
|
|
598
|
+
pv,
|
|
599
|
+
ov
|
|
600
|
+
]) : Option.none();
|
|
601
|
+
};
|
|
602
|
+
/** The graph of a template quad for a solution: an IRI or the default graph. */
|
|
603
|
+
const groundGraph = (t, b, bnodes, defaultGraph) => {
|
|
604
|
+
if (isDefaultGraph(t.graph)) return Option.some(defaultGraph);
|
|
605
|
+
const g = groundTemplateTerm(t.graph, b, bnodes);
|
|
606
|
+
return Option.isSome(g) && (isNamedNode(g.value) || isDefaultGraph(g.value)) ? Option.some(g.value) : Option.none();
|
|
607
|
+
};
|
|
608
|
+
const instantiate = (template, b, defaultGraph) => {
|
|
609
|
+
const bnodes = empty();
|
|
610
|
+
return Arr.filterMap(template, (t) => {
|
|
611
|
+
const triple = groundTriple(t.subject, t.predicate, t.object, b, bnodes);
|
|
612
|
+
const g = groundGraph(t, b, bnodes, defaultGraph);
|
|
613
|
+
if (Option.isNone(triple) || Option.isNone(g)) return Result.failVoid;
|
|
614
|
+
const [s, p, o] = triple.value;
|
|
615
|
+
return Result.succeed(new Quad(s, p, o, g.value));
|
|
616
|
+
});
|
|
617
|
+
};
|
|
618
|
+
/** The options of a request that gave none. */
|
|
619
|
+
const noRequest = {};
|
|
620
|
+
const prebind = (op, request) => request.bindings === void 0 ? op : prebind$1(op, request.bindings);
|
|
621
|
+
const dedupeQuads = (quads) => Stream.suspend(() => {
|
|
622
|
+
const seen = emptySet();
|
|
623
|
+
return Stream.filter(quads, (q) => {
|
|
624
|
+
const k = q.key;
|
|
625
|
+
if (seen.has(k)) return false;
|
|
626
|
+
seen.set(k, true);
|
|
627
|
+
return true;
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
const describeResources = (terms, solutions, env) => {
|
|
631
|
+
const constants = terms.filter(isNamedNode);
|
|
632
|
+
const vars = terms.filter(isVariable);
|
|
633
|
+
const resources = Stream.concat(Stream.fromIterable(constants), Arr.isReadonlyArrayEmpty(vars) ? Stream.empty : Stream.flatMap(solutions, (b) => Stream.fromIterable(vars.flatMap((v) => {
|
|
634
|
+
const t = b.map.get(v.value);
|
|
635
|
+
return t === void 0 ? [] : [t];
|
|
636
|
+
}))));
|
|
637
|
+
const cbd = (resource, seen) => Stream.flatMap(matchQuads(env, { subject: resource }), (q) => {
|
|
638
|
+
const quad = new Quad(q.subject, q.predicate, q.object, defaultGraph);
|
|
639
|
+
const object = q.object;
|
|
640
|
+
if (isBlankNode(object) && !seen.has(object.key)) {
|
|
641
|
+
seen.set(object.key, true);
|
|
642
|
+
return Stream.concat(Stream.succeed(quad), cbd(object, seen));
|
|
643
|
+
}
|
|
644
|
+
return Stream.succeed(quad);
|
|
645
|
+
});
|
|
646
|
+
return dedupeQuads(Stream.suspend(() => {
|
|
647
|
+
const described = emptySet();
|
|
648
|
+
return Stream.flatMap(resources, (r) => {
|
|
649
|
+
if (described.has(r.key)) return Stream.empty;
|
|
650
|
+
described.set(r.key, true);
|
|
651
|
+
return cbd(r, setOf([r.key]));
|
|
652
|
+
});
|
|
653
|
+
}));
|
|
654
|
+
};
|
|
655
|
+
const updateFailed = (message) => Effect.fail(new UpdateError({ message }));
|
|
656
|
+
const freshBlankNodes = (quads) => {
|
|
657
|
+
const map = empty();
|
|
658
|
+
return quads.map((q) => mapTerms(q, (t) => {
|
|
659
|
+
if (!isBlankNode(t)) return t;
|
|
660
|
+
const existing = map.get(t.value);
|
|
661
|
+
if (existing !== void 0) return existing;
|
|
662
|
+
const n = blankNode();
|
|
663
|
+
map.set(t.value, n);
|
|
664
|
+
return n;
|
|
665
|
+
}));
|
|
666
|
+
};
|
|
667
|
+
const quadPatternsToAlgebra = (patterns) => {
|
|
668
|
+
const byGraph = empty();
|
|
669
|
+
patterns.forEach((p) => {
|
|
670
|
+
const triple = {
|
|
671
|
+
_tag: "TriplePattern",
|
|
672
|
+
subject: p.subject,
|
|
673
|
+
predicate: p.predicate,
|
|
674
|
+
object: p.object
|
|
675
|
+
};
|
|
676
|
+
const entry = byGraph.get(p.graph.key);
|
|
677
|
+
if (entry === void 0) byGraph.set(p.graph.key, {
|
|
678
|
+
graph: p.graph,
|
|
679
|
+
triples: [triple]
|
|
680
|
+
});
|
|
681
|
+
else entry.triples.push(triple);
|
|
682
|
+
});
|
|
683
|
+
const parts = Array.from(byGraph.values()).map(({ graph, triples }) => isDefaultGraph(graph) ? bgp(triples) : {
|
|
684
|
+
_tag: "Graph",
|
|
685
|
+
name: graph,
|
|
686
|
+
input: bgp(triples)
|
|
687
|
+
});
|
|
688
|
+
return Arr.isReadonlyArrayEmpty(parts) ? unit : parts.reduce((a, b) => join(a, b));
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Creates the engine over a quad store.
|
|
692
|
+
*
|
|
693
|
+
* @since 0.1.0
|
|
694
|
+
* @category constructors
|
|
695
|
+
*/
|
|
696
|
+
const make = (store, options = {}) => {
|
|
697
|
+
const defaultDataset = {
|
|
698
|
+
defaultGraph: options.unionDefaultGraph === true ? "union" : "default",
|
|
699
|
+
namedGraphs: "all"
|
|
700
|
+
};
|
|
701
|
+
const datasetFor = (clause, request) => Option.isSome(clause) ? {
|
|
702
|
+
defaultGraph: clause.value.default,
|
|
703
|
+
namedGraphs: clause.value.named
|
|
704
|
+
} : request.dataset ?? defaultDataset;
|
|
705
|
+
const service = Option.map(Option.fromUndefinedOr(options.service), (handler) => (endpoint, op) => handler(endpoint, op));
|
|
706
|
+
const makeEnv = (dataset, baseIri) => ({
|
|
707
|
+
store,
|
|
708
|
+
dataset,
|
|
709
|
+
graph: { _tag: "DefaultGraph" },
|
|
710
|
+
context: empty$1,
|
|
711
|
+
expr: makeContext({
|
|
712
|
+
baseIri: Option.getOrUndefined(baseIri),
|
|
713
|
+
functions: options.functions
|
|
714
|
+
}),
|
|
715
|
+
service
|
|
716
|
+
});
|
|
717
|
+
/** The base IRI of a request: its prologue's, the request's or the engine's. */
|
|
718
|
+
const baseIriFor = (request, prologue) => Option.fromUndefinedOr(prologue?.base ?? request.baseIri ?? options.baseIri);
|
|
719
|
+
const parseQuery$1 = (query, request) => Predicate.isString(query) ? parseQuery(query, {
|
|
720
|
+
baseIri: request.baseIri ?? options.baseIri,
|
|
721
|
+
prefixes: request.prefixes
|
|
722
|
+
}) : Effect.succeed(query);
|
|
723
|
+
const optimize$1 = (op, env) => options.optimize === false ? Effect.succeed(op) : optimize(op, {
|
|
724
|
+
store,
|
|
725
|
+
dataset: env.dataset,
|
|
726
|
+
graph: env.graph
|
|
727
|
+
});
|
|
728
|
+
const run = (query, request) => Effect.gen(function* () {
|
|
729
|
+
const algebra = translateQuery(query);
|
|
730
|
+
const env = makeEnv(datasetFor(Option.fromUndefinedOr(algebra.dataset), request), baseIriFor(request, query.prologue));
|
|
731
|
+
return {
|
|
732
|
+
algebra,
|
|
733
|
+
env,
|
|
734
|
+
input: yield* optimize$1(prebind(algebra.input, request), env)
|
|
735
|
+
};
|
|
736
|
+
});
|
|
737
|
+
const textAttributes = (text) => options.traceQueryText === true && Predicate.isString(text) ? { "sparql.query.text": text } : {};
|
|
738
|
+
const query = (q, request = noRequest) => Effect.gen(function* () {
|
|
739
|
+
const ast = yield* parseQuery$1(q, request);
|
|
740
|
+
const { algebra, env, input } = yield* run(ast, request);
|
|
741
|
+
yield* Effect.annotateCurrentSpan("sparql.query.form", algebra._tag);
|
|
742
|
+
const solutions = evaluate(input, env);
|
|
743
|
+
return yield* Match.value(algebra).pipe(Match.tag("Select", (s) => Effect.succeed({
|
|
744
|
+
_tag: "Select",
|
|
745
|
+
variables: s.variables,
|
|
746
|
+
bindings: solutions
|
|
747
|
+
})), Match.tag("Ask", () => Effect.map(Stream.runHead(solutions), (head) => ({
|
|
748
|
+
_tag: "Ask",
|
|
749
|
+
value: Option.isSome(head)
|
|
750
|
+
}))), Match.tag("Construct", (c) => {
|
|
751
|
+
const template = c.template.map((t) => ({
|
|
752
|
+
_tag: "QuadPattern",
|
|
753
|
+
subject: t.subject,
|
|
754
|
+
predicate: t.predicate,
|
|
755
|
+
object: t.object,
|
|
756
|
+
graph: defaultGraph
|
|
757
|
+
}));
|
|
758
|
+
return Effect.succeed({
|
|
759
|
+
_tag: "Graph",
|
|
760
|
+
quads: dedupeQuads(Stream.flatMap(solutions, (b) => Stream.fromIterable(instantiate(template, b, defaultGraph))))
|
|
761
|
+
});
|
|
762
|
+
}), Match.tag("Describe", (d) => Effect.succeed({
|
|
763
|
+
_tag: "Graph",
|
|
764
|
+
quads: describeResources(d.terms, solutions, env)
|
|
765
|
+
})), Match.exhaustive);
|
|
766
|
+
}).pipe(Effect.withSpan("SparqlEngine.query", { attributes: textAttributes(q) }));
|
|
767
|
+
const select = (q, request) => Effect.flatMap(query(q, request), (r) => Predicate.isTagged(r, "Select") ? Effect.succeed(r) : Effect.fail(new EvaluationError({ message: "Not a SELECT query" })));
|
|
768
|
+
const ask = (q, request) => Effect.flatMap(query(q, request), (r) => Predicate.isTagged(r, "Ask") ? Effect.succeed(r.value) : Effect.fail(new EvaluationError({ message: "Not an ASK query" })));
|
|
769
|
+
const construct = (q, request) => Effect.flatMap(query(q, request), (r) => Predicate.isTagged(r, "Graph") ? Effect.succeed(r.quads) : Effect.fail(new EvaluationError({ message: "Not a CONSTRUCT or DESCRIBE query" })));
|
|
770
|
+
const graphExists = (g) => isDefaultGraph(g) ? Effect.succeed(true) : store.hasGraph(g);
|
|
771
|
+
const graphQuads = (g) => Stream.runCollect(store.match({ graph: g }));
|
|
772
|
+
const clearTarget = (target, silent, drop) => Effect.gen(function* () {
|
|
773
|
+
return yield* Match.value(target).pipe(Match.tag("Default", () => store.clear(defaultGraph)), Match.tag("NamedNode", (graph) => Effect.flatMap(store.hasGraph(graph), (exists) => {
|
|
774
|
+
if (!exists) return silent ? Effect.void : updateFailed(`Graph <${graph.value}> does not exist`);
|
|
775
|
+
return drop ? store.dropGraph(graph) : store.clear(graph);
|
|
776
|
+
})), Match.tag("Named", "All", (which) => Effect.gen(function* () {
|
|
777
|
+
const graphs = yield* Stream.runCollect(store.graphs);
|
|
778
|
+
yield* Effect.forEach(graphs, (g) => drop ? store.dropGraph(g) : store.clear(g), {
|
|
779
|
+
concurrency: 1,
|
|
780
|
+
discard: true
|
|
781
|
+
});
|
|
782
|
+
if (Predicate.isTagged(which, "All")) yield* store.clear(defaultGraph);
|
|
783
|
+
})), Match.exhaustive);
|
|
784
|
+
});
|
|
785
|
+
const transfer = (op) => op.source.key === op.destination.key ? Effect.void : Effect.flatMap(graphExists(op.source), (exists) => exists ? copyGraph(op) : op.silent ? Effect.void : updateFailed(`Graph <${op.source.value}> does not exist`));
|
|
786
|
+
const copyGraph = (op) => Effect.gen(function* () {
|
|
787
|
+
const quads = yield* graphQuads(op.source);
|
|
788
|
+
const { source, destination } = op;
|
|
789
|
+
if (!Predicate.isTagged(op, "Add")) {
|
|
790
|
+
if (isDefaultGraph(destination)) yield* store.clear(defaultGraph);
|
|
791
|
+
else yield* store.dropGraph(destination);
|
|
792
|
+
}
|
|
793
|
+
if (isNamedNode(destination)) yield* store.createGraph(destination);
|
|
794
|
+
yield* store.insert(quads.map((q) => new Quad(q.subject, q.predicate, q.object, destination)));
|
|
795
|
+
if (Predicate.isTagged(op, "Move")) {
|
|
796
|
+
if (isDefaultGraph(source)) yield* store.clear(defaultGraph);
|
|
797
|
+
else yield* store.dropGraph(source);
|
|
798
|
+
}
|
|
799
|
+
});
|
|
800
|
+
const modify = (op, where, baseIri, request) => Effect.gen(function* () {
|
|
801
|
+
const dataset = op.using !== void 0 ? {
|
|
802
|
+
defaultGraph: op.using.default,
|
|
803
|
+
namedGraphs: op.using.named
|
|
804
|
+
} : op.with !== void 0 ? {
|
|
805
|
+
defaultGraph: [op.with],
|
|
806
|
+
namedGraphs: "all"
|
|
807
|
+
} : request.dataset ?? defaultDataset;
|
|
808
|
+
const env = makeEnv(dataset, baseIri);
|
|
809
|
+
const input = yield* optimize$1(prebind(where, request), env);
|
|
810
|
+
const solutions = yield* Stream.runCollect(evaluate(input, env));
|
|
811
|
+
const target = op.with ?? defaultGraph;
|
|
812
|
+
const deletes = solutions.flatMap((b) => instantiate(op.delete, b, target));
|
|
813
|
+
const inserts = solutions.flatMap((b) => instantiate(op.insert, b, target));
|
|
814
|
+
yield* store.delete(deletes);
|
|
815
|
+
yield* store.insert(inserts);
|
|
816
|
+
});
|
|
817
|
+
const executeOperation = (op, baseIri, request) => {
|
|
818
|
+
return Match.value(op).pipe(Match.tag("InsertData", (o) => store.insert(freshBlankNodes(o.quads))), Match.tag("DeleteData", (o) => store.delete(o.quads)), Match.tag("DeleteWhere", (o) => modify({
|
|
819
|
+
_tag: "Modify",
|
|
820
|
+
delete: o.patterns,
|
|
821
|
+
insert: [],
|
|
822
|
+
where: {
|
|
823
|
+
_tag: "Group",
|
|
824
|
+
patterns: []
|
|
825
|
+
}
|
|
826
|
+
}, quadPatternsToAlgebra(o.patterns), baseIri, request)), Match.tag("Modify", (o) => modify(o, translatePattern(o.where), baseIri, request)), Match.tag("Load", (o) => {
|
|
827
|
+
const loader = options.load;
|
|
828
|
+
if (loader === void 0) return o.silent ? Effect.void : updateFailed("LOAD is not supported (no loader configured)");
|
|
829
|
+
const destination = o.destination ?? defaultGraph;
|
|
830
|
+
const load = Effect.flatMap(loader(o.source), (quads) => store.insert(Array.from(quads, (q) => new Quad(q.subject, q.predicate, q.object, destination))));
|
|
831
|
+
return o.silent ? Effect.ignore(load) : load;
|
|
832
|
+
}), Match.tag("Clear", (o) => clearTarget(o.target, o.silent, false)), Match.tag("Drop", (o) => clearTarget(o.target, o.silent, true)), Match.tag("Create", (o) => Effect.flatMap(store.hasGraph(o.graph), (exists) => exists ? o.silent ? Effect.void : updateFailed(`Graph <${o.graph.value}> already exists`) : store.createGraph(o.graph))), Match.tag("Add", "Move", "Copy", (o) => transfer(o)), Match.exhaustive);
|
|
833
|
+
};
|
|
834
|
+
const update = (u, request = noRequest) => Effect.gen(function* () {
|
|
835
|
+
const ast = Predicate.isString(u) ? yield* parseUpdate(u, {
|
|
836
|
+
baseIri: request.baseIri ?? options.baseIri,
|
|
837
|
+
prefixes: request.prefixes
|
|
838
|
+
}) : u;
|
|
839
|
+
const baseIri = baseIriFor(request, ast.prologue);
|
|
840
|
+
yield* Effect.annotateCurrentSpan("sparql.update.operations", ast.operations.length);
|
|
841
|
+
yield* store.transaction(Effect.forEach(ast.operations, (op) => executeOperation(op, baseIri, request), {
|
|
842
|
+
concurrency: 1,
|
|
843
|
+
discard: true
|
|
844
|
+
}));
|
|
845
|
+
}).pipe(Effect.withSpan("SparqlEngine.update", { attributes: textAttributes(u) }));
|
|
846
|
+
const evaluate$1 = (op, request = noRequest) => evaluate(prebind(op, request), makeEnv(request.dataset ?? defaultDataset, baseIriFor(request)));
|
|
847
|
+
return {
|
|
848
|
+
query,
|
|
849
|
+
select,
|
|
850
|
+
ask,
|
|
851
|
+
construct,
|
|
852
|
+
update,
|
|
853
|
+
evaluate: evaluate$1
|
|
854
|
+
};
|
|
855
|
+
};
|
|
856
|
+
/**
|
|
857
|
+
* A layer providing the engine over the `QuadStore` service.
|
|
858
|
+
*
|
|
859
|
+
* @since 0.1.0
|
|
860
|
+
* @category layers
|
|
861
|
+
*/
|
|
862
|
+
const layer = (options) => Layer.effect(SparqlEngine, Effect.map(Effect.service(QuadStore), (store) => make(store, options)));
|
|
863
|
+
/**
|
|
864
|
+
* A layer providing the engine together with an in-memory store.
|
|
865
|
+
*
|
|
866
|
+
* @since 0.1.0
|
|
867
|
+
* @category layers
|
|
868
|
+
*/
|
|
869
|
+
const layerMemory = (options) => layer(options).pipe(Layer.provideMerge(layerMemory$1()));
|
|
870
|
+
export { make as a, layerMemory as i, SparqlEngine as n, layer as r, Engine_exports as t };
|
|
871
|
+
|
|
872
|
+
//# sourceMappingURL=Engine-DF8PN7g-.mjs.map
|