@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,775 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialisation interfaces shared by every RDF syntax package.
|
|
3
|
+
*
|
|
4
|
+
* A syntax package (Turtle, JSON-LD, RDF/XML, …) provides a `Parser` and a
|
|
5
|
+
* `Serializer`, usually combined into a `Codec`. Codecs expose an Effect
|
|
6
|
+
* `Schema` transforming `string ⇄ Dataset`, and can be registered in the
|
|
7
|
+
* `Formats` service for media-type based lookup and content negotiation.
|
|
8
|
+
*
|
|
9
|
+
* @since 0.1.0
|
|
10
|
+
*/
|
|
11
|
+
import * as Arr from 'effect/Array';
|
|
12
|
+
import * as Context from 'effect/Context';
|
|
13
|
+
import * as Effect from 'effect/Effect';
|
|
14
|
+
import * as FileSystem from 'effect/FileSystem';
|
|
15
|
+
import * as Layer from 'effect/Layer';
|
|
16
|
+
import * as Option from 'effect/Option';
|
|
17
|
+
import * as Order from 'effect/Order';
|
|
18
|
+
import * as Path from 'effect/Path';
|
|
19
|
+
import type * as PlatformError from 'effect/PlatformError';
|
|
20
|
+
import * as Schema from 'effect/Schema';
|
|
21
|
+
import { statementCount } from './internal/pending.ts';
|
|
22
|
+
import * as SchemaIssue from 'effect/SchemaIssue';
|
|
23
|
+
import * as SchemaTransformation from 'effect/SchemaTransformation';
|
|
24
|
+
import * as Stream from 'effect/Stream';
|
|
25
|
+
import * as Dataset from './Dataset.ts';
|
|
26
|
+
import * as PrefixMap from './PrefixMap.ts';
|
|
27
|
+
import * as TextDecoder from './internal/textDecoder.ts';
|
|
28
|
+
import type * as Term from './Term.ts';
|
|
29
|
+
|
|
30
|
+
// -----------------------------------------------------------------------------
|
|
31
|
+
// Errors
|
|
32
|
+
// -----------------------------------------------------------------------------
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* A syntax or semantic error encountered while parsing an RDF document.
|
|
36
|
+
*
|
|
37
|
+
* @since 0.1.0
|
|
38
|
+
* @category errors
|
|
39
|
+
*/
|
|
40
|
+
export class RdfParseError extends Schema.TaggedError<RdfParseError>()('RdfParseError', {
|
|
41
|
+
format: Schema.String,
|
|
42
|
+
message: Schema.String,
|
|
43
|
+
line: Schema.optional(Schema.Number),
|
|
44
|
+
column: Schema.optional(Schema.Number),
|
|
45
|
+
}) {}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An error encountered while serialising quads, e.g. a quad that cannot be
|
|
49
|
+
* represented in the target syntax (a named graph in Turtle).
|
|
50
|
+
*
|
|
51
|
+
* @since 0.1.0
|
|
52
|
+
* @category errors
|
|
53
|
+
*/
|
|
54
|
+
export class RdfSerializeError extends Schema.TaggedError<RdfSerializeError>()(
|
|
55
|
+
'RdfSerializeError',
|
|
56
|
+
{
|
|
57
|
+
format: Schema.String,
|
|
58
|
+
message: Schema.String,
|
|
59
|
+
},
|
|
60
|
+
) {}
|
|
61
|
+
|
|
62
|
+
// -----------------------------------------------------------------------------
|
|
63
|
+
// Formats
|
|
64
|
+
// -----------------------------------------------------------------------------
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Metadata describing an RDF concrete syntax.
|
|
68
|
+
*
|
|
69
|
+
* @since 0.1.0
|
|
70
|
+
* @category models
|
|
71
|
+
*/
|
|
72
|
+
export interface Format {
|
|
73
|
+
/** Human-readable name, e.g. `"Turtle"`. */
|
|
74
|
+
readonly name: string;
|
|
75
|
+
/** The preferred media type. */
|
|
76
|
+
readonly mediaType: string;
|
|
77
|
+
/** All media types (including the preferred one) that identify the syntax. */
|
|
78
|
+
readonly mediaTypes: ReadonlyArray<string>;
|
|
79
|
+
/** File extensions without the leading dot. */
|
|
80
|
+
readonly extensions: ReadonlyArray<string>;
|
|
81
|
+
/** Whether the syntax can represent named graphs. */
|
|
82
|
+
readonly datasets: boolean;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @since 0.1.0
|
|
87
|
+
* @category constructors
|
|
88
|
+
*/
|
|
89
|
+
export const makeFormat = (
|
|
90
|
+
format: Omit<Format, 'mediaTypes'> & { readonly mediaTypes?: ReadonlyArray<string> },
|
|
91
|
+
): Format => ({
|
|
92
|
+
...format,
|
|
93
|
+
mediaTypes: format.mediaTypes ?? [format.mediaType],
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
// -----------------------------------------------------------------------------
|
|
97
|
+
// Parsing
|
|
98
|
+
// -----------------------------------------------------------------------------
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* @since 0.1.0
|
|
102
|
+
* @category models
|
|
103
|
+
*/
|
|
104
|
+
export interface ParseOptions {
|
|
105
|
+
/** The base IRI against which relative IRIs are resolved. */
|
|
106
|
+
readonly baseIri?: string | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* The graph in which triples are placed when parsing a triples-only syntax.
|
|
109
|
+
* Defaults to the default graph.
|
|
110
|
+
*/
|
|
111
|
+
readonly graph?: Term.Graph | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Prefix for generated blank node labels. Defaults to a fresh prefix per
|
|
114
|
+
* document so that blank nodes from different documents never clash.
|
|
115
|
+
*/
|
|
116
|
+
readonly blankNodePrefix?: string | undefined;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* The result of parsing a complete document.
|
|
121
|
+
*
|
|
122
|
+
* @since 0.1.0
|
|
123
|
+
* @category models
|
|
124
|
+
*/
|
|
125
|
+
export interface ParseResult {
|
|
126
|
+
readonly dataset: Dataset.Dataset;
|
|
127
|
+
/** Prefixes declared by the document, if the syntax supports them. */
|
|
128
|
+
readonly prefixes: PrefixMap.PrefixMap;
|
|
129
|
+
/** The final base IRI of the document, if any. */
|
|
130
|
+
readonly baseIri: string | undefined;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @since 0.1.0
|
|
135
|
+
* @category models
|
|
136
|
+
*/
|
|
137
|
+
export interface Parser<Options extends ParseOptions = ParseOptions> {
|
|
138
|
+
readonly format: Format;
|
|
139
|
+
/** Parses a complete document. */
|
|
140
|
+
readonly parse: (input: string, options?: Options) => Effect.Effect<ParseResult, RdfParseError>;
|
|
141
|
+
/** Parses a stream of text chunks into a stream of quads. */
|
|
142
|
+
readonly parseStream: <E, R>(
|
|
143
|
+
input: Stream.Stream<string, E, R>,
|
|
144
|
+
options?: Options,
|
|
145
|
+
) => Stream.Stream<Term.Quad, RdfParseError | E, R>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Builds a `Parser`. When `parseStream` is not provided the stream is
|
|
150
|
+
* buffered and parsed as a whole.
|
|
151
|
+
*
|
|
152
|
+
* @since 0.1.0
|
|
153
|
+
* @category constructors
|
|
154
|
+
*/
|
|
155
|
+
export const makeParser = <Options extends ParseOptions = ParseOptions>(options: {
|
|
156
|
+
readonly format: Format;
|
|
157
|
+
readonly parse: (input: string, options?: Options) => Effect.Effect<ParseResult, RdfParseError>;
|
|
158
|
+
readonly parseStream?: Parser<Options>['parseStream'];
|
|
159
|
+
}): Parser<Options> => ({
|
|
160
|
+
format: options.format,
|
|
161
|
+
parse: options.parse,
|
|
162
|
+
parseStream:
|
|
163
|
+
options.parseStream ??
|
|
164
|
+
(<E, R>(input: Stream.Stream<string, E, R>, parseOptions?: Options) =>
|
|
165
|
+
Stream.mkString(input).pipe(
|
|
166
|
+
Effect.flatMap((text) => options.parse(text, parseOptions)),
|
|
167
|
+
Effect.map((result) => result.dataset),
|
|
168
|
+
Stream.fromIterableEffect,
|
|
169
|
+
)),
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
// -----------------------------------------------------------------------------
|
|
173
|
+
// Serialising
|
|
174
|
+
// -----------------------------------------------------------------------------
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* @since 0.1.0
|
|
178
|
+
* @category models
|
|
179
|
+
*/
|
|
180
|
+
export interface SerializeOptions {
|
|
181
|
+
/** Prefixes to use for abbreviating IRIs, if the syntax supports them. */
|
|
182
|
+
readonly prefixes?: PrefixMap.PrefixMap | undefined;
|
|
183
|
+
/** The base IRI used to relativise IRIs, if the syntax supports it. */
|
|
184
|
+
readonly baseIri?: string | undefined;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* @since 0.1.0
|
|
189
|
+
* @category models
|
|
190
|
+
*/
|
|
191
|
+
export interface Serializer<Options extends SerializeOptions = SerializeOptions> {
|
|
192
|
+
readonly format: Format;
|
|
193
|
+
/** Serialises quads to a complete document. */
|
|
194
|
+
readonly serialize: (
|
|
195
|
+
quads: Iterable<Term.Quad>,
|
|
196
|
+
options?: Options,
|
|
197
|
+
) => Effect.Effect<string, RdfSerializeError>;
|
|
198
|
+
/** Serialises a stream of quads to a stream of text chunks. */
|
|
199
|
+
readonly serializeStream: <E, R>(
|
|
200
|
+
quads: Stream.Stream<Term.Quad, E, R>,
|
|
201
|
+
options?: Options,
|
|
202
|
+
) => Stream.Stream<string, RdfSerializeError | E, R>;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Builds a `Serializer`. When `serializeStream` is not provided the stream is
|
|
207
|
+
* buffered and serialised as a whole.
|
|
208
|
+
*
|
|
209
|
+
* @since 0.1.0
|
|
210
|
+
* @category constructors
|
|
211
|
+
*/
|
|
212
|
+
export const makeSerializer = <Options extends SerializeOptions = SerializeOptions>(options: {
|
|
213
|
+
readonly format: Format;
|
|
214
|
+
readonly serialize: (
|
|
215
|
+
quads: Iterable<Term.Quad>,
|
|
216
|
+
options?: Options,
|
|
217
|
+
) => Effect.Effect<string, RdfSerializeError>;
|
|
218
|
+
readonly serializeStream?: Serializer<Options>['serializeStream'];
|
|
219
|
+
}): Serializer<Options> => ({
|
|
220
|
+
format: options.format,
|
|
221
|
+
serialize: options.serialize,
|
|
222
|
+
serializeStream:
|
|
223
|
+
options.serializeStream ??
|
|
224
|
+
(<E, R>(quads: Stream.Stream<Term.Quad, E, R>, serializeOptions?: Options) =>
|
|
225
|
+
Stream.runCollect(quads).pipe(
|
|
226
|
+
Effect.flatMap((all) => options.serialize(all, serializeOptions)),
|
|
227
|
+
Stream.fromEffect,
|
|
228
|
+
)),
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// -----------------------------------------------------------------------------
|
|
232
|
+
// Codecs
|
|
233
|
+
// -----------------------------------------------------------------------------
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* A parser and serializer for the same syntax.
|
|
237
|
+
*
|
|
238
|
+
* @since 0.1.0
|
|
239
|
+
* @category models
|
|
240
|
+
*/
|
|
241
|
+
export interface Codec<
|
|
242
|
+
ParseOpts extends ParseOptions = ParseOptions,
|
|
243
|
+
SerializeOpts extends SerializeOptions = SerializeOptions,
|
|
244
|
+
>
|
|
245
|
+
extends Parser<ParseOpts>, Serializer<SerializeOpts> {
|
|
246
|
+
/** A schema transforming documents (`string`) to `Dataset`s and back. */
|
|
247
|
+
readonly schema: Schema.Codec<Dataset.Dataset, string>;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Combines a parser and serializer into a `Codec`.
|
|
252
|
+
*
|
|
253
|
+
* @since 0.1.0
|
|
254
|
+
* @category constructors
|
|
255
|
+
*/
|
|
256
|
+
export const makeCodec = <ParseOpts extends ParseOptions, SerializeOpts extends SerializeOptions>(
|
|
257
|
+
parser: Parser<ParseOpts>,
|
|
258
|
+
serializer: Serializer<SerializeOpts>,
|
|
259
|
+
): Codec<ParseOpts, SerializeOpts> => ({
|
|
260
|
+
format: parser.format,
|
|
261
|
+
parse: parser.parse,
|
|
262
|
+
parseStream: parser.parseStream,
|
|
263
|
+
serialize: serializer.serialize,
|
|
264
|
+
serializeStream: serializer.serializeStream,
|
|
265
|
+
schema: toSchema(parser, serializer),
|
|
266
|
+
});
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* Builds a `Schema` that decodes documents to datasets with `parser` and
|
|
270
|
+
* encodes datasets with `serializer`.
|
|
271
|
+
*
|
|
272
|
+
* @since 0.1.0
|
|
273
|
+
* @category schemas
|
|
274
|
+
*/
|
|
275
|
+
export const toSchema = (
|
|
276
|
+
parser: Parser<any>,
|
|
277
|
+
serializer: Serializer<any>,
|
|
278
|
+
): Schema.Codec<Dataset.Dataset, string> =>
|
|
279
|
+
Schema.String.pipe(
|
|
280
|
+
Schema.decodeTo(
|
|
281
|
+
Dataset.DatasetSchema,
|
|
282
|
+
SchemaTransformation.transformEffect({
|
|
283
|
+
decode: (input: string) =>
|
|
284
|
+
parser.parse(input).pipe(
|
|
285
|
+
Effect.map((r) => r.dataset),
|
|
286
|
+
Effect.mapError(
|
|
287
|
+
(e) => new SchemaIssue.InvalidValue({ message: formatError(e) }, input),
|
|
288
|
+
),
|
|
289
|
+
),
|
|
290
|
+
encode: (dataset: Dataset.Dataset) =>
|
|
291
|
+
serializer
|
|
292
|
+
.serialize(dataset)
|
|
293
|
+
.pipe(
|
|
294
|
+
Effect.mapError((e) => new SchemaIssue.InvalidValue({ message: e.message }, dataset)),
|
|
295
|
+
),
|
|
296
|
+
}),
|
|
297
|
+
),
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Formats a parse error with its position.
|
|
302
|
+
*
|
|
303
|
+
* @since 0.1.0
|
|
304
|
+
* @category errors
|
|
305
|
+
*/
|
|
306
|
+
export const formatError = (error: RdfParseError): string =>
|
|
307
|
+
error.line !== undefined
|
|
308
|
+
? `${error.format} parse error at line ${error.line}${error.column !== undefined ? `, column ${error.column}` : ''}: ${error.message}`
|
|
309
|
+
: `${error.format} parse error: ${error.message}`;
|
|
310
|
+
|
|
311
|
+
// -----------------------------------------------------------------------------
|
|
312
|
+
// Registry
|
|
313
|
+
// -----------------------------------------------------------------------------
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* A registry of available parsers and serializers, used for media-type
|
|
317
|
+
* lookup and HTTP content negotiation.
|
|
318
|
+
*
|
|
319
|
+
* @since 0.1.0
|
|
320
|
+
* @category services
|
|
321
|
+
*/
|
|
322
|
+
export class Formats extends Context.Service<
|
|
323
|
+
Formats,
|
|
324
|
+
{
|
|
325
|
+
readonly parsers: ReadonlyArray<Parser<any>>;
|
|
326
|
+
readonly serializers: ReadonlyArray<Serializer<any>>;
|
|
327
|
+
}
|
|
328
|
+
>()('@thomasfosterau/effect-rdf/Formats') {}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* Creates a `Formats` layer from codecs, parsers and serializers.
|
|
332
|
+
*
|
|
333
|
+
* @since 0.1.0
|
|
334
|
+
* @category layers
|
|
335
|
+
*/
|
|
336
|
+
export const layer = (
|
|
337
|
+
...entries: ReadonlyArray<Codec<any, any> | Parser<any> | Serializer<any>>
|
|
338
|
+
): Layer.Layer<Formats> =>
|
|
339
|
+
Layer.succeed(Formats, {
|
|
340
|
+
parsers: entries.filter((e): e is Parser<any> => 'parse' in e),
|
|
341
|
+
serializers: entries.filter((e): e is Serializer<any> => 'serialize' in e),
|
|
342
|
+
});
|
|
343
|
+
|
|
344
|
+
const normalizeMediaType = (mediaType: string): string =>
|
|
345
|
+
(mediaType.split(';')[0] ?? '').trim().toLowerCase();
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Finds a parser for a media type (parameters such as `charset` are ignored).
|
|
349
|
+
*
|
|
350
|
+
* @since 0.1.0
|
|
351
|
+
* @category lookup
|
|
352
|
+
*/
|
|
353
|
+
export const parserFor = (
|
|
354
|
+
formats: Formats['Service'],
|
|
355
|
+
mediaType: string,
|
|
356
|
+
): Option.Option<Parser<any>> => {
|
|
357
|
+
const mt = normalizeMediaType(mediaType);
|
|
358
|
+
return Option.fromNullishOr(formats.parsers.find((p) => p.format.mediaTypes.includes(mt)));
|
|
359
|
+
};
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Finds a serializer for a media type.
|
|
363
|
+
*
|
|
364
|
+
* @since 0.1.0
|
|
365
|
+
* @category lookup
|
|
366
|
+
*/
|
|
367
|
+
export const serializerFor = (
|
|
368
|
+
formats: Formats['Service'],
|
|
369
|
+
mediaType: string,
|
|
370
|
+
): Option.Option<Serializer<any>> => {
|
|
371
|
+
const mt = normalizeMediaType(mediaType);
|
|
372
|
+
return Option.fromNullishOr(formats.serializers.find((s) => s.format.mediaTypes.includes(mt)));
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
/**
|
|
376
|
+
* Finds a parser for a file extension (with or without leading dot).
|
|
377
|
+
*
|
|
378
|
+
* @since 0.1.0
|
|
379
|
+
* @category lookup
|
|
380
|
+
*/
|
|
381
|
+
export const parserForExtension = (
|
|
382
|
+
formats: Formats['Service'],
|
|
383
|
+
extension: string,
|
|
384
|
+
): Option.Option<Parser<any>> => {
|
|
385
|
+
const ext = extension.replace(/^\./, '').toLowerCase();
|
|
386
|
+
return Option.fromNullishOr(formats.parsers.find((p) => p.format.extensions.includes(ext)));
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Finds a serializer for a file extension (with or without leading dot).
|
|
391
|
+
*
|
|
392
|
+
* @since 0.1.0
|
|
393
|
+
* @category lookup
|
|
394
|
+
*/
|
|
395
|
+
export const serializerForExtension = (
|
|
396
|
+
formats: Formats['Service'],
|
|
397
|
+
extension: string,
|
|
398
|
+
): Option.Option<Serializer<any>> => {
|
|
399
|
+
const ext = extension.replace(/^\./, '').toLowerCase();
|
|
400
|
+
return Option.fromNullishOr(formats.serializers.find((s) => s.format.extensions.includes(ext)));
|
|
401
|
+
};
|
|
402
|
+
|
|
403
|
+
/**
|
|
404
|
+
* A parsed `Accept` header entry.
|
|
405
|
+
*
|
|
406
|
+
* @since 0.1.0
|
|
407
|
+
* @category negotiation
|
|
408
|
+
*/
|
|
409
|
+
export interface AcceptEntry {
|
|
410
|
+
readonly mediaType: string;
|
|
411
|
+
readonly q: number;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
/**
|
|
415
|
+
* Parses an HTTP `Accept` header, sorted by preference.
|
|
416
|
+
*
|
|
417
|
+
* @since 0.1.0
|
|
418
|
+
* @category negotiation
|
|
419
|
+
*/
|
|
420
|
+
export const parseAccept = (header: string): ReadonlyArray<AcceptEntry> =>
|
|
421
|
+
Arr.sort(
|
|
422
|
+
header
|
|
423
|
+
.split(',')
|
|
424
|
+
.map((part, index) => {
|
|
425
|
+
const [type, ...params] = part.split(';').map((s) => s.trim());
|
|
426
|
+
// The last `q` parameter wins
|
|
427
|
+
const q = Arr.reduce(params, 1, (acc, p) => {
|
|
428
|
+
const [k, v] = p.split('=').map((s) => s.trim());
|
|
429
|
+
return k === 'q' && v !== undefined ? Number(v) : acc;
|
|
430
|
+
});
|
|
431
|
+
return { mediaType: (type ?? '').toLowerCase(), q: Number.isNaN(q) ? 0 : q, index };
|
|
432
|
+
})
|
|
433
|
+
.filter((e) => e.mediaType !== '' && e.q > 0),
|
|
434
|
+
acceptOrder,
|
|
435
|
+
).map(({ mediaType, q }) => ({ mediaType, q }));
|
|
436
|
+
|
|
437
|
+
interface AcceptCandidate {
|
|
438
|
+
readonly mediaType: string;
|
|
439
|
+
readonly q: number;
|
|
440
|
+
readonly index: number;
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
/** Highest quality first, then the most specific range, then header order. */
|
|
444
|
+
const acceptOrder: Order.Order<AcceptCandidate> = Order.combineAll([
|
|
445
|
+
Order.flip(Order.mapInput(Order.Number, (e: AcceptCandidate) => e.q)),
|
|
446
|
+
Order.flip(Order.mapInput(Order.Number, (e: AcceptCandidate) => specificity(e.mediaType))),
|
|
447
|
+
Order.mapInput(Order.Number, (e: AcceptCandidate) => e.index),
|
|
448
|
+
]);
|
|
449
|
+
|
|
450
|
+
const specificity = (mt: string): number => (mt === '*/*' ? 0 : mt.endsWith('/*') ? 1 : 2);
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Selects the best of `available` media types for an `Accept` header.
|
|
454
|
+
* Returns the first available type when the header is empty or absent.
|
|
455
|
+
*
|
|
456
|
+
* @since 0.1.0
|
|
457
|
+
* @category negotiation
|
|
458
|
+
*/
|
|
459
|
+
export const negotiate = (
|
|
460
|
+
accept: string | undefined,
|
|
461
|
+
available: ReadonlyArray<string>,
|
|
462
|
+
): Option.Option<string> => {
|
|
463
|
+
if (!Arr.isReadonlyArrayNonEmpty(available)) return Option.none();
|
|
464
|
+
if (accept === undefined || accept.trim() === '') return Option.some(available[0]);
|
|
465
|
+
// The first entry, by preference, that one of the available types satisfies
|
|
466
|
+
return Arr.findFirst(parseAccept(accept), (entry): Option.Option<string> => {
|
|
467
|
+
if (entry.mediaType === '*/*') return Option.some(available[0]);
|
|
468
|
+
if (entry.mediaType.endsWith('/*')) {
|
|
469
|
+
const prefix = entry.mediaType.slice(0, -1);
|
|
470
|
+
return Arr.findFirst(available, (a) => a.startsWith(prefix));
|
|
471
|
+
}
|
|
472
|
+
return available.includes(entry.mediaType) ? Option.some(entry.mediaType) : Option.none();
|
|
473
|
+
});
|
|
474
|
+
};
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Generates a fresh blank node label prefix for a parsed document.
|
|
478
|
+
*
|
|
479
|
+
* @since 0.1.0
|
|
480
|
+
* @category utils
|
|
481
|
+
*/
|
|
482
|
+
export const freshBlankNodePrefix = (): string => `b${(documentCounter++).toString(36)}_`;
|
|
483
|
+
|
|
484
|
+
let documentCounter = 0;
|
|
485
|
+
|
|
486
|
+
// -----------------------------------------------------------------------------
|
|
487
|
+
// Bytes
|
|
488
|
+
// -----------------------------------------------------------------------------
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
|
+
* Options for reading bytes: a parser's options plus the text encoding.
|
|
492
|
+
*
|
|
493
|
+
* @since 0.1.0
|
|
494
|
+
* @category models
|
|
495
|
+
*/
|
|
496
|
+
export interface BytesOptions {
|
|
497
|
+
/**
|
|
498
|
+
* The character encoding of the input, as in a `charset` media-type
|
|
499
|
+
* parameter. Defaults to UTF-8, which is validated strictly; a leading byte
|
|
500
|
+
* order mark is dropped.
|
|
501
|
+
*/
|
|
502
|
+
readonly charset?: string | undefined;
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
const decodeFailure = (format: Format, failure: TextDecoder.DecodeFailure): RdfParseError =>
|
|
506
|
+
new RdfParseError({
|
|
507
|
+
format: format.name,
|
|
508
|
+
message: failure.message,
|
|
509
|
+
line: failure.line,
|
|
510
|
+
column: failure.column,
|
|
511
|
+
});
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Parses a stream of bytes (from `FileSystem.stream`, an HTTP body, a socket
|
|
515
|
+
* or a child process) into a stream of quads. The bytes are decoded as UTF-8
|
|
516
|
+
* by default (or as `options.charset`), across chunk boundaries; ill-formed
|
|
517
|
+
* input fails with an `RdfParseError` at the line and column of the bad
|
|
518
|
+
* byte, never a defect.
|
|
519
|
+
*
|
|
520
|
+
* @since 0.1.0
|
|
521
|
+
* @category parsing
|
|
522
|
+
*/
|
|
523
|
+
export const parseBytes = <Options extends ParseOptions, E, R>(
|
|
524
|
+
parser: Parser<Options>,
|
|
525
|
+
input: Stream.Stream<Uint8Array, E, R>,
|
|
526
|
+
options?: Options & BytesOptions,
|
|
527
|
+
): Stream.Stream<Term.Quad, RdfParseError | E, R> =>
|
|
528
|
+
Stream.suspend(() => {
|
|
529
|
+
const decoder = TextDecoder.make(options?.charset);
|
|
530
|
+
const step = (result: string | TextDecoder.DecodeFailure) =>
|
|
531
|
+
TextDecoder.isFailure(result)
|
|
532
|
+
? Effect.fail(decodeFailure(parser.format, result))
|
|
533
|
+
: Effect.succeed(result);
|
|
534
|
+
const text = input.pipe(
|
|
535
|
+
Stream.mapEffect((chunk) => step(decoder.push(chunk))),
|
|
536
|
+
Stream.concat(Stream.fromEffect(Effect.suspend(() => step(decoder.end())))),
|
|
537
|
+
Stream.filter((chunk) => chunk !== ''),
|
|
538
|
+
);
|
|
539
|
+
return parser.parseStream(text, options);
|
|
540
|
+
});
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Decodes a complete document's bytes as `parseBytes` does, then parses it
|
|
544
|
+
* with `parser.parse` (so the result keeps the document's prefixes and base).
|
|
545
|
+
*
|
|
546
|
+
* @since 0.1.0
|
|
547
|
+
* @category parsing
|
|
548
|
+
*/
|
|
549
|
+
export const parseBytesDocument = <Options extends ParseOptions>(
|
|
550
|
+
parser: Parser<Options>,
|
|
551
|
+
input: Uint8Array,
|
|
552
|
+
options?: Options & BytesOptions,
|
|
553
|
+
): Effect.Effect<ParseResult, RdfParseError> =>
|
|
554
|
+
Effect.suspend(() => {
|
|
555
|
+
const decoder = TextDecoder.make(options?.charset);
|
|
556
|
+
const body = decoder.push(input);
|
|
557
|
+
if (TextDecoder.isFailure(body)) return Effect.fail(decodeFailure(parser.format, body));
|
|
558
|
+
const rest = decoder.end();
|
|
559
|
+
if (TextDecoder.isFailure(rest)) return Effect.fail(decodeFailure(parser.format, rest));
|
|
560
|
+
return parser.parse(body + rest, options);
|
|
561
|
+
});
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Serialises quads to a stream of UTF-8 bytes.
|
|
565
|
+
*
|
|
566
|
+
* @since 0.1.0
|
|
567
|
+
* @category serializing
|
|
568
|
+
*/
|
|
569
|
+
export const serializeBytes = <Options extends SerializeOptions>(
|
|
570
|
+
serializer: Serializer<Options>,
|
|
571
|
+
quads: Iterable<Term.Quad>,
|
|
572
|
+
options?: Options,
|
|
573
|
+
): Stream.Stream<Uint8Array, RdfSerializeError> =>
|
|
574
|
+
Stream.encodeText(serializer.serializeStream(Stream.fromIterable(quads), options));
|
|
575
|
+
|
|
576
|
+
// -----------------------------------------------------------------------------
|
|
577
|
+
// Files
|
|
578
|
+
// -----------------------------------------------------------------------------
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Options for `readFile`.
|
|
582
|
+
*
|
|
583
|
+
* @since 0.1.0
|
|
584
|
+
* @category models
|
|
585
|
+
*/
|
|
586
|
+
export interface ReadFileOptions extends ParseOptions, BytesOptions {
|
|
587
|
+
/** The parser to use; otherwise one is chosen by `mediaType` or the file extension. */
|
|
588
|
+
readonly parser?: Parser<any> | undefined;
|
|
589
|
+
/** A media type to find the parser by in the `Formats` service. */
|
|
590
|
+
readonly mediaType?: string | undefined;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Options for `writeFile`.
|
|
595
|
+
*
|
|
596
|
+
* @since 0.1.0
|
|
597
|
+
* @category models
|
|
598
|
+
*/
|
|
599
|
+
export interface WriteFileOptions extends SerializeOptions {
|
|
600
|
+
/** The serializer to use; otherwise one is chosen by `mediaType` or the file extension. */
|
|
601
|
+
readonly serializer?: Serializer<any> | undefined;
|
|
602
|
+
/** A media type to find the serializer by in the `Formats` service. */
|
|
603
|
+
readonly mediaType?: string | undefined;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
const fromFormats = <A>(
|
|
607
|
+
explicit: Option.Option<A>,
|
|
608
|
+
lookup: (formats: Formats['Service']) => Option.Option<A>,
|
|
609
|
+
): Effect.Effect<Option.Option<A>> =>
|
|
610
|
+
Option.isSome(explicit)
|
|
611
|
+
? Effect.succeed(explicit)
|
|
612
|
+
: Effect.map(Effect.serviceOption(Formats), Option.flatMap(lookup));
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Reads an RDF file through Effect's platform-agnostic `FileSystem` (the
|
|
616
|
+
* consumer provides `NodeFileSystem`, Bun or another layer). The parser is
|
|
617
|
+
* `options.parser`, or is looked up in the `Formats` service by
|
|
618
|
+
* `options.mediaType` or the file extension. Relative IRIs resolve against
|
|
619
|
+
* the file's `file:` URL unless `options.baseIri` is given.
|
|
620
|
+
*
|
|
621
|
+
* @since 0.1.0
|
|
622
|
+
* @category files
|
|
623
|
+
*/
|
|
624
|
+
export const readFile = (
|
|
625
|
+
path: string,
|
|
626
|
+
options?: ReadFileOptions,
|
|
627
|
+
): Effect.Effect<
|
|
628
|
+
ParseResult,
|
|
629
|
+
RdfParseError | PlatformError.PlatformError,
|
|
630
|
+
FileSystem.FileSystem | Path.Path
|
|
631
|
+
> =>
|
|
632
|
+
Effect.gen(function* () {
|
|
633
|
+
const fs = yield* FileSystem.FileSystem;
|
|
634
|
+
const paths = yield* Path.Path;
|
|
635
|
+
const mediaType = options?.mediaType;
|
|
636
|
+
const parser = yield* fromFormats(Option.fromUndefinedOr(options?.parser), (formats) =>
|
|
637
|
+
mediaType === undefined
|
|
638
|
+
? parserForExtension(formats, paths.extname(path))
|
|
639
|
+
: parserFor(formats, mediaType),
|
|
640
|
+
);
|
|
641
|
+
if (Option.isNone(parser)) {
|
|
642
|
+
return yield* new RdfParseError({
|
|
643
|
+
format: 'unknown',
|
|
644
|
+
message: `No parser for ${mediaType ?? path} (provide one, or a Formats layer that has one)`,
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
const bytes = yield* fs.readFile(path);
|
|
648
|
+
const baseIri =
|
|
649
|
+
options?.baseIri ??
|
|
650
|
+
Option.getOrUndefined(
|
|
651
|
+
Option.map(yield* Effect.option(paths.toFileUrl(paths.resolve(path))), (url) => url.href),
|
|
652
|
+
);
|
|
653
|
+
return yield* parseBytesDocument(parser.value, bytes, { ...options, baseIri });
|
|
654
|
+
});
|
|
655
|
+
|
|
656
|
+
/**
|
|
657
|
+
* Writes quads to an RDF file through Effect's `FileSystem`, as UTF-8. The
|
|
658
|
+
* serializer is `options.serializer`, or is looked up in the `Formats`
|
|
659
|
+
* service by `options.mediaType` or the file extension.
|
|
660
|
+
*
|
|
661
|
+
* @since 0.1.0
|
|
662
|
+
* @category files
|
|
663
|
+
*/
|
|
664
|
+
export const writeFile = (
|
|
665
|
+
path: string,
|
|
666
|
+
quads: Iterable<Term.Quad>,
|
|
667
|
+
options?: WriteFileOptions,
|
|
668
|
+
): Effect.Effect<
|
|
669
|
+
void,
|
|
670
|
+
RdfSerializeError | PlatformError.PlatformError,
|
|
671
|
+
FileSystem.FileSystem | Path.Path
|
|
672
|
+
> =>
|
|
673
|
+
Effect.gen(function* () {
|
|
674
|
+
const fs = yield* FileSystem.FileSystem;
|
|
675
|
+
const paths = yield* Path.Path;
|
|
676
|
+
const mediaType = options?.mediaType;
|
|
677
|
+
const serializer = yield* fromFormats(Option.fromUndefinedOr(options?.serializer), (formats) =>
|
|
678
|
+
mediaType === undefined
|
|
679
|
+
? serializerForExtension(formats, paths.extname(path))
|
|
680
|
+
: serializerFor(formats, mediaType),
|
|
681
|
+
);
|
|
682
|
+
if (Option.isNone(serializer)) {
|
|
683
|
+
return yield* new RdfSerializeError({
|
|
684
|
+
format: 'unknown',
|
|
685
|
+
message: `No serializer for ${mediaType ?? path} (provide one, or a Formats layer that has one)`,
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
return yield* Stream.run(serializeBytes(serializer.value, quads, options), fs.sink(path));
|
|
689
|
+
});
|
|
690
|
+
|
|
691
|
+
// -----------------------------------------------------------------------------
|
|
692
|
+
// Tracing
|
|
693
|
+
// -----------------------------------------------------------------------------
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
|
+
* What a syntax's spans are named after: `<module>.<operation>` (e.g.
|
|
697
|
+
* `Turtle.parse`), with the format's name and media type as attributes.
|
|
698
|
+
*
|
|
699
|
+
* @since 0.1.0
|
|
700
|
+
* @category tracing
|
|
701
|
+
*/
|
|
702
|
+
export interface SpanTarget {
|
|
703
|
+
readonly module: string;
|
|
704
|
+
readonly format: Format;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
const formatAttributes = (format: Format) => ({
|
|
708
|
+
'rdf.format': format.name,
|
|
709
|
+
'rdf.media_type': format.mediaType,
|
|
710
|
+
});
|
|
711
|
+
|
|
712
|
+
/**
|
|
713
|
+
* Wraps a whole-document parse in a span named `<module>.<operation>`
|
|
714
|
+
* (`operation` defaults to `parse`), with the format, media type and input
|
|
715
|
+
* length in characters as attributes and the number of statements parsed
|
|
716
|
+
* (`rdf.quads`, which counts a statement the document repeats each time) on
|
|
717
|
+
* completion. The input text itself is never recorded.
|
|
718
|
+
* With no target the effect is returned unchanged.
|
|
719
|
+
*
|
|
720
|
+
* @since 0.1.0
|
|
721
|
+
* @category tracing
|
|
722
|
+
*/
|
|
723
|
+
export const withParseSpan =
|
|
724
|
+
(target: SpanTarget | undefined, input: string, operation: string = 'parse') =>
|
|
725
|
+
<A extends ParseResult, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<A, E, R> =>
|
|
726
|
+
target === undefined
|
|
727
|
+
? self
|
|
728
|
+
: self.pipe(
|
|
729
|
+
// The statements parsed, counted without building a dataset that was not built yet
|
|
730
|
+
Effect.tap((result) =>
|
|
731
|
+
Effect.annotateCurrentSpan('rdf.quads', statementCount(result.dataset)),
|
|
732
|
+
),
|
|
733
|
+
Effect.withSpan(`${target.module}.${operation}`, {
|
|
734
|
+
attributes: { ...formatAttributes(target.format), 'rdf.input.length': input.length },
|
|
735
|
+
}),
|
|
736
|
+
);
|
|
737
|
+
|
|
738
|
+
/**
|
|
739
|
+
* Wraps a whole-document serialisation in a span named
|
|
740
|
+
* `<module>.serialize`, with the format and media type as attributes and the
|
|
741
|
+
* output length in characters (`rdf.output.length`) on completion. With no
|
|
742
|
+
* target the effect is returned unchanged.
|
|
743
|
+
*
|
|
744
|
+
* @since 0.1.0
|
|
745
|
+
* @category tracing
|
|
746
|
+
*/
|
|
747
|
+
export const withSerializeSpan =
|
|
748
|
+
(target: SpanTarget | undefined) =>
|
|
749
|
+
<E, R>(self: Effect.Effect<string, E, R>): Effect.Effect<string, E, R> =>
|
|
750
|
+
target === undefined
|
|
751
|
+
? self
|
|
752
|
+
: self.pipe(
|
|
753
|
+
Effect.tap((output) => Effect.annotateCurrentSpan('rdf.output.length', output.length)),
|
|
754
|
+
Effect.withSpan(`${target.module}.serialize`, {
|
|
755
|
+
attributes: formatAttributes(target.format),
|
|
756
|
+
}),
|
|
757
|
+
);
|
|
758
|
+
|
|
759
|
+
/**
|
|
760
|
+
* Wraps a streaming parse or serialisation in a span named
|
|
761
|
+
* `<module>.<operation>` (e.g. `Turtle.parseStream`) that lasts while the
|
|
762
|
+
* stream runs, with the format and media type as attributes. Nothing is
|
|
763
|
+
* recorded per element. With no target the stream is returned unchanged.
|
|
764
|
+
*
|
|
765
|
+
* @since 0.1.0
|
|
766
|
+
* @category tracing
|
|
767
|
+
*/
|
|
768
|
+
export const withStreamSpan =
|
|
769
|
+
(target: SpanTarget | undefined, operation: 'parseStream' | 'serializeStream') =>
|
|
770
|
+
<A, E, R>(self: Stream.Stream<A, E, R>): Stream.Stream<A, E, R> =>
|
|
771
|
+
target === undefined
|
|
772
|
+
? self
|
|
773
|
+
: Stream.withSpan(self, `${target.module}.${operation}`, {
|
|
774
|
+
attributes: formatAttributes(target.format),
|
|
775
|
+
});
|