@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,914 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The SPARQL algebra (SPARQL 1.1 §18): the operator tree that queries are
|
|
3
|
+
* translated to and that the engine (or a storage backend) evaluates.
|
|
4
|
+
*
|
|
5
|
+
* Operators are plain immutable objects discriminated by `_tag`. Blank nodes
|
|
6
|
+
* of query patterns are replaced by internal variables (whose names start
|
|
7
|
+
* with `@` and therefore cannot clash with user variables); aggregates are
|
|
8
|
+
* computed by `Group` nodes and referenced through internal variables.
|
|
9
|
+
*
|
|
10
|
+
* Storage backends that evaluate (parts of) the algebra natively — such as a
|
|
11
|
+
* SQL backend translating SPARQL to SQL — pattern-match on these types; see
|
|
12
|
+
* `Store.QueryCapability`.
|
|
13
|
+
*
|
|
14
|
+
* @since 0.1.0
|
|
15
|
+
*/
|
|
16
|
+
import * as Term from '../Term.ts';
|
|
17
|
+
import type * as Ast from './Ast.ts';
|
|
18
|
+
import type { Bindings } from './Bindings.ts';
|
|
19
|
+
import * as Arr from 'effect/Array';
|
|
20
|
+
import * as Match from 'effect/Match';
|
|
21
|
+
import * as StringMap from './internal/stringMap.ts';
|
|
22
|
+
|
|
23
|
+
// -----------------------------------------------------------------------------
|
|
24
|
+
// Expressions
|
|
25
|
+
// -----------------------------------------------------------------------------
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* An algebra expression: like `Ast.Expression`, but `EXISTS` patterns are
|
|
29
|
+
* translated to algebra and aggregates have been replaced by variables.
|
|
30
|
+
*
|
|
31
|
+
* @since 0.1.0
|
|
32
|
+
* @category models
|
|
33
|
+
*/
|
|
34
|
+
export type Expression =
|
|
35
|
+
| Term.Variable
|
|
36
|
+
| Term.NamedNode
|
|
37
|
+
| Term.Literal
|
|
38
|
+
| Term.BlankNode
|
|
39
|
+
| Term.Triple<any, any, any>
|
|
40
|
+
| OperationExpression
|
|
41
|
+
| FunctionCallExpression
|
|
42
|
+
| ExistsExpression;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @since 0.1.0
|
|
46
|
+
* @category models
|
|
47
|
+
*/
|
|
48
|
+
export interface OperationExpression {
|
|
49
|
+
readonly _tag: 'Operation';
|
|
50
|
+
readonly operator: Ast.Operator;
|
|
51
|
+
readonly args: ReadonlyArray<Expression>;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @since 0.1.0
|
|
56
|
+
* @category models
|
|
57
|
+
*/
|
|
58
|
+
export interface FunctionCallExpression {
|
|
59
|
+
readonly _tag: 'FunctionCall';
|
|
60
|
+
readonly function: Term.NamedNode;
|
|
61
|
+
readonly args: ReadonlyArray<Expression>;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* @since 0.1.0
|
|
66
|
+
* @category models
|
|
67
|
+
*/
|
|
68
|
+
export interface ExistsExpression {
|
|
69
|
+
readonly _tag: 'Exists';
|
|
70
|
+
readonly negated: boolean;
|
|
71
|
+
readonly input: Operation;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* An aggregate computed by a `Group` operator.
|
|
76
|
+
*
|
|
77
|
+
* @since 0.1.0
|
|
78
|
+
* @category models
|
|
79
|
+
*/
|
|
80
|
+
export interface Aggregate {
|
|
81
|
+
readonly name: Ast.AggregateName;
|
|
82
|
+
readonly distinct: boolean;
|
|
83
|
+
readonly expression: Expression | '*';
|
|
84
|
+
readonly separator?: string | undefined;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
// -----------------------------------------------------------------------------
|
|
88
|
+
// Operators
|
|
89
|
+
// -----------------------------------------------------------------------------
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* An algebra operator.
|
|
93
|
+
*
|
|
94
|
+
* @since 0.1.0
|
|
95
|
+
* @category models
|
|
96
|
+
*/
|
|
97
|
+
export type Operation =
|
|
98
|
+
| Bgp
|
|
99
|
+
| Path
|
|
100
|
+
| Join
|
|
101
|
+
| LeftJoin
|
|
102
|
+
| Filter
|
|
103
|
+
| Union
|
|
104
|
+
| Graph
|
|
105
|
+
| Extend
|
|
106
|
+
| Minus
|
|
107
|
+
| Group
|
|
108
|
+
| OrderBy
|
|
109
|
+
| Project
|
|
110
|
+
| Distinct
|
|
111
|
+
| Reduced
|
|
112
|
+
| Slice
|
|
113
|
+
| Values
|
|
114
|
+
| Service;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* A basic graph pattern. The empty BGP is the join identity (one empty
|
|
118
|
+
* solution).
|
|
119
|
+
*
|
|
120
|
+
* @since 0.1.0
|
|
121
|
+
* @category models
|
|
122
|
+
*/
|
|
123
|
+
export interface Bgp {
|
|
124
|
+
readonly _tag: 'Bgp';
|
|
125
|
+
readonly patterns: ReadonlyArray<Ast.TriplePattern>;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* A property path pattern that could not be expanded to triple patterns.
|
|
130
|
+
*
|
|
131
|
+
* @since 0.1.0
|
|
132
|
+
* @category models
|
|
133
|
+
*/
|
|
134
|
+
export interface Path {
|
|
135
|
+
readonly _tag: 'Path';
|
|
136
|
+
readonly subject: Ast.TermPattern;
|
|
137
|
+
readonly path: Ast.Path;
|
|
138
|
+
readonly object: Ast.TermPattern;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* @since 0.1.0
|
|
143
|
+
* @category models
|
|
144
|
+
*/
|
|
145
|
+
export interface Join {
|
|
146
|
+
readonly _tag: 'Join';
|
|
147
|
+
readonly left: Operation;
|
|
148
|
+
readonly right: Operation;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* `OPTIONAL`, with the filter of the optional group as `expression`.
|
|
153
|
+
*
|
|
154
|
+
* @since 0.1.0
|
|
155
|
+
* @category models
|
|
156
|
+
*/
|
|
157
|
+
export interface LeftJoin {
|
|
158
|
+
readonly _tag: 'LeftJoin';
|
|
159
|
+
readonly left: Operation;
|
|
160
|
+
readonly right: Operation;
|
|
161
|
+
readonly expression?: Expression | undefined;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* @since 0.1.0
|
|
166
|
+
* @category models
|
|
167
|
+
*/
|
|
168
|
+
export interface Filter {
|
|
169
|
+
readonly _tag: 'Filter';
|
|
170
|
+
readonly expression: Expression;
|
|
171
|
+
readonly input: Operation;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @since 0.1.0
|
|
176
|
+
* @category models
|
|
177
|
+
*/
|
|
178
|
+
export interface Union {
|
|
179
|
+
readonly _tag: 'Union';
|
|
180
|
+
readonly left: Operation;
|
|
181
|
+
readonly right: Operation;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Evaluates `input` against a named graph (`GRAPH`).
|
|
186
|
+
*
|
|
187
|
+
* @since 0.1.0
|
|
188
|
+
* @category models
|
|
189
|
+
*/
|
|
190
|
+
export interface Graph {
|
|
191
|
+
readonly _tag: 'Graph';
|
|
192
|
+
readonly name: Term.NamedNode | Term.Variable;
|
|
193
|
+
readonly input: Operation;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Binds `variable` to the value of `expression` (`BIND` and select
|
|
198
|
+
* expressions).
|
|
199
|
+
*
|
|
200
|
+
* @since 0.1.0
|
|
201
|
+
* @category models
|
|
202
|
+
*/
|
|
203
|
+
export interface Extend {
|
|
204
|
+
readonly _tag: 'Extend';
|
|
205
|
+
readonly input: Operation;
|
|
206
|
+
readonly variable: Term.Variable;
|
|
207
|
+
readonly expression: Expression;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @since 0.1.0
|
|
212
|
+
* @category models
|
|
213
|
+
*/
|
|
214
|
+
export interface Minus {
|
|
215
|
+
readonly _tag: 'Minus';
|
|
216
|
+
readonly left: Operation;
|
|
217
|
+
readonly right: Operation;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/**
|
|
221
|
+
* A group key: the grouping expression and the variable it is bound to.
|
|
222
|
+
*
|
|
223
|
+
* @since 0.1.0
|
|
224
|
+
* @category models
|
|
225
|
+
*/
|
|
226
|
+
export interface GroupKey {
|
|
227
|
+
readonly expression: Expression;
|
|
228
|
+
readonly variable: Term.Variable;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Grouping and aggregation (`Group` + `AggregateJoin`). Each output solution
|
|
233
|
+
* binds the key variables and the aggregate variables of one group. With no
|
|
234
|
+
* keys, all solutions form one group (which exists even if there are no
|
|
235
|
+
* solutions).
|
|
236
|
+
*
|
|
237
|
+
* @since 0.1.0
|
|
238
|
+
* @category models
|
|
239
|
+
*/
|
|
240
|
+
export interface Group {
|
|
241
|
+
readonly _tag: 'Group';
|
|
242
|
+
readonly input: Operation;
|
|
243
|
+
readonly keys: ReadonlyArray<GroupKey>;
|
|
244
|
+
readonly aggregates: ReadonlyArray<{
|
|
245
|
+
readonly variable: Term.Variable;
|
|
246
|
+
readonly aggregate: Aggregate;
|
|
247
|
+
}>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @since 0.1.0
|
|
252
|
+
* @category models
|
|
253
|
+
*/
|
|
254
|
+
export interface OrderCondition {
|
|
255
|
+
readonly expression: Expression;
|
|
256
|
+
readonly descending: boolean;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* @since 0.1.0
|
|
261
|
+
* @category models
|
|
262
|
+
*/
|
|
263
|
+
export interface OrderBy {
|
|
264
|
+
readonly _tag: 'OrderBy';
|
|
265
|
+
readonly input: Operation;
|
|
266
|
+
readonly conditions: ReadonlyArray<OrderCondition>;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* @since 0.1.0
|
|
271
|
+
* @category models
|
|
272
|
+
*/
|
|
273
|
+
export interface Project {
|
|
274
|
+
readonly _tag: 'Project';
|
|
275
|
+
readonly input: Operation;
|
|
276
|
+
readonly variables: ReadonlyArray<Term.Variable>;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* @since 0.1.0
|
|
281
|
+
* @category models
|
|
282
|
+
*/
|
|
283
|
+
export interface Distinct {
|
|
284
|
+
readonly _tag: 'Distinct';
|
|
285
|
+
readonly input: Operation;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* @since 0.1.0
|
|
290
|
+
* @category models
|
|
291
|
+
*/
|
|
292
|
+
export interface Reduced {
|
|
293
|
+
readonly _tag: 'Reduced';
|
|
294
|
+
readonly input: Operation;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* `OFFSET` / `LIMIT`.
|
|
299
|
+
*
|
|
300
|
+
* @since 0.1.0
|
|
301
|
+
* @category models
|
|
302
|
+
*/
|
|
303
|
+
export interface Slice {
|
|
304
|
+
readonly _tag: 'Slice';
|
|
305
|
+
readonly input: Operation;
|
|
306
|
+
readonly offset: number;
|
|
307
|
+
readonly limit?: number | undefined;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Inline data (`VALUES`).
|
|
312
|
+
*
|
|
313
|
+
* @since 0.1.0
|
|
314
|
+
* @category models
|
|
315
|
+
*/
|
|
316
|
+
export interface Values {
|
|
317
|
+
readonly _tag: 'Values';
|
|
318
|
+
readonly variables: ReadonlyArray<Term.Variable>;
|
|
319
|
+
readonly bindings: ReadonlyArray<Bindings>;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* A federated `SERVICE` pattern. `pattern` keeps the original syntax so that
|
|
324
|
+
* the pattern can be sent to the remote endpoint.
|
|
325
|
+
*
|
|
326
|
+
* @since 0.1.0
|
|
327
|
+
* @category models
|
|
328
|
+
*/
|
|
329
|
+
export interface Service {
|
|
330
|
+
readonly _tag: 'Service';
|
|
331
|
+
readonly name: Term.NamedNode | Term.Variable;
|
|
332
|
+
readonly silent: boolean;
|
|
333
|
+
readonly input: Operation;
|
|
334
|
+
readonly pattern: Ast.GroupPattern;
|
|
335
|
+
readonly prefixes: Readonly<Record<string, string>>;
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
// -----------------------------------------------------------------------------
|
|
339
|
+
// Queries
|
|
340
|
+
// -----------------------------------------------------------------------------
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* A translated query: the algebra of the WHERE clause plus solution
|
|
344
|
+
* modifiers, the query form and the dataset clause.
|
|
345
|
+
*
|
|
346
|
+
* @since 0.1.0
|
|
347
|
+
* @category models
|
|
348
|
+
*/
|
|
349
|
+
export type Query =
|
|
350
|
+
| {
|
|
351
|
+
readonly _tag: 'Select';
|
|
352
|
+
readonly input: Operation;
|
|
353
|
+
readonly variables: ReadonlyArray<Term.Variable>;
|
|
354
|
+
readonly dataset?: Ast.DatasetClause | undefined;
|
|
355
|
+
}
|
|
356
|
+
| {
|
|
357
|
+
readonly _tag: 'Construct';
|
|
358
|
+
readonly input: Operation;
|
|
359
|
+
readonly template: ReadonlyArray<Ast.TriplePattern>;
|
|
360
|
+
readonly dataset?: Ast.DatasetClause | undefined;
|
|
361
|
+
}
|
|
362
|
+
| {
|
|
363
|
+
readonly _tag: 'Ask';
|
|
364
|
+
readonly input: Operation;
|
|
365
|
+
readonly dataset?: Ast.DatasetClause | undefined;
|
|
366
|
+
}
|
|
367
|
+
| {
|
|
368
|
+
readonly _tag: 'Describe';
|
|
369
|
+
readonly input: Operation;
|
|
370
|
+
readonly terms: ReadonlyArray<Term.NamedNode | Term.Variable>;
|
|
371
|
+
readonly dataset?: Ast.DatasetClause | undefined;
|
|
372
|
+
};
|
|
373
|
+
|
|
374
|
+
// -----------------------------------------------------------------------------
|
|
375
|
+
// Constructors
|
|
376
|
+
// -----------------------------------------------------------------------------
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* The empty BGP: the join identity.
|
|
380
|
+
*
|
|
381
|
+
* @since 0.1.0
|
|
382
|
+
* @category constructors
|
|
383
|
+
*/
|
|
384
|
+
export const unit: Bgp = { _tag: 'Bgp', patterns: [] };
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* @since 0.1.0
|
|
388
|
+
* @category constructors
|
|
389
|
+
*/
|
|
390
|
+
export const bgp = (patterns: ReadonlyArray<Ast.TriplePattern>): Bgp => ({ _tag: 'Bgp', patterns });
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* @since 0.1.0
|
|
394
|
+
* @category constructors
|
|
395
|
+
*/
|
|
396
|
+
export const join = (left: Operation, right: Operation): Join => ({ _tag: 'Join', left, right });
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* @since 0.1.0
|
|
400
|
+
* @category constructors
|
|
401
|
+
*/
|
|
402
|
+
export const leftJoin = (left: Operation, right: Operation, expression?: Expression): LeftJoin =>
|
|
403
|
+
expression === undefined
|
|
404
|
+
? { _tag: 'LeftJoin', left, right }
|
|
405
|
+
: { _tag: 'LeftJoin', left, right, expression };
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* @since 0.1.0
|
|
409
|
+
* @category constructors
|
|
410
|
+
*/
|
|
411
|
+
export const filter = (expression: Expression, input: Operation): Filter => ({
|
|
412
|
+
_tag: 'Filter',
|
|
413
|
+
expression,
|
|
414
|
+
input,
|
|
415
|
+
});
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* @since 0.1.0
|
|
419
|
+
* @category constructors
|
|
420
|
+
*/
|
|
421
|
+
export const union = (left: Operation, right: Operation): Union => ({ _tag: 'Union', left, right });
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @since 0.1.0
|
|
425
|
+
* @category constructors
|
|
426
|
+
*/
|
|
427
|
+
export const minus = (left: Operation, right: Operation): Minus => ({ _tag: 'Minus', left, right });
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* @since 0.1.0
|
|
431
|
+
* @category constructors
|
|
432
|
+
*/
|
|
433
|
+
export const extend = (
|
|
434
|
+
input: Operation,
|
|
435
|
+
variable: Term.Variable,
|
|
436
|
+
expression: Expression,
|
|
437
|
+
): Extend => ({
|
|
438
|
+
_tag: 'Extend',
|
|
439
|
+
input,
|
|
440
|
+
variable,
|
|
441
|
+
expression,
|
|
442
|
+
});
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* @since 0.1.0
|
|
446
|
+
* @category constructors
|
|
447
|
+
*/
|
|
448
|
+
export const project = (input: Operation, variables: ReadonlyArray<Term.Variable>): Project => ({
|
|
449
|
+
_tag: 'Project',
|
|
450
|
+
input,
|
|
451
|
+
variables,
|
|
452
|
+
});
|
|
453
|
+
|
|
454
|
+
// -----------------------------------------------------------------------------
|
|
455
|
+
// Utilities
|
|
456
|
+
// -----------------------------------------------------------------------------
|
|
457
|
+
|
|
458
|
+
/**
|
|
459
|
+
* Whether a variable name is internal (introduced by translation for blank
|
|
460
|
+
* nodes, property path sequences, group keys and aggregates).
|
|
461
|
+
*
|
|
462
|
+
* @since 0.1.0
|
|
463
|
+
* @category utils
|
|
464
|
+
*/
|
|
465
|
+
export const isInternalVariable = (name: string): boolean => name.startsWith('@');
|
|
466
|
+
|
|
467
|
+
/** A string set of the type the variable helpers below return. */
|
|
468
|
+
type VariableSet = Map<string, true>;
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* The public, native `ReadonlySet` of a variable set: the helpers below
|
|
472
|
+
* return `ReadonlySet` by contract, and only `new Set` makes one.
|
|
473
|
+
*/
|
|
474
|
+
const toReadonlySet = (vars: VariableSet): ReadonlySet<string> => new Set(vars.keys());
|
|
475
|
+
|
|
476
|
+
const termVariables = (t: Term.Term | Ast.TermPattern, out: VariableSet): void => {
|
|
477
|
+
if (Term.isVariable(t)) out.set(t.value, true);
|
|
478
|
+
else if (Term.isTriple(t)) {
|
|
479
|
+
termVariables(t.subject, out);
|
|
480
|
+
termVariables(t.predicate, out);
|
|
481
|
+
termVariables(t.object, out);
|
|
482
|
+
}
|
|
483
|
+
};
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* The variables that may be bound by solutions of an operator ("in-scope"
|
|
487
|
+
* variables, including internal ones).
|
|
488
|
+
*
|
|
489
|
+
* @since 0.1.0
|
|
490
|
+
* @category utils
|
|
491
|
+
*/
|
|
492
|
+
export const variables = (op: Operation): ReadonlySet<string> => toReadonlySet(variableSet(op));
|
|
493
|
+
|
|
494
|
+
const variableSet = (op: Operation): VariableSet => {
|
|
495
|
+
const out = StringMap.emptySet();
|
|
496
|
+
collectVariables(op, out);
|
|
497
|
+
return out;
|
|
498
|
+
};
|
|
499
|
+
|
|
500
|
+
const collectVariables = (op: Operation, out: VariableSet): void => {
|
|
501
|
+
Match.value(op).pipe(
|
|
502
|
+
Match.tag('Bgp', (o) =>
|
|
503
|
+
o.patterns.forEach((p) => {
|
|
504
|
+
termVariables(p.subject, out);
|
|
505
|
+
termVariables(p.predicate, out);
|
|
506
|
+
termVariables(p.object, out);
|
|
507
|
+
}),
|
|
508
|
+
),
|
|
509
|
+
Match.tag('Path', (o) => {
|
|
510
|
+
termVariables(o.subject, out);
|
|
511
|
+
termVariables(o.object, out);
|
|
512
|
+
}),
|
|
513
|
+
Match.tag('Join', 'LeftJoin', 'Union', (o) => {
|
|
514
|
+
collectVariables(o.left, out);
|
|
515
|
+
collectVariables(o.right, out);
|
|
516
|
+
}),
|
|
517
|
+
Match.tag('Minus', (o) => collectVariables(o.left, out)),
|
|
518
|
+
Match.tag('Filter', 'OrderBy', 'Distinct', 'Reduced', 'Slice', (o) =>
|
|
519
|
+
collectVariables(o.input, out),
|
|
520
|
+
),
|
|
521
|
+
Match.tag('Graph', 'Service', (o) => {
|
|
522
|
+
termVariables(o.name, out);
|
|
523
|
+
collectVariables(o.input, out);
|
|
524
|
+
}),
|
|
525
|
+
Match.tag('Extend', (o) => {
|
|
526
|
+
collectVariables(o.input, out);
|
|
527
|
+
out.set(o.variable.value, true);
|
|
528
|
+
}),
|
|
529
|
+
Match.tag('Group', (o) => {
|
|
530
|
+
o.keys.forEach((k) => out.set(k.variable.value, true));
|
|
531
|
+
o.aggregates.forEach((a) => out.set(a.variable.value, true));
|
|
532
|
+
}),
|
|
533
|
+
Match.tag('Project', 'Values', (o) => o.variables.forEach((v) => out.set(v.value, true))),
|
|
534
|
+
Match.exhaustive,
|
|
535
|
+
);
|
|
536
|
+
};
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* The variables that are bound in every solution of an operator (as far as
|
|
540
|
+
* can be determined statically).
|
|
541
|
+
*
|
|
542
|
+
* @since 0.1.0
|
|
543
|
+
* @category utils
|
|
544
|
+
*/
|
|
545
|
+
export const certainVariables = (op: Operation): ReadonlySet<string> =>
|
|
546
|
+
toReadonlySet(certainSet(op));
|
|
547
|
+
|
|
548
|
+
const certainSet = (op: Operation): VariableSet => {
|
|
549
|
+
return Match.value(op).pipe(
|
|
550
|
+
Match.tag('Bgp', 'Path', (o): VariableSet => variableSet(o)),
|
|
551
|
+
Match.tag('Join', (o) => {
|
|
552
|
+
const out = certainSet(o.left);
|
|
553
|
+
certainSet(o.right).forEach((_, v) => out.set(v, true));
|
|
554
|
+
return out;
|
|
555
|
+
}),
|
|
556
|
+
Match.tag('LeftJoin', 'Minus', (o) => certainSet(o.left)),
|
|
557
|
+
Match.tag('Union', (o) => {
|
|
558
|
+
const right = certainSet(o.right);
|
|
559
|
+
return StringMap.setOf(Array.from(certainSet(o.left).keys()).filter((v) => right.has(v)));
|
|
560
|
+
}),
|
|
561
|
+
Match.tag('Filter', 'OrderBy', 'Distinct', 'Reduced', 'Slice', 'Extend', (o) =>
|
|
562
|
+
certainSet(o.input),
|
|
563
|
+
),
|
|
564
|
+
Match.tag('Graph', 'Service', (o) => {
|
|
565
|
+
const out = certainSet(o.input);
|
|
566
|
+
if (Term.isVariable(o.name)) out.set(o.name.value, true);
|
|
567
|
+
return out;
|
|
568
|
+
}),
|
|
569
|
+
Match.tag('Group', () => StringMap.emptySet()),
|
|
570
|
+
Match.tag('Project', (o) => {
|
|
571
|
+
const inner = certainSet(o.input);
|
|
572
|
+
return StringMap.setOf(o.variables.map((v) => v.value).filter((v) => inner.has(v)));
|
|
573
|
+
}),
|
|
574
|
+
Match.tag('Values', (o) =>
|
|
575
|
+
StringMap.setOf(
|
|
576
|
+
o.variables.map((v) => v.value).filter((v) => o.bindings.every((b) => b.map.has(v))),
|
|
577
|
+
),
|
|
578
|
+
),
|
|
579
|
+
Match.exhaustive,
|
|
580
|
+
);
|
|
581
|
+
};
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* The variables mentioned by an expression (not looking into `EXISTS`).
|
|
585
|
+
*
|
|
586
|
+
* @since 0.1.0
|
|
587
|
+
* @category utils
|
|
588
|
+
*/
|
|
589
|
+
export const expressionVariables = (expression: Expression): ReadonlySet<string> => {
|
|
590
|
+
const out = StringMap.emptySet();
|
|
591
|
+
const go = (e: Expression): void => {
|
|
592
|
+
Match.value(e).pipe(
|
|
593
|
+
Match.tag('Variable', 'Triple', (t) => termVariables(t, out)),
|
|
594
|
+
Match.tag('Operation', 'FunctionCall', (call) => call.args.forEach(go)),
|
|
595
|
+
Match.orElse(() => undefined),
|
|
596
|
+
);
|
|
597
|
+
};
|
|
598
|
+
go(expression);
|
|
599
|
+
return toReadonlySet(out);
|
|
600
|
+
};
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Whether an expression contains `EXISTS` / `NOT EXISTS`.
|
|
604
|
+
*
|
|
605
|
+
* @since 0.1.0
|
|
606
|
+
* @category utils
|
|
607
|
+
*/
|
|
608
|
+
export const containsExists = (expression: Expression): boolean => {
|
|
609
|
+
return Match.value(expression).pipe(
|
|
610
|
+
Match.tag('Exists', () => true),
|
|
611
|
+
Match.tag('Operation', 'FunctionCall', (call) => call.args.some(containsExists)),
|
|
612
|
+
Match.orElse(() => false),
|
|
613
|
+
);
|
|
614
|
+
};
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Rewrites an operator tree bottom-up: `f` is applied to every node after
|
|
618
|
+
* its children have been rewritten.
|
|
619
|
+
*
|
|
620
|
+
* @since 0.1.0
|
|
621
|
+
* @category utils
|
|
622
|
+
*/
|
|
623
|
+
export const transform = (op: Operation, f: (op: Operation) => Operation): Operation => {
|
|
624
|
+
const go = (o: Operation): Operation => f(mapChildren(o, go));
|
|
625
|
+
return go(op);
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
/**
|
|
629
|
+
* Applies `f` to the direct children of an operator.
|
|
630
|
+
*
|
|
631
|
+
* @since 0.1.0
|
|
632
|
+
* @category utils
|
|
633
|
+
*/
|
|
634
|
+
export const mapChildren = (op: Operation, f: (op: Operation) => Operation): Operation => {
|
|
635
|
+
return Match.value(op).pipe(
|
|
636
|
+
Match.tag('Bgp', 'Path', 'Values', (o): Operation => o),
|
|
637
|
+
Match.tag('Join', 'Union', 'Minus', (o) => ({ ...o, left: f(o.left), right: f(o.right) })),
|
|
638
|
+
Match.tag('LeftJoin', (o) => ({ ...o, left: f(o.left), right: f(o.right) })),
|
|
639
|
+
Match.tag(
|
|
640
|
+
'Filter',
|
|
641
|
+
'Graph',
|
|
642
|
+
'Extend',
|
|
643
|
+
'Group',
|
|
644
|
+
'OrderBy',
|
|
645
|
+
'Project',
|
|
646
|
+
'Distinct',
|
|
647
|
+
'Reduced',
|
|
648
|
+
'Slice',
|
|
649
|
+
'Service',
|
|
650
|
+
// SAFETY: every operator listed here has an `input`, and replacing it keeps the
|
|
651
|
+
// operator's own tag.
|
|
652
|
+
(o) => ({ ...o, input: f(o.input) }),
|
|
653
|
+
),
|
|
654
|
+
Match.exhaustive,
|
|
655
|
+
);
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
const termText = (t: Term.Term | Ast.TermPattern): string =>
|
|
659
|
+
Term.isTriple(t)
|
|
660
|
+
? `<<( ${termText(t.subject)} ${termText(t.predicate)} ${termText(t.object)} )>>`
|
|
661
|
+
: t.toString();
|
|
662
|
+
|
|
663
|
+
const pathText = (p: Ast.Path): string => {
|
|
664
|
+
return Match.value(p).pipe(
|
|
665
|
+
Match.tag('PathLink', (l) => termText(l.iri)),
|
|
666
|
+
Match.tag('PathInverse', (i) => `(inv ${pathText(i.path)})`),
|
|
667
|
+
Match.tag('PathSequence', (s) => `(seq ${s.paths.map(pathText).join(' ')})`),
|
|
668
|
+
Match.tag('PathAlternative', (a) => `(alt ${a.paths.map(pathText).join(' ')})`),
|
|
669
|
+
Match.tag('PathZeroOrMore', (z) => `(path* ${pathText(z.path)})`),
|
|
670
|
+
Match.tag('PathOneOrMore', (o) => `(path+ ${pathText(o.path)})`),
|
|
671
|
+
Match.tag('PathZeroOrOne', (z) => `(path? ${pathText(z.path)})`),
|
|
672
|
+
Match.tag(
|
|
673
|
+
'PathNegated',
|
|
674
|
+
(n) =>
|
|
675
|
+
`(notoneof ${[...n.iris.map(termText), ...n.inverse.map((i) => `^${termText(i)}`)].join(' ')})`,
|
|
676
|
+
),
|
|
677
|
+
Match.exhaustive,
|
|
678
|
+
);
|
|
679
|
+
};
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Formats an expression as an S-expression (for debugging and logging).
|
|
683
|
+
*
|
|
684
|
+
* @since 0.1.0
|
|
685
|
+
* @category formatting
|
|
686
|
+
*/
|
|
687
|
+
export const formatExpression = (e: Expression): string => {
|
|
688
|
+
return Match.value(e).pipe(
|
|
689
|
+
Match.tag(
|
|
690
|
+
'Operation',
|
|
691
|
+
(o) => `(${o.operator.toLowerCase()} ${o.args.map(formatExpression).join(' ')})`,
|
|
692
|
+
),
|
|
693
|
+
Match.tag(
|
|
694
|
+
'FunctionCall',
|
|
695
|
+
(c) => `(${termText(c.function)} ${c.args.map(formatExpression).join(' ')})`,
|
|
696
|
+
),
|
|
697
|
+
Match.tag('Exists', (x) => `(${x.negated ? 'notexists' : 'exists'} ${format(x.input)})`),
|
|
698
|
+
Match.orElse((t) => termText(t)),
|
|
699
|
+
);
|
|
700
|
+
};
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* Formats an operator tree as an S-expression in the style of the SPARQL
|
|
704
|
+
* Algebra notation (for debugging and logging).
|
|
705
|
+
*
|
|
706
|
+
* @since 0.1.0
|
|
707
|
+
* @category formatting
|
|
708
|
+
*/
|
|
709
|
+
export const format = (op: Operation, indent = ''): string => {
|
|
710
|
+
const next = `${indent} `;
|
|
711
|
+
const sub = (o: Operation) => `\n${next}${format(o, next)}`;
|
|
712
|
+
return Match.value(op).pipe(
|
|
713
|
+
Match.tag(
|
|
714
|
+
'Bgp',
|
|
715
|
+
(o) =>
|
|
716
|
+
`(bgp${o.patterns.map((p) => ` (triple ${termText(p.subject)} ${termText(p.predicate)} ${termText(p.object)})`).join('')})`,
|
|
717
|
+
),
|
|
718
|
+
Match.tag(
|
|
719
|
+
'Path',
|
|
720
|
+
(o) => `(path ${termText(o.subject)} ${pathText(o.path)} ${termText(o.object)})`,
|
|
721
|
+
),
|
|
722
|
+
Match.tag('Join', (o) => `(join${sub(o.left)}${sub(o.right)})`),
|
|
723
|
+
Match.tag(
|
|
724
|
+
'LeftJoin',
|
|
725
|
+
(o) =>
|
|
726
|
+
`(leftjoin${sub(o.left)}${sub(o.right)}${o.expression !== undefined ? `\n${next}${formatExpression(o.expression)}` : ''})`,
|
|
727
|
+
),
|
|
728
|
+
Match.tag('Filter', (o) => `(filter ${formatExpression(o.expression)}${sub(o.input)})`),
|
|
729
|
+
Match.tag('Union', (o) => `(union${sub(o.left)}${sub(o.right)})`),
|
|
730
|
+
Match.tag('Graph', (o) => `(graph ${termText(o.name)}${sub(o.input)})`),
|
|
731
|
+
Match.tag(
|
|
732
|
+
'Extend',
|
|
733
|
+
(o) =>
|
|
734
|
+
`(extend ((${termText(o.variable)} ${formatExpression(o.expression)}))${sub(o.input)})`,
|
|
735
|
+
),
|
|
736
|
+
Match.tag('Minus', (o) => `(minus${sub(o.left)}${sub(o.right)})`),
|
|
737
|
+
Match.tag(
|
|
738
|
+
'Group',
|
|
739
|
+
(o) =>
|
|
740
|
+
`(group (${o.keys.map((k) => `(${termText(k.variable)} ${formatExpression(k.expression)})`).join(' ')}) (${o.aggregates
|
|
741
|
+
.map(
|
|
742
|
+
(a) =>
|
|
743
|
+
`(${termText(a.variable)} (${a.aggregate.name.toLowerCase()}${a.aggregate.distinct ? ' distinct' : ''} ${a.aggregate.expression === '*' ? '*' : formatExpression(a.aggregate.expression)}))`,
|
|
744
|
+
)
|
|
745
|
+
.join(' ')})${sub(o.input)})`,
|
|
746
|
+
),
|
|
747
|
+
Match.tag(
|
|
748
|
+
'OrderBy',
|
|
749
|
+
(o) =>
|
|
750
|
+
`(order (${o.conditions.map((c) => (c.descending ? `(desc ${formatExpression(c.expression)})` : formatExpression(c.expression))).join(' ')})${sub(o.input)})`,
|
|
751
|
+
),
|
|
752
|
+
Match.tag(
|
|
753
|
+
'Project',
|
|
754
|
+
(o) => `(project (${o.variables.map(termText).join(' ')})${sub(o.input)})`,
|
|
755
|
+
),
|
|
756
|
+
Match.tag('Distinct', (o) => `(distinct${sub(o.input)})`),
|
|
757
|
+
Match.tag('Reduced', (o) => `(reduced${sub(o.input)})`),
|
|
758
|
+
Match.tag('Slice', (o) => `(slice ${o.offset} ${o.limit ?? '_'}${sub(o.input)})`),
|
|
759
|
+
Match.tag(
|
|
760
|
+
'Values',
|
|
761
|
+
(o) => `(table (vars ${o.variables.map(termText).join(' ')}) ${o.bindings.length} rows)`,
|
|
762
|
+
),
|
|
763
|
+
Match.tag(
|
|
764
|
+
'Service',
|
|
765
|
+
(o) => `(service ${o.silent ? 'silent ' : ''}${termText(o.name)}${sub(o.input)})`,
|
|
766
|
+
),
|
|
767
|
+
Match.exhaustive,
|
|
768
|
+
);
|
|
769
|
+
};
|
|
770
|
+
|
|
771
|
+
/**
|
|
772
|
+
* Creates an internal variable.
|
|
773
|
+
*
|
|
774
|
+
* @since 0.1.0
|
|
775
|
+
* @category constructors
|
|
776
|
+
*/
|
|
777
|
+
export const internalVariable = (name: string): Term.Variable => Term.variable(`@${name}`);
|
|
778
|
+
|
|
779
|
+
// -----------------------------------------------------------------------------
|
|
780
|
+
// Pre-binding
|
|
781
|
+
// -----------------------------------------------------------------------------
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Applies `f` to every graph pattern nested in an expression (the patterns
|
|
785
|
+
* of `EXISTS` / `NOT EXISTS`).
|
|
786
|
+
*
|
|
787
|
+
* @since 0.1.0
|
|
788
|
+
* @category utils
|
|
789
|
+
*/
|
|
790
|
+
export const mapExpressionPatterns = (
|
|
791
|
+
expression: Expression,
|
|
792
|
+
f: (op: Operation) => Operation,
|
|
793
|
+
): Expression => {
|
|
794
|
+
return Match.value(expression).pipe(
|
|
795
|
+
Match.tag('Exists', (x): Expression => ({ ...x, input: f(x.input) })),
|
|
796
|
+
Match.tag('Operation', (o) => ({
|
|
797
|
+
...o,
|
|
798
|
+
args: o.args.map((a) => mapExpressionPatterns(a, f)),
|
|
799
|
+
})),
|
|
800
|
+
Match.tag('FunctionCall', (c) => ({
|
|
801
|
+
...c,
|
|
802
|
+
args: c.args.map((a) => mapExpressionPatterns(a, f)),
|
|
803
|
+
})),
|
|
804
|
+
Match.orElse((e) => e),
|
|
805
|
+
);
|
|
806
|
+
};
|
|
807
|
+
|
|
808
|
+
/**
|
|
809
|
+
* Pre-binds variables in an algebra expression, following the "values
|
|
810
|
+
* insertion" definition of SHACL-SPARQL (Appendix "Pre-binding of
|
|
811
|
+
* Variables", aligned with the SPARQL `EXISTS` errata): every basic graph
|
|
812
|
+
* pattern, property path and `GRAPH ?var` pattern `Y` — including those
|
|
813
|
+
* nested in `EXISTS` — is replaced by `Join(Table(μ), Y)`, where `Table(μ)`
|
|
814
|
+
* is a one-row `VALUES` table holding the pre-bound solution `μ`.
|
|
815
|
+
*
|
|
816
|
+
* The pre-bound values are also substituted into the replaced patterns,
|
|
817
|
+
* which does not change the result (the join restores the bindings) but lets
|
|
818
|
+
* the optimizer and the store use them as constants.
|
|
819
|
+
*
|
|
820
|
+
* Unlike a trailing `VALUES` clause, pre-bound values are visible to every
|
|
821
|
+
* `FILTER` and `BIND`, including those of groups that never match the
|
|
822
|
+
* variable: `SELECT $this WHERE { FILTER ($this = ex:a) }` has one solution
|
|
823
|
+
* when `this` is pre-bound to `ex:a`. Queries using `MINUS`, `VALUES` or
|
|
824
|
+
* `SERVICE`, rebinding a pre-bound variable with `AS`, or with sub-queries
|
|
825
|
+
* that do not project the pre-bound variables, have no well-defined meaning
|
|
826
|
+
* under pre-binding.
|
|
827
|
+
*
|
|
828
|
+
* @since 0.1.0
|
|
829
|
+
* @category utils
|
|
830
|
+
*/
|
|
831
|
+
export const prebind = (op: Operation, bindings: Bindings): Operation => {
|
|
832
|
+
if (bindings.map.size === 0) return op;
|
|
833
|
+
const table: Values = {
|
|
834
|
+
_tag: 'Values',
|
|
835
|
+
variables: Array.from(bindings.map.keys(), (v) => Term.variable(v)),
|
|
836
|
+
bindings: [bindings],
|
|
837
|
+
};
|
|
838
|
+
const term = (t: Ast.TermPattern): Ast.TermPattern => {
|
|
839
|
+
if (Term.isVariable(t)) return bindings.map.get(t.value) ?? t;
|
|
840
|
+
if (Term.isTriple(t)) {
|
|
841
|
+
const s = term(t.subject);
|
|
842
|
+
const p = term(t.predicate);
|
|
843
|
+
const o = term(t.object);
|
|
844
|
+
// Substituting ground terms into a triple pattern keeps each position's kind.
|
|
845
|
+
return s === t.subject && p === t.predicate && o === t.object
|
|
846
|
+
? t
|
|
847
|
+
: Term.triple<any, any, any>(s, p, o);
|
|
848
|
+
}
|
|
849
|
+
return t;
|
|
850
|
+
};
|
|
851
|
+
const predicate = (p: Ast.VarOrIri): Ast.VarOrIri => {
|
|
852
|
+
if (!Term.isVariable(p)) return p;
|
|
853
|
+
const v = bindings.map.get(p.value);
|
|
854
|
+
return Term.isNamedNode(v) ? v : p;
|
|
855
|
+
};
|
|
856
|
+
const expr = (e: Expression): Expression => mapExpressionPatterns(e, go);
|
|
857
|
+
const go = (o: Operation): Operation => {
|
|
858
|
+
return Match.value(o).pipe(
|
|
859
|
+
Match.tag('Bgp', (b): Operation =>
|
|
860
|
+
Arr.isReadonlyArrayEmpty(b.patterns)
|
|
861
|
+
? table
|
|
862
|
+
: join(
|
|
863
|
+
table,
|
|
864
|
+
bgp(
|
|
865
|
+
b.patterns.map((p): Ast.TriplePattern => ({
|
|
866
|
+
_tag: 'TriplePattern',
|
|
867
|
+
subject: term(p.subject),
|
|
868
|
+
predicate: predicate(p.predicate),
|
|
869
|
+
object: term(p.object),
|
|
870
|
+
})),
|
|
871
|
+
),
|
|
872
|
+
),
|
|
873
|
+
),
|
|
874
|
+
Match.tag('Path', (p) =>
|
|
875
|
+
join(table, { ...p, subject: term(p.subject), object: term(p.object) }),
|
|
876
|
+
),
|
|
877
|
+
Match.tag('Graph', (g) => {
|
|
878
|
+
const input = go(g.input);
|
|
879
|
+
const value = Term.isVariable(g.name) ? bindings.map.get(g.name.value) : undefined;
|
|
880
|
+
if (value === undefined) return { ...g, input };
|
|
881
|
+
return join(
|
|
882
|
+
table,
|
|
883
|
+
Term.isNamedNode(value) ? { ...g, name: value, input } : { ...g, input },
|
|
884
|
+
);
|
|
885
|
+
}),
|
|
886
|
+
Match.tag('Filter', (x) => ({ ...x, expression: expr(x.expression), input: go(x.input) })),
|
|
887
|
+
Match.tag('LeftJoin', (l) =>
|
|
888
|
+
l.expression === undefined
|
|
889
|
+
? { ...l, left: go(l.left), right: go(l.right) }
|
|
890
|
+
: { ...l, left: go(l.left), right: go(l.right), expression: expr(l.expression) },
|
|
891
|
+
),
|
|
892
|
+
Match.tag('Extend', (x) => ({ ...x, expression: expr(x.expression), input: go(x.input) })),
|
|
893
|
+
Match.tag('OrderBy', (x) => ({
|
|
894
|
+
...x,
|
|
895
|
+
input: go(x.input),
|
|
896
|
+
conditions: x.conditions.map((c) => ({ ...c, expression: expr(c.expression) })),
|
|
897
|
+
})),
|
|
898
|
+
Match.tag('Group', (x) => ({
|
|
899
|
+
...x,
|
|
900
|
+
input: go(x.input),
|
|
901
|
+
keys: x.keys.map((k) => ({ ...k, expression: expr(k.expression) })),
|
|
902
|
+
aggregates: x.aggregates.map((a) => ({
|
|
903
|
+
...a,
|
|
904
|
+
aggregate:
|
|
905
|
+
a.aggregate.expression === '*'
|
|
906
|
+
? a.aggregate
|
|
907
|
+
: { ...a.aggregate, expression: expr(a.aggregate.expression) },
|
|
908
|
+
})),
|
|
909
|
+
})),
|
|
910
|
+
Match.orElse((x) => mapChildren(x, go)),
|
|
911
|
+
);
|
|
912
|
+
};
|
|
913
|
+
return go(op);
|
|
914
|
+
};
|