@thomasfosterau/effect-rdf 0.0.0-stage → 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 +2251 -2
- 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 +195 -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,1273 @@
|
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-D8jQpDG7.mjs";
|
|
2
|
+
import { c as removeDotSegments, l as resolve$1, u as withoutFragment$1 } from "./Iri-Cr92gsQV.mjs";
|
|
3
|
+
import { r as isWellFormed } from "./LanguageTag-BcOpMGZ4.mjs";
|
|
4
|
+
import { A as terms, D as expand, O as expandPrefixed, a as boundKey, c as checkFormat, f as isBinary, g as isDuration, k as isAbsoluteUrl, m as isDateTime, n as Datatype, p as isBuiltIn, u as fromIri, v as isNumeric, x as string, y as isString$1 } from "./Datatype-DQvkNkiH.mjs";
|
|
5
|
+
import { d as warning, s as error$1 } from "./Report-XHs8htzK.mjs";
|
|
6
|
+
import * as Arr from "effect/Array";
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as Predicate from "effect/Predicate";
|
|
9
|
+
import * as Schema from "effect/Schema";
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
import * as Record from "effect/Record";
|
|
12
|
+
import * as Result from "effect/Result";
|
|
13
|
+
// src/csvw/internal/json.ts
|
|
14
|
+
/**
|
|
15
|
+
* Parses JSON text, failing with the engine's `SyntaxError` message.
|
|
16
|
+
*
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
19
|
+
const parseJson = (text) => Result.try({
|
|
20
|
+
try: () => JSON.parse(text),
|
|
21
|
+
catch: (e) => e instanceof SyntaxError ? e.message : String(e)
|
|
22
|
+
});
|
|
23
|
+
/**
|
|
24
|
+
* Whether a JSON value is an object (not an array, not `null`).
|
|
25
|
+
*
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
const isObject = (value) => Predicate.isObject(value) && !Array.isArray(value);
|
|
29
|
+
/**
|
|
30
|
+
* Whether a JSON value is an array.
|
|
31
|
+
*
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
const isArray = (value) => Array.isArray(value);
|
|
35
|
+
/**
|
|
36
|
+
* The entries of a JSON object, in insertion order.
|
|
37
|
+
*
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
const entries = (obj) => Record.toEntries(obj);
|
|
41
|
+
/**
|
|
42
|
+
* The keys of a JSON object, in insertion order.
|
|
43
|
+
*
|
|
44
|
+
* @internal
|
|
45
|
+
*/
|
|
46
|
+
const keys = (obj) => Record.keys(obj);
|
|
47
|
+
/**
|
|
48
|
+
* Whether a JSON object has a key.
|
|
49
|
+
*
|
|
50
|
+
* @internal
|
|
51
|
+
*/
|
|
52
|
+
const has = (obj, key) => obj[key] !== void 0;
|
|
53
|
+
/**
|
|
54
|
+
* The value of a key of a JSON object.
|
|
55
|
+
*
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
const get$1 = (obj, key) => Record.get(obj, key);
|
|
59
|
+
/**
|
|
60
|
+
* Maps the values of a JSON object.
|
|
61
|
+
*
|
|
62
|
+
* @internal
|
|
63
|
+
*/
|
|
64
|
+
const mapValues = (obj, f) => Record.map(obj, f);
|
|
65
|
+
/**
|
|
66
|
+
* A JSON object with one key set.
|
|
67
|
+
*
|
|
68
|
+
* @internal
|
|
69
|
+
*/
|
|
70
|
+
const set = (obj, key, value) => Record.set(Record.map(obj, (v) => v), key, value);
|
|
71
|
+
/**
|
|
72
|
+
* A short description of a JSON value for messages: strings quoted, numbers
|
|
73
|
+
* and booleans as written, `null`, and the kind of anything else.
|
|
74
|
+
*
|
|
75
|
+
* @internal
|
|
76
|
+
*/
|
|
77
|
+
const describe = (value) => {
|
|
78
|
+
if (Predicate.isString(value)) return `"${value}"`;
|
|
79
|
+
if (Predicate.isNumber(value) || Predicate.isBoolean(value)) return `${value}`;
|
|
80
|
+
if (Predicate.isNull(value)) return "null";
|
|
81
|
+
return isArray(value) ? "an array" : "an object";
|
|
82
|
+
};
|
|
83
|
+
// src/csvw/internal/object.ts
|
|
84
|
+
/**
|
|
85
|
+
* Building objects whose optional properties are set only when present, as
|
|
86
|
+
* `exactOptionalPropertyTypes` requires.
|
|
87
|
+
*
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
/**
|
|
91
|
+
* `{ [key]: value }` when the value is present, `{}` otherwise; spread it
|
|
92
|
+
* into an object literal.
|
|
93
|
+
*
|
|
94
|
+
* @internal
|
|
95
|
+
*/
|
|
96
|
+
const optional = (key, value) => Option.match(value, {
|
|
97
|
+
onNone: () => ({}),
|
|
98
|
+
onSome: (v) => Record.singleton(key, v)
|
|
99
|
+
});
|
|
100
|
+
// src/csvw/internal/url.ts
|
|
101
|
+
/**
|
|
102
|
+
* URL helpers: resolution, RFC 3986 syntax- and scheme-based normalization
|
|
103
|
+
* (Tabular Data Model §URL Normalization) and the percent-encoding of column
|
|
104
|
+
* names derived from titles.
|
|
105
|
+
*
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
/**
|
|
109
|
+
* Resolves a reference against a base URL.
|
|
110
|
+
*
|
|
111
|
+
* @internal
|
|
112
|
+
*/
|
|
113
|
+
const resolve = (reference, base) => resolve$1(reference, base);
|
|
114
|
+
const URL_RE = /^([A-Za-z][A-Za-z0-9+.-]*):(?:\/\/([^/?#]*))?([^?#]*)(\?[^#]*)?(#.*)?$/;
|
|
115
|
+
const UNRESERVED = /[A-Za-z0-9\-._~]/;
|
|
116
|
+
const normalizePercent = (s) => s.replace(/%([0-9A-Fa-f]{2})/g, (_, hex) => {
|
|
117
|
+
const c = String.fromCharCode(Number.parseInt(hex, 16));
|
|
118
|
+
return UNRESERVED.test(c) ? c : `%${hex.toUpperCase()}`;
|
|
119
|
+
});
|
|
120
|
+
const isDefaultPort = (scheme, port) => scheme === "http" && port === "80" || scheme === "https" && port === "443";
|
|
121
|
+
const normalizeAuthority = (authority, scheme) => {
|
|
122
|
+
const at = authority.lastIndexOf("@");
|
|
123
|
+
const userinfo = at === -1 ? "" : authority.slice(0, at + 1);
|
|
124
|
+
const hostPort = (at === -1 ? authority : authority.slice(at + 1)).toLowerCase();
|
|
125
|
+
const m = /^(.*?)(?::(\d*))?$/.exec(hostPort);
|
|
126
|
+
const host = m?.[1] ?? hostPort;
|
|
127
|
+
const port = m?.[2];
|
|
128
|
+
return `${userinfo}${host}${port !== void 0 && port !== "" && !isDefaultPort(scheme, port) ? `:${port}` : ""}`;
|
|
129
|
+
};
|
|
130
|
+
/**
|
|
131
|
+
* Normalizes a URL for comparison: lower-case scheme and host, upper-case
|
|
132
|
+
* percent-encodings, decoded unreserved characters, no dot segments, no
|
|
133
|
+
* default HTTP(S) port and a `/` path for an HTTP(S) URL with an authority.
|
|
134
|
+
*
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
const normalize = (url) => {
|
|
138
|
+
const m = URL_RE.exec(url);
|
|
139
|
+
if (m === null) return url;
|
|
140
|
+
const scheme = (m[1] ?? "").toLowerCase();
|
|
141
|
+
const authority = m[2];
|
|
142
|
+
const rawPath = normalizePercent(m[3] ?? "");
|
|
143
|
+
const path = removeDotSegments(rawPath);
|
|
144
|
+
const query = m[4] === void 0 ? "" : normalizePercent(m[4]);
|
|
145
|
+
const fragment = m[5] === void 0 ? "" : normalizePercent(m[5]);
|
|
146
|
+
if (authority === void 0) return `${scheme}:${path}${query}${fragment}`;
|
|
147
|
+
const p = path === "" && (scheme === "http" || scheme === "https") ? "/" : path;
|
|
148
|
+
return `${scheme}://${normalizeAuthority(authority, scheme)}${p}${query}${fragment}`;
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Percent-encodes every character of a title that cannot appear in a URI
|
|
152
|
+
* template variable name (anything but `A-Z`, `a-z`, `0-9`, `_` and `.`),
|
|
153
|
+
* for a column name derived from it.
|
|
154
|
+
*
|
|
155
|
+
* @internal
|
|
156
|
+
*/
|
|
157
|
+
const encodeName = (title) => encodeURIComponent(title).replace(/[!'()*~-]/g, (c) => `%${c.charCodeAt(0).toString(16).toUpperCase()}`);
|
|
158
|
+
/**
|
|
159
|
+
* Percent-decodes a column name (`_name` and JSON property names).
|
|
160
|
+
*
|
|
161
|
+
* @internal
|
|
162
|
+
*/
|
|
163
|
+
const decodeName = (name) => name.replace(/(?:%[0-9A-Fa-f]{2})+/g, (run) => {
|
|
164
|
+
const bytes = run.match(/%([0-9A-Fa-f]{2})/g) ?? [];
|
|
165
|
+
return new TextDecoder("utf-8", { fatal: false }).decode(Uint8Array.from(bytes, (b) => Number.parseInt(b.slice(1), 16)));
|
|
166
|
+
});
|
|
167
|
+
/**
|
|
168
|
+
* Removes the fragment from a URL.
|
|
169
|
+
*
|
|
170
|
+
* @internal
|
|
171
|
+
*/
|
|
172
|
+
const withoutFragment = (url) => withoutFragment$1(url);
|
|
173
|
+
// src/csvw/Metadata.ts
|
|
174
|
+
/**
|
|
175
|
+
* CSVW metadata documents (Metadata Vocabulary for Tabular Data): the
|
|
176
|
+
* normalized description model as Effect `Schema`s (table groups, tables,
|
|
177
|
+
* schemas, columns, dialects, foreign keys, transformations), and decoding a
|
|
178
|
+
* JSON-LD metadata document with its fixed `http://www.w3.org/ns/csvw`
|
|
179
|
+
* context into that model — validating every property, warning about and
|
|
180
|
+
* dropping invalid values, failing on errors, and normalizing per §Normalization
|
|
181
|
+
* (absolute URLs, natural-language and common properties, referenced schemas
|
|
182
|
+
* and dialects fetched and inlined).
|
|
183
|
+
*
|
|
184
|
+
* @since 0.1.0
|
|
185
|
+
*/
|
|
186
|
+
var Metadata_exports = /* @__PURE__ */ __exportAll({
|
|
187
|
+
Column: () => Column,
|
|
188
|
+
CommonProperties: () => CommonProperties,
|
|
189
|
+
Dialect: () => Dialect,
|
|
190
|
+
ForeignKey: () => ForeignKey,
|
|
191
|
+
Inherited: () => Inherited,
|
|
192
|
+
LanguageMap: () => LanguageMap,
|
|
193
|
+
MetadataError: () => MetadataError,
|
|
194
|
+
Reference: () => Reference,
|
|
195
|
+
Table: () => Table,
|
|
196
|
+
TableDirection: () => TableDirection,
|
|
197
|
+
TableGroup: () => TableGroup,
|
|
198
|
+
TableSchema: () => TableSchema,
|
|
199
|
+
TextDirection: () => TextDirection,
|
|
200
|
+
Transformation: () => Transformation,
|
|
201
|
+
Trim: () => Trim,
|
|
202
|
+
checkCompatible: () => checkCompatible,
|
|
203
|
+
columnsCompatible: () => columnsCompatible,
|
|
204
|
+
decode: () => decode,
|
|
205
|
+
decodeJson: () => decodeJson,
|
|
206
|
+
defaultDialect: () => defaultDialect,
|
|
207
|
+
describes: () => describes,
|
|
208
|
+
dialectOfTable: () => dialectOfTable,
|
|
209
|
+
inherit: () => inherit,
|
|
210
|
+
languagesMatch: () => languagesMatch,
|
|
211
|
+
noFetch: () => noFetch,
|
|
212
|
+
schemaOfTable: () => schemaOfTable
|
|
213
|
+
});
|
|
214
|
+
/**
|
|
215
|
+
* A metadata document that cannot be used: invalid JSON, an invalid
|
|
216
|
+
* `@context`, a missing required property, or a value the specification
|
|
217
|
+
* says is an error (processing stops).
|
|
218
|
+
*
|
|
219
|
+
* @since 0.1.0
|
|
220
|
+
* @category errors
|
|
221
|
+
*/
|
|
222
|
+
var MetadataError = class extends Schema.TaggedError()("MetadataError", {
|
|
223
|
+
message: Schema.String,
|
|
224
|
+
url: Schema.optional(Schema.String)
|
|
225
|
+
}) {};
|
|
226
|
+
/**
|
|
227
|
+
* A natural-language property's value: language tags (`und` when unknown)
|
|
228
|
+
* mapped to strings.
|
|
229
|
+
*
|
|
230
|
+
* @since 0.1.0
|
|
231
|
+
* @category models
|
|
232
|
+
*/
|
|
233
|
+
const LanguageMap = Schema.Record(Schema.String, Schema.Array(Schema.String));
|
|
234
|
+
/**
|
|
235
|
+
* Common properties and notes in normalized form: prefixed names or absolute
|
|
236
|
+
* URLs mapped to JSON-LD values.
|
|
237
|
+
*
|
|
238
|
+
* @since 0.1.0
|
|
239
|
+
* @category models
|
|
240
|
+
*/
|
|
241
|
+
const CommonProperties = Schema.Record(Schema.String, Schema.Json);
|
|
242
|
+
/**
|
|
243
|
+
* The text direction of cells.
|
|
244
|
+
*
|
|
245
|
+
* @since 0.1.0
|
|
246
|
+
* @category models
|
|
247
|
+
*/
|
|
248
|
+
const TextDirection = Schema.Literals([
|
|
249
|
+
"ltr",
|
|
250
|
+
"rtl",
|
|
251
|
+
"auto",
|
|
252
|
+
"inherit"
|
|
253
|
+
]);
|
|
254
|
+
/**
|
|
255
|
+
* The direction of a table's columns.
|
|
256
|
+
*
|
|
257
|
+
* @since 0.1.0
|
|
258
|
+
* @category models
|
|
259
|
+
*/
|
|
260
|
+
const TableDirection = Schema.Literals([
|
|
261
|
+
"ltr",
|
|
262
|
+
"rtl",
|
|
263
|
+
"auto"
|
|
264
|
+
]);
|
|
265
|
+
/**
|
|
266
|
+
* The inherited properties of a description (§Inherited Properties), set
|
|
267
|
+
* where they were specified; a column inherits each unset one from its
|
|
268
|
+
* schema, table and table group.
|
|
269
|
+
*
|
|
270
|
+
* @since 0.1.0
|
|
271
|
+
* @category models
|
|
272
|
+
*/
|
|
273
|
+
const Inherited = Schema.Struct({
|
|
274
|
+
aboutUrl: Schema.optional(Schema.String),
|
|
275
|
+
datatype: Schema.optional(Datatype),
|
|
276
|
+
default: Schema.optional(Schema.String),
|
|
277
|
+
lang: Schema.optional(Schema.String),
|
|
278
|
+
null: Schema.optional(Schema.Array(Schema.String)),
|
|
279
|
+
ordered: Schema.optional(Schema.Boolean),
|
|
280
|
+
propertyUrl: Schema.optional(Schema.String),
|
|
281
|
+
required: Schema.optional(Schema.Boolean),
|
|
282
|
+
separator: Schema.optional(Schema.NullOr(Schema.String)),
|
|
283
|
+
textDirection: Schema.optional(TextDirection),
|
|
284
|
+
valueUrl: Schema.optional(Schema.String)
|
|
285
|
+
});
|
|
286
|
+
/**
|
|
287
|
+
* A column description.
|
|
288
|
+
*
|
|
289
|
+
* @since 0.1.0
|
|
290
|
+
* @category models
|
|
291
|
+
*/
|
|
292
|
+
const Column = Schema.Struct({
|
|
293
|
+
id: Schema.optional(Schema.String),
|
|
294
|
+
name: Schema.optional(Schema.String),
|
|
295
|
+
/** The name derived from the first title in the metadata's default language. */
|
|
296
|
+
titleName: Schema.optional(Schema.String),
|
|
297
|
+
titles: LanguageMap,
|
|
298
|
+
isVirtual: Schema.Boolean,
|
|
299
|
+
isSuppressed: Schema.Boolean,
|
|
300
|
+
inherited: Inherited,
|
|
301
|
+
common: CommonProperties
|
|
302
|
+
});
|
|
303
|
+
/**
|
|
304
|
+
* The referenced side of a foreign key: a table by `resource` URL or by
|
|
305
|
+
* `schemaReference`, and its columns.
|
|
306
|
+
*
|
|
307
|
+
* @since 0.1.0
|
|
308
|
+
* @category models
|
|
309
|
+
*/
|
|
310
|
+
const Reference = Schema.Struct({
|
|
311
|
+
resource: Schema.optional(Schema.String),
|
|
312
|
+
schemaReference: Schema.optional(Schema.String),
|
|
313
|
+
columnReference: Schema.Array(Schema.String)
|
|
314
|
+
});
|
|
315
|
+
/**
|
|
316
|
+
* A foreign key definition.
|
|
317
|
+
*
|
|
318
|
+
* @since 0.1.0
|
|
319
|
+
* @category models
|
|
320
|
+
*/
|
|
321
|
+
const ForeignKey = Schema.Struct({
|
|
322
|
+
columnReference: Schema.Array(Schema.String),
|
|
323
|
+
reference: Reference
|
|
324
|
+
});
|
|
325
|
+
/**
|
|
326
|
+
* A schema description (`tableSchema`).
|
|
327
|
+
*
|
|
328
|
+
* @since 0.1.0
|
|
329
|
+
* @category models
|
|
330
|
+
*/
|
|
331
|
+
const TableSchema = Schema.Struct({
|
|
332
|
+
id: Schema.optional(Schema.String),
|
|
333
|
+
columns: Schema.Array(Column),
|
|
334
|
+
primaryKey: Schema.optional(Schema.Array(Schema.String)),
|
|
335
|
+
rowTitles: Schema.optional(Schema.Array(Schema.String)),
|
|
336
|
+
foreignKeys: Schema.Array(ForeignKey),
|
|
337
|
+
inherited: Inherited,
|
|
338
|
+
common: CommonProperties
|
|
339
|
+
});
|
|
340
|
+
/**
|
|
341
|
+
* The trim flag of a dialect.
|
|
342
|
+
*
|
|
343
|
+
* @since 0.1.0
|
|
344
|
+
* @category models
|
|
345
|
+
*/
|
|
346
|
+
const Trim = Schema.Literals([
|
|
347
|
+
"true",
|
|
348
|
+
"false",
|
|
349
|
+
"start",
|
|
350
|
+
"end"
|
|
351
|
+
]);
|
|
352
|
+
/**
|
|
353
|
+
* A dialect description with every flag resolved (`header` folded into
|
|
354
|
+
* `headerRowCount`, `skipInitialSpace` into `trim`).
|
|
355
|
+
*
|
|
356
|
+
* @since 0.1.0
|
|
357
|
+
* @category models
|
|
358
|
+
*/
|
|
359
|
+
const Dialect = Schema.Struct({
|
|
360
|
+
id: Schema.optional(Schema.String),
|
|
361
|
+
commentPrefix: Schema.optional(Schema.String),
|
|
362
|
+
delimiter: Schema.String,
|
|
363
|
+
isDoubleQuoted: Schema.Boolean,
|
|
364
|
+
encoding: Schema.String,
|
|
365
|
+
headerRowCount: Schema.Int,
|
|
366
|
+
lineTerminators: Schema.Array(Schema.String),
|
|
367
|
+
quoteChar: Schema.NullOr(Schema.String),
|
|
368
|
+
shouldSkipBlankRows: Schema.Boolean,
|
|
369
|
+
skipColumns: Schema.Int,
|
|
370
|
+
skipRows: Schema.Int,
|
|
371
|
+
trim: Trim
|
|
372
|
+
});
|
|
373
|
+
/**
|
|
374
|
+
* The default dialect: UTF-8 CSV with one header row.
|
|
375
|
+
*
|
|
376
|
+
* @since 0.1.0
|
|
377
|
+
* @category constructors
|
|
378
|
+
*/
|
|
379
|
+
const defaultDialect = {
|
|
380
|
+
delimiter: ",",
|
|
381
|
+
isDoubleQuoted: true,
|
|
382
|
+
encoding: "utf-8",
|
|
383
|
+
headerRowCount: 1,
|
|
384
|
+
lineTerminators: ["\r\n", "\n"],
|
|
385
|
+
quoteChar: "\"",
|
|
386
|
+
shouldSkipBlankRows: false,
|
|
387
|
+
skipColumns: 0,
|
|
388
|
+
skipRows: 0,
|
|
389
|
+
trim: "true"
|
|
390
|
+
};
|
|
391
|
+
/**
|
|
392
|
+
* A transformation definition.
|
|
393
|
+
*
|
|
394
|
+
* @since 0.1.0
|
|
395
|
+
* @category models
|
|
396
|
+
*/
|
|
397
|
+
const Transformation = Schema.Struct({
|
|
398
|
+
id: Schema.optional(Schema.String),
|
|
399
|
+
url: Schema.String,
|
|
400
|
+
scriptFormat: Schema.String,
|
|
401
|
+
targetFormat: Schema.String,
|
|
402
|
+
source: Schema.optional(Schema.String),
|
|
403
|
+
titles: LanguageMap,
|
|
404
|
+
common: CommonProperties
|
|
405
|
+
});
|
|
406
|
+
/**
|
|
407
|
+
* A table description.
|
|
408
|
+
*
|
|
409
|
+
* @since 0.1.0
|
|
410
|
+
* @category models
|
|
411
|
+
*/
|
|
412
|
+
const Table = Schema.Struct({
|
|
413
|
+
id: Schema.optional(Schema.String),
|
|
414
|
+
url: Schema.String,
|
|
415
|
+
dialect: Schema.optional(Dialect),
|
|
416
|
+
notes: Schema.Array(Schema.Json),
|
|
417
|
+
isSuppressed: Schema.Boolean,
|
|
418
|
+
tableDirection: Schema.optional(TableDirection),
|
|
419
|
+
tableSchema: Schema.optional(TableSchema),
|
|
420
|
+
transformations: Schema.Array(Transformation),
|
|
421
|
+
inherited: Inherited,
|
|
422
|
+
common: CommonProperties
|
|
423
|
+
});
|
|
424
|
+
/**
|
|
425
|
+
* A table group description: the normalized form of every metadata document
|
|
426
|
+
* (a table description is wrapped in a group of one).
|
|
427
|
+
*
|
|
428
|
+
* @since 0.1.0
|
|
429
|
+
* @category models
|
|
430
|
+
*/
|
|
431
|
+
const TableGroup = Schema.Struct({
|
|
432
|
+
id: Schema.optional(Schema.String),
|
|
433
|
+
tables: Schema.Array(Table),
|
|
434
|
+
dialect: Schema.optional(Dialect),
|
|
435
|
+
notes: Schema.Array(Schema.Json),
|
|
436
|
+
tableDirection: Schema.optional(TableDirection),
|
|
437
|
+
tableSchema: Schema.optional(TableSchema),
|
|
438
|
+
transformations: Schema.Array(Transformation),
|
|
439
|
+
inherited: Inherited,
|
|
440
|
+
common: CommonProperties
|
|
441
|
+
});
|
|
442
|
+
const warn = (ctx, message) => {
|
|
443
|
+
ctx.issues.push(warning(message, { table: ctx.url }));
|
|
444
|
+
};
|
|
445
|
+
const error = (ctx, message) => {
|
|
446
|
+
ctx.issues.push(error$1(message, { table: ctx.url }));
|
|
447
|
+
};
|
|
448
|
+
const quote = describe;
|
|
449
|
+
const CSVW_CONTEXT = "http://www.w3.org/ns/csvw";
|
|
450
|
+
const inheritedKeys = [
|
|
451
|
+
"aboutUrl",
|
|
452
|
+
"datatype",
|
|
453
|
+
"default",
|
|
454
|
+
"lang",
|
|
455
|
+
"null",
|
|
456
|
+
"ordered",
|
|
457
|
+
"propertyUrl",
|
|
458
|
+
"required",
|
|
459
|
+
"separator",
|
|
460
|
+
"textDirection",
|
|
461
|
+
"valueUrl"
|
|
462
|
+
];
|
|
463
|
+
const ownKeys = {
|
|
464
|
+
TableGroup: [
|
|
465
|
+
"tables",
|
|
466
|
+
"dialect",
|
|
467
|
+
"notes",
|
|
468
|
+
"tableDirection",
|
|
469
|
+
"tableSchema",
|
|
470
|
+
"transformations",
|
|
471
|
+
...inheritedKeys
|
|
472
|
+
],
|
|
473
|
+
Table: [
|
|
474
|
+
"url",
|
|
475
|
+
"dialect",
|
|
476
|
+
"notes",
|
|
477
|
+
"suppressOutput",
|
|
478
|
+
"tableDirection",
|
|
479
|
+
"tableSchema",
|
|
480
|
+
"transformations",
|
|
481
|
+
...inheritedKeys
|
|
482
|
+
],
|
|
483
|
+
Schema: [
|
|
484
|
+
"columns",
|
|
485
|
+
"foreignKeys",
|
|
486
|
+
"primaryKey",
|
|
487
|
+
"rowTitles",
|
|
488
|
+
...inheritedKeys
|
|
489
|
+
],
|
|
490
|
+
Column: [
|
|
491
|
+
"name",
|
|
492
|
+
"suppressOutput",
|
|
493
|
+
"titles",
|
|
494
|
+
"virtual",
|
|
495
|
+
...inheritedKeys
|
|
496
|
+
],
|
|
497
|
+
Dialect: [
|
|
498
|
+
"commentPrefix",
|
|
499
|
+
"delimiter",
|
|
500
|
+
"doubleQuote",
|
|
501
|
+
"encoding",
|
|
502
|
+
"header",
|
|
503
|
+
"headerRowCount",
|
|
504
|
+
"lineTerminators",
|
|
505
|
+
"quoteChar",
|
|
506
|
+
"skipBlankRows",
|
|
507
|
+
"skipColumns",
|
|
508
|
+
"skipInitialSpace",
|
|
509
|
+
"skipRows",
|
|
510
|
+
"trim"
|
|
511
|
+
],
|
|
512
|
+
Template: [
|
|
513
|
+
"url",
|
|
514
|
+
"scriptFormat",
|
|
515
|
+
"targetFormat",
|
|
516
|
+
"source",
|
|
517
|
+
"titles"
|
|
518
|
+
],
|
|
519
|
+
Datatype: [
|
|
520
|
+
"base",
|
|
521
|
+
"format",
|
|
522
|
+
"length",
|
|
523
|
+
"minLength",
|
|
524
|
+
"maxLength",
|
|
525
|
+
"minimum",
|
|
526
|
+
"maximum",
|
|
527
|
+
"minInclusive",
|
|
528
|
+
"maxInclusive",
|
|
529
|
+
"minExclusive",
|
|
530
|
+
"maxExclusive"
|
|
531
|
+
],
|
|
532
|
+
ForeignKey: ["columnReference", "reference"],
|
|
533
|
+
Reference: [
|
|
534
|
+
"resource",
|
|
535
|
+
"schemaReference",
|
|
536
|
+
"columnReference"
|
|
537
|
+
]
|
|
538
|
+
};
|
|
539
|
+
const isCommonPropertyName = (key) => key.includes(":");
|
|
540
|
+
const get = (obj, key) => get$1(obj, key);
|
|
541
|
+
/**
|
|
542
|
+
* Checks the keys of a description object: `@id` (a link that must not be a
|
|
543
|
+
* blank node), `@type` (must name the kind), warnings for properties that are
|
|
544
|
+
* not defined for this kind, and errors for unknown keywords.
|
|
545
|
+
*/
|
|
546
|
+
const checkKeys = (obj, kind, ctx) => {
|
|
547
|
+
const strict = kind === "ForeignKey" || kind === "Reference";
|
|
548
|
+
Arr.forEach(keys(obj), (key) => {
|
|
549
|
+
if (key === "@id") {
|
|
550
|
+
const id = obj[key];
|
|
551
|
+
if (Predicate.isString(id) && id.startsWith("_:")) error(ctx, `${kind} @id ${quote(id)} must not be a blank node`);
|
|
552
|
+
else if (!Predicate.isString(id)) warn(ctx, `${kind} @id must be a string`);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
if (key === "@type") {
|
|
556
|
+
if (obj[key] !== kind) error(ctx, `${kind} @type must be "${kind}"`);
|
|
557
|
+
return;
|
|
558
|
+
}
|
|
559
|
+
if (key === "@context") return;
|
|
560
|
+
if (key.startsWith("@")) {
|
|
561
|
+
error(ctx, `${kind} must not use the keyword ${key}`);
|
|
562
|
+
return;
|
|
563
|
+
}
|
|
564
|
+
if (Arr.contains(ownKeys[kind], key)) return;
|
|
565
|
+
if (isCommonPropertyName(key) && !strict) return;
|
|
566
|
+
if (strict) error(ctx, `${kind} must not have the property ${key}`);
|
|
567
|
+
else warn(ctx, `${kind} has an unknown property ${key}`);
|
|
568
|
+
});
|
|
569
|
+
};
|
|
570
|
+
const idOf = (obj, ctx) => Option.flatMap(get(obj, "@id"), (id) => Predicate.isString(id) ? id.startsWith("_:") ? Option.none() : Option.some(resolve(expand(id), ctx.base)) : Option.some(resolve("", ctx.base)));
|
|
571
|
+
const booleanProperty = (obj, key, ctx) => Option.flatMap(get(obj, key), (v) => {
|
|
572
|
+
if (Predicate.isBoolean(v)) return Option.some(v);
|
|
573
|
+
warn(ctx, `${key} must be a boolean, not ${quote(v)}`);
|
|
574
|
+
return Option.none();
|
|
575
|
+
});
|
|
576
|
+
const stringProperty = (obj, key, ctx) => Option.flatMap(get(obj, key), (v) => {
|
|
577
|
+
if (Predicate.isString(v)) return Option.some(v);
|
|
578
|
+
warn(ctx, `${key} must be a string, not ${quote(v)}`);
|
|
579
|
+
return Option.none();
|
|
580
|
+
});
|
|
581
|
+
const nonNegativeInteger = (obj, key, ctx) => Option.flatMap(get(obj, key), (v) => {
|
|
582
|
+
if (Predicate.isNumber(v) && Number.isInteger(v) && v >= 0) return Option.some(v);
|
|
583
|
+
warn(ctx, `${key} must be a non-negative integer, not ${quote(v)}`);
|
|
584
|
+
return Option.none();
|
|
585
|
+
});
|
|
586
|
+
const linkProperty = (obj, key, ctx) => Option.map(get(obj, key), (v) => {
|
|
587
|
+
if (Predicate.isString(v)) return resolve(v, ctx.base);
|
|
588
|
+
warn(ctx, `${key} must be a string, not ${quote(v)}`);
|
|
589
|
+
return resolve("", ctx.base);
|
|
590
|
+
});
|
|
591
|
+
const templateProperty = (obj, key, ctx) => Option.map(get(obj, key), (v) => {
|
|
592
|
+
if (Predicate.isString(v)) return v;
|
|
593
|
+
warn(ctx, `${key} must be a URI template string, not ${quote(v)}`);
|
|
594
|
+
return "";
|
|
595
|
+
});
|
|
596
|
+
const isLanguageTag = (tag) => isWellFormed(tag);
|
|
597
|
+
/** A natural-language property (§Natural Language Properties). */
|
|
598
|
+
const naturalLanguage = (value, key, ctx) => {
|
|
599
|
+
const lang = Option.getOrElse(ctx.language, () => "und");
|
|
600
|
+
const strings = (vs) => Arr.filter(vs, (v) => {
|
|
601
|
+
if (Predicate.isString(v)) return true;
|
|
602
|
+
warn(ctx, `${key} values must be strings, not ${quote(v)}`);
|
|
603
|
+
return false;
|
|
604
|
+
});
|
|
605
|
+
if (Predicate.isString(value)) return { [lang]: [value] };
|
|
606
|
+
if (isArray(value)) return Arr.isReadonlyArrayNonEmpty(value) ? { [lang]: strings(value) } : {};
|
|
607
|
+
if (isObject(value)) return Record.fromEntries(Arr.flatMap(entries(value), ([tag, v]) => {
|
|
608
|
+
if (!isLanguageTag(tag)) {
|
|
609
|
+
warn(ctx, `${key} has an invalid language tag ${quote(tag)}`);
|
|
610
|
+
return [];
|
|
611
|
+
}
|
|
612
|
+
if (Predicate.isString(v)) return [[tag, [v]]];
|
|
613
|
+
if (isArray(v)) return [[tag, strings(v)]];
|
|
614
|
+
warn(ctx, `${key} values must be strings, not ${quote(v)}`);
|
|
615
|
+
return [];
|
|
616
|
+
}));
|
|
617
|
+
warn(ctx, `${key} must be a string, array or language map, not ${quote(value)}`);
|
|
618
|
+
return {};
|
|
619
|
+
};
|
|
620
|
+
const columnReference = (obj, key, ctx, required) => Option.flatMap(get(obj, key), (v) => {
|
|
621
|
+
const refs = Predicate.isString(v) ? Option.some([v]) : isArray(v) && Arr.isReadonlyArrayNonEmpty(v) && Arr.every(v, Predicate.isString) ? Option.some(Arr.filter(v, Predicate.isString)) : Option.none();
|
|
622
|
+
if (Option.isNone(refs)) {
|
|
623
|
+
if (required) error(ctx, `${key} must be a column name or a non-empty array of them`);
|
|
624
|
+
else warn(ctx, `${key} must be a column name or a non-empty array of them`);
|
|
625
|
+
}
|
|
626
|
+
return refs;
|
|
627
|
+
});
|
|
628
|
+
const legitimateTypes = [
|
|
629
|
+
"TableGroup",
|
|
630
|
+
"Table",
|
|
631
|
+
"Schema",
|
|
632
|
+
"Column",
|
|
633
|
+
"Dialect",
|
|
634
|
+
"Template",
|
|
635
|
+
"Datatype"
|
|
636
|
+
];
|
|
637
|
+
const isValidType = (t, valueType) => !t.startsWith("_:") && ((valueType ? isBuiltIn(t) : Arr.contains(legitimateTypes, t)) || Record.has(terms, t) || Option.isSome(expandPrefixed(t)) || isAbsoluteUrl(t) && !t.includes(" "));
|
|
638
|
+
const normalizeCommon = (value, ctx) => {
|
|
639
|
+
if (isArray(value)) return Arr.map(value, (v) => normalizeCommon(v, ctx));
|
|
640
|
+
if (Predicate.isString(value)) return Option.match(ctx.language, {
|
|
641
|
+
onNone: () => ({ "@value": value }),
|
|
642
|
+
onSome: (language) => ({
|
|
643
|
+
"@value": value,
|
|
644
|
+
"@language": language
|
|
645
|
+
})
|
|
646
|
+
});
|
|
647
|
+
if (!isObject(value)) return value;
|
|
648
|
+
if (has(value, "@value")) {
|
|
649
|
+
const v = value["@value"];
|
|
650
|
+
const extra = Arr.filter(keys(value), (k) => !Arr.contains([
|
|
651
|
+
"@value",
|
|
652
|
+
"@type",
|
|
653
|
+
"@language"
|
|
654
|
+
], k));
|
|
655
|
+
if (Arr.isReadonlyArrayNonEmpty(extra)) error(ctx, `a value object must not have the properties ${Arr.join(extra, ", ")}`);
|
|
656
|
+
if (has(value, "@type") && has(value, "@language")) error(ctx, "a value object must not have both @type and @language");
|
|
657
|
+
if (!(Predicate.isString(v) || Predicate.isNumber(v) || Predicate.isBoolean(v))) error(ctx, "@value must be a string, number or boolean");
|
|
658
|
+
Option.map(get(value, "@type"), (t) => {
|
|
659
|
+
if (!Predicate.isString(t) || !isValidType(t, true)) error(ctx, `invalid value @type ${quote(t)}`);
|
|
660
|
+
});
|
|
661
|
+
Option.map(get(value, "@language"), (l) => {
|
|
662
|
+
if (!(Predicate.isNull(l) || Predicate.isString(l) && isLanguageTag(l))) error(ctx, `invalid @language ${quote(l)}`);
|
|
663
|
+
});
|
|
664
|
+
return value;
|
|
665
|
+
}
|
|
666
|
+
return Record.fromEntries(Arr.map(entries(value), ([key, v]) => {
|
|
667
|
+
if (key === "@id") {
|
|
668
|
+
if (!Predicate.isString(v)) {
|
|
669
|
+
error(ctx, "@id must be a string");
|
|
670
|
+
return [key, v];
|
|
671
|
+
}
|
|
672
|
+
if (v.startsWith("_:")) error(ctx, `@id ${quote(v)} must not be a blank node`);
|
|
673
|
+
return [key, resolve(expand(v), ctx.base)];
|
|
674
|
+
}
|
|
675
|
+
if (key === "@type") {
|
|
676
|
+
const types = isArray(v) ? v : [v];
|
|
677
|
+
Arr.forEach(types, (t) => {
|
|
678
|
+
if (!Predicate.isString(t) || !isValidType(t, false)) error(ctx, `invalid node @type ${quote(t)}`);
|
|
679
|
+
});
|
|
680
|
+
return [key, v];
|
|
681
|
+
}
|
|
682
|
+
if (key === "@language") error(ctx, "@language must only be used with @value");
|
|
683
|
+
else if (key === "@context") error(ctx, "a metadata document must not add a new @context");
|
|
684
|
+
else if (key === "@list" || key === "@set") error(ctx, `${key} must not be used`);
|
|
685
|
+
else if (key.startsWith("@")) error(ctx, `unknown keyword ${key}`);
|
|
686
|
+
return [key, normalizeCommon(v, ctx)];
|
|
687
|
+
}));
|
|
688
|
+
};
|
|
689
|
+
/** The common properties of a description object. */
|
|
690
|
+
const commonProperties = (obj, ctx) => Record.fromEntries(Arr.map(Arr.filter(entries(obj), ([key]) => isCommonPropertyName(key) && !key.startsWith("@")), ([key, value]) => [key, normalizeCommon(value, ctx)]));
|
|
691
|
+
const notesOf = (obj, ctx) => Option.match(get(obj, "notes"), {
|
|
692
|
+
onNone: () => [],
|
|
693
|
+
onSome: (v) => {
|
|
694
|
+
if (isArray(v)) return Arr.map(v, (n) => normalizeCommon(n, ctx));
|
|
695
|
+
warn(ctx, "notes must be an array");
|
|
696
|
+
return [];
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
const bound = (obj, key, base, ctx) => Option.flatMap(get(obj, key), (v) => {
|
|
700
|
+
if (Predicate.isNumber(v) || Predicate.isString(v)) {
|
|
701
|
+
if (Option.isNone(boundKey(v, base))) error(ctx, `${key} ${quote(v)} is not a valid ${base}`);
|
|
702
|
+
return Option.some(v);
|
|
703
|
+
}
|
|
704
|
+
warn(ctx, `${key} must be a number or string`);
|
|
705
|
+
return Option.none();
|
|
706
|
+
});
|
|
707
|
+
const sameBound = (a, b, base) => Option.makeEquivalence((x, y) => x === y)(boundKey(a, base), boundKey(b, base));
|
|
708
|
+
/** Whether both values are present and satisfy `f`. */
|
|
709
|
+
const both = (a, b, f) => Option.exists(Option.all([a, b]), ([x, y]) => f(x, y));
|
|
710
|
+
const of = Option.fromNullishOr;
|
|
711
|
+
/** Whether bound `a` is below bound `b` (`strict`) or at most `b`, in `base`'s value space. */
|
|
712
|
+
const below = (base, strict) => (a, b) => Option.exists(Option.all([boundKey(a, base), boundKey(b, base)]), ([x, y]) => strict ? x < y : x <= y);
|
|
713
|
+
const hasLength = (d) => d.length !== void 0 || d.minLength !== void 0 || d.maxLength !== void 0;
|
|
714
|
+
const hasBounds = (d) => d.minInclusive !== void 0 || d.maxInclusive !== void 0 || d.minExclusive !== void 0 || d.maxExclusive !== void 0;
|
|
715
|
+
const lengthApplies = (base) => isString$1(base) || isBinary(base) || base === "anyAtomicType";
|
|
716
|
+
const boundsApply = (base) => isNumeric(base) || isDateTime(base) || isDuration(base);
|
|
717
|
+
/** The datatype constraint combinations that are errors (§Derived Datatypes). */
|
|
718
|
+
const datatypeRules = [
|
|
719
|
+
[(d) => both(of(d.length), of(d.minLength), (l, m) => l < m), () => "length is less than minLength"],
|
|
720
|
+
[(d) => both(of(d.length), of(d.maxLength), (l, m) => l > m), () => "length is greater than maxLength"],
|
|
721
|
+
[(d) => both(of(d.minLength), of(d.maxLength), (l, m) => l > m), () => "minLength is greater than maxLength"],
|
|
722
|
+
[(d) => hasLength(d) && !lengthApplies(d.base), (d) => `length constraints do not apply to ${d.base}`],
|
|
723
|
+
[(d) => hasBounds(d) && !boundsApply(d.base), (d) => `value constraints do not apply to ${d.base}`],
|
|
724
|
+
[(d) => both(of(d.minInclusive), of(d.minExclusive), () => true), () => "minInclusive and minExclusive must not both be specified"],
|
|
725
|
+
[(d) => both(of(d.maxInclusive), of(d.maxExclusive), () => true), () => "maxInclusive and maxExclusive must not both be specified"],
|
|
726
|
+
[(d) => both(of(d.maxInclusive), of(d.minInclusive), below(d.base, true)), () => "maxInclusive is less than minInclusive"],
|
|
727
|
+
[(d) => both(of(d.maxExclusive), of(d.minInclusive), below(d.base, false)), () => "maxExclusive is not greater than minInclusive"],
|
|
728
|
+
[(d) => both(of(d.maxExclusive), of(d.minExclusive), below(d.base, true)), () => "maxExclusive is less than minExclusive"],
|
|
729
|
+
[(d) => both(of(d.maxInclusive), of(d.minExclusive), below(d.base, false)), () => "maxInclusive is not greater than minExclusive"]
|
|
730
|
+
];
|
|
731
|
+
const checkDatatype = (d, ctx) => Arr.forEach(datatypeRules, ([violated, message]) => {
|
|
732
|
+
if (violated(d)) error(ctx, message(d));
|
|
733
|
+
});
|
|
734
|
+
const datatypeObject = (obj, ctx) => {
|
|
735
|
+
checkKeys(obj, "Datatype", ctx);
|
|
736
|
+
const id = idOf(obj, ctx);
|
|
737
|
+
if (Option.isSome(id) && Option.isSome(fromIri(id.value))) {
|
|
738
|
+
if (Arr.some(keys(obj), (k) => k !== "@id" && k !== "@type")) error(ctx, `a datatype with the built-in @id ${id.value} must not have other properties`);
|
|
739
|
+
}
|
|
740
|
+
const base = Option.getOrElse(Option.flatMap(stringProperty(obj, "base", ctx), (b) => {
|
|
741
|
+
if (isBuiltIn(b)) return Option.some(b);
|
|
742
|
+
warn(ctx, `base ${quote(b)} is not a built-in datatype`);
|
|
743
|
+
return Option.some("string");
|
|
744
|
+
}), () => "string");
|
|
745
|
+
const format = Option.flatMap(get(obj, "format"), (f) => {
|
|
746
|
+
const candidate = Predicate.isString(f) ? Option.some(f) : isObject(f) && isNumeric(base) ? Option.some({
|
|
747
|
+
...optional("decimalChar", stringProperty(f, "decimalChar", ctx)),
|
|
748
|
+
...optional("groupChar", stringProperty(f, "groupChar", ctx)),
|
|
749
|
+
...optional("pattern", stringProperty(f, "pattern", ctx))
|
|
750
|
+
}) : Option.none();
|
|
751
|
+
if (Option.isNone(candidate)) {
|
|
752
|
+
warn(ctx, `invalid format for a ${base} datatype`);
|
|
753
|
+
return Option.none();
|
|
754
|
+
}
|
|
755
|
+
return Option.match(checkFormat(base, candidate.value), {
|
|
756
|
+
onNone: () => candidate,
|
|
757
|
+
onSome: (message) => {
|
|
758
|
+
warn(ctx, message);
|
|
759
|
+
return Option.none();
|
|
760
|
+
}
|
|
761
|
+
});
|
|
762
|
+
});
|
|
763
|
+
const minimum = bound(obj, "minimum", base, ctx);
|
|
764
|
+
const maximum = bound(obj, "maximum", base, ctx);
|
|
765
|
+
const minInclusive = bound(obj, "minInclusive", base, ctx);
|
|
766
|
+
const maxInclusive = bound(obj, "maxInclusive", base, ctx);
|
|
767
|
+
if (Option.isSome(minimum) && Option.isSome(minInclusive) && !sameBound(minimum.value, minInclusive.value, base)) error(ctx, "minimum and minInclusive differ");
|
|
768
|
+
if (Option.isSome(maximum) && Option.isSome(maxInclusive) && !sameBound(maximum.value, maxInclusive.value, base)) error(ctx, "maximum and maxInclusive differ");
|
|
769
|
+
const datatype = {
|
|
770
|
+
base,
|
|
771
|
+
...optional("id", id),
|
|
772
|
+
...optional("format", format),
|
|
773
|
+
...optional("length", nonNegativeInteger(obj, "length", ctx)),
|
|
774
|
+
...optional("minLength", nonNegativeInteger(obj, "minLength", ctx)),
|
|
775
|
+
...optional("maxLength", nonNegativeInteger(obj, "maxLength", ctx)),
|
|
776
|
+
...optional("minInclusive", Option.orElse(minInclusive, () => minimum)),
|
|
777
|
+
...optional("maxInclusive", Option.orElse(maxInclusive, () => maximum)),
|
|
778
|
+
...optional("minExclusive", bound(obj, "minExclusive", base, ctx)),
|
|
779
|
+
...optional("maxExclusive", bound(obj, "maxExclusive", base, ctx)),
|
|
780
|
+
common: commonProperties(obj, ctx)
|
|
781
|
+
};
|
|
782
|
+
checkDatatype(datatype, ctx);
|
|
783
|
+
return datatype;
|
|
784
|
+
};
|
|
785
|
+
const datatypeProperty = (value, ctx) => {
|
|
786
|
+
if (Predicate.isString(value)) {
|
|
787
|
+
if (isBuiltIn(value)) return Option.some({
|
|
788
|
+
base: value,
|
|
789
|
+
common: {}
|
|
790
|
+
});
|
|
791
|
+
warn(ctx, `datatype ${quote(value)} is not a built-in datatype`);
|
|
792
|
+
return Option.some(string);
|
|
793
|
+
}
|
|
794
|
+
if (isObject(value)) return Option.some(datatypeObject(value, ctx));
|
|
795
|
+
warn(ctx, `datatype must be a string or object, not ${quote(value)}`);
|
|
796
|
+
return Option.some(string);
|
|
797
|
+
};
|
|
798
|
+
const inheritedOf = (obj, ctx) => {
|
|
799
|
+
const nulls = Option.flatMap(get(obj, "null"), (v) => {
|
|
800
|
+
if (Predicate.isString(v)) return Option.some([v]);
|
|
801
|
+
if (isArray(v)) {
|
|
802
|
+
const strings = Arr.filter(v, Predicate.isString);
|
|
803
|
+
if (Arr.length(strings) !== Arr.length(v)) warn(ctx, "null values must be strings");
|
|
804
|
+
return Option.some(strings);
|
|
805
|
+
}
|
|
806
|
+
warn(ctx, `null must be a string or array of strings, not ${quote(v)}`);
|
|
807
|
+
return Option.some([""]);
|
|
808
|
+
});
|
|
809
|
+
const lang = Option.flatMap(stringProperty(obj, "lang", ctx), (l) => {
|
|
810
|
+
if (isLanguageTag(l)) return Option.some(l);
|
|
811
|
+
warn(ctx, `lang ${quote(l)} is not a valid language tag`);
|
|
812
|
+
return Option.some("und");
|
|
813
|
+
});
|
|
814
|
+
const separator = Option.flatMap(get(obj, "separator"), (v) => {
|
|
815
|
+
if (Predicate.isString(v) || Predicate.isNull(v)) return Option.some(v);
|
|
816
|
+
warn(ctx, `separator must be a string or null, not ${quote(v)}`);
|
|
817
|
+
return Option.some(null);
|
|
818
|
+
});
|
|
819
|
+
const textDirection = Option.flatMap(get(obj, "textDirection"), (v) => {
|
|
820
|
+
if (v === "ltr" || v === "rtl" || v === "auto" || v === "inherit") return Option.some(v);
|
|
821
|
+
warn(ctx, `textDirection must be "ltr", "rtl", "auto" or "inherit", not ${quote(v)}`);
|
|
822
|
+
return Option.some("inherit");
|
|
823
|
+
});
|
|
824
|
+
const defaultValue = Option.flatMap(get(obj, "default"), (v) => {
|
|
825
|
+
if (Predicate.isString(v)) return Option.some(v);
|
|
826
|
+
warn(ctx, `default must be a string, not ${quote(v)}`);
|
|
827
|
+
return Option.some("");
|
|
828
|
+
});
|
|
829
|
+
const flag = (key) => Option.flatMap(get(obj, key), (v) => {
|
|
830
|
+
if (Predicate.isBoolean(v)) return Option.some(v);
|
|
831
|
+
warn(ctx, `${key} must be a boolean, not ${quote(v)}`);
|
|
832
|
+
return Option.some(false);
|
|
833
|
+
});
|
|
834
|
+
return {
|
|
835
|
+
...optional("aboutUrl", templateProperty(obj, "aboutUrl", ctx)),
|
|
836
|
+
...optional("datatype", Option.flatMap(get(obj, "datatype"), (v) => datatypeProperty(v, ctx))),
|
|
837
|
+
...optional("default", defaultValue),
|
|
838
|
+
...optional("lang", lang),
|
|
839
|
+
...optional("null", nulls),
|
|
840
|
+
...optional("ordered", flag("ordered")),
|
|
841
|
+
...optional("propertyUrl", templateProperty(obj, "propertyUrl", ctx)),
|
|
842
|
+
...optional("required", flag("required")),
|
|
843
|
+
...optional("separator", separator),
|
|
844
|
+
...optional("textDirection", textDirection),
|
|
845
|
+
...optional("valueUrl", templateProperty(obj, "valueUrl", ctx))
|
|
846
|
+
};
|
|
847
|
+
};
|
|
848
|
+
const COLUMN_NAME = /^(?:[A-Za-z0-9]|%[0-9A-Fa-f]{2})(?:[A-Za-z0-9_.]|%[0-9A-Fa-f]{2})*$/;
|
|
849
|
+
const columnOf = (obj, ctx) => {
|
|
850
|
+
checkKeys(obj, "Column", ctx);
|
|
851
|
+
const titles = Option.match(get(obj, "titles"), {
|
|
852
|
+
onNone: () => ({}),
|
|
853
|
+
onSome: (v) => naturalLanguage(v, "titles", ctx)
|
|
854
|
+
});
|
|
855
|
+
const name = Option.flatMap(get(obj, "name"), (v) => {
|
|
856
|
+
if (!Predicate.isString(v)) {
|
|
857
|
+
warn(ctx, `column name must be a string, not ${quote(v)}`);
|
|
858
|
+
return Option.none();
|
|
859
|
+
}
|
|
860
|
+
if (!COLUMN_NAME.test(v) || v.startsWith("_")) {
|
|
861
|
+
warn(ctx, `invalid column name ${quote(v)}`);
|
|
862
|
+
return Option.none();
|
|
863
|
+
}
|
|
864
|
+
return Option.some(v);
|
|
865
|
+
});
|
|
866
|
+
return {
|
|
867
|
+
...optional("id", idOf(obj, ctx)),
|
|
868
|
+
...optional("name", name),
|
|
869
|
+
...optional("titleName", Option.flatMap(Record.get(titles, Option.getOrElse(ctx.language, () => "und")), Arr.head)),
|
|
870
|
+
titles,
|
|
871
|
+
isVirtual: Option.getOrElse(booleanProperty(obj, "virtual", ctx), () => false),
|
|
872
|
+
isSuppressed: Option.getOrElse(booleanProperty(obj, "suppressOutput", ctx), () => false),
|
|
873
|
+
inherited: inheritedOf(obj, ctx),
|
|
874
|
+
common: commonProperties(obj, ctx)
|
|
875
|
+
};
|
|
876
|
+
};
|
|
877
|
+
const arrayProperty = (obj, key, ctx) => Option.match(get(obj, key), {
|
|
878
|
+
onNone: () => [],
|
|
879
|
+
onSome: (v) => {
|
|
880
|
+
if (!isArray(v)) {
|
|
881
|
+
warn(ctx, `${key} must be an array`);
|
|
882
|
+
return [];
|
|
883
|
+
}
|
|
884
|
+
return Arr.filter(v, (item) => {
|
|
885
|
+
if (isObject(item)) return true;
|
|
886
|
+
warn(ctx, `${key} items must be objects, not ${quote(item)}`);
|
|
887
|
+
return false;
|
|
888
|
+
});
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
const foreignKeyOf = (obj, ctx) => {
|
|
892
|
+
checkKeys(obj, "ForeignKey", ctx);
|
|
893
|
+
const columns = columnReference(obj, "columnReference", ctx, true);
|
|
894
|
+
const reference = Option.flatMap(get(obj, "reference"), (r) => {
|
|
895
|
+
if (!isObject(r)) {
|
|
896
|
+
error(ctx, "foreign key reference must be an object");
|
|
897
|
+
return Option.none();
|
|
898
|
+
}
|
|
899
|
+
checkKeys(r, "Reference", ctx);
|
|
900
|
+
const resource = linkProperty(r, "resource", ctx);
|
|
901
|
+
const schemaReference = linkProperty(r, "schemaReference", ctx);
|
|
902
|
+
if (Option.isSome(resource) === Option.isSome(schemaReference)) error(ctx, "foreign key reference needs exactly one of resource and schemaReference");
|
|
903
|
+
return Option.map(columnReference(r, "columnReference", ctx, true), (cols) => ({
|
|
904
|
+
...optional("resource", resource),
|
|
905
|
+
...optional("schemaReference", schemaReference),
|
|
906
|
+
columnReference: cols
|
|
907
|
+
}));
|
|
908
|
+
});
|
|
909
|
+
if (Option.isNone(reference) && !has(obj, "reference")) error(ctx, "foreign key needs a reference");
|
|
910
|
+
return Option.map(Option.all([columns, reference]), ([from, to]) => ({
|
|
911
|
+
columnReference: from,
|
|
912
|
+
reference: to
|
|
913
|
+
}));
|
|
914
|
+
};
|
|
915
|
+
const schemaOf = (obj, ctx) => {
|
|
916
|
+
checkKeys(obj, "Schema", ctx);
|
|
917
|
+
const columns = Arr.map(arrayProperty(obj, "columns", ctx), (c) => columnOf(c, ctx));
|
|
918
|
+
const names = Arr.getSomes(Arr.map(columns, (c) => Option.fromNullishOr(c.name)));
|
|
919
|
+
if (Arr.length(Arr.dedupe(names)) !== Arr.length(names)) error(ctx, "column names must be unique");
|
|
920
|
+
const firstVirtual = Arr.findFirstIndex(columns, (c) => c.isVirtual);
|
|
921
|
+
if (Option.exists(firstVirtual, (i) => Arr.some(Arr.drop(columns, i), (c) => !c.isVirtual))) error(ctx, "virtual columns must follow every non-virtual column");
|
|
922
|
+
const references = (key) => Option.flatMap(columnReference(obj, key, ctx, false), (refs) => {
|
|
923
|
+
if (Arr.every(refs, (r) => Arr.contains(names, r))) return Option.some(refs);
|
|
924
|
+
warn(ctx, `${key} references a column that does not exist`);
|
|
925
|
+
return Option.none();
|
|
926
|
+
});
|
|
927
|
+
const foreignKeys = Arr.getSomes(Arr.map(arrayProperty(obj, "foreignKeys", ctx), (fk) => foreignKeyOf(fk, ctx)));
|
|
928
|
+
Arr.forEach(foreignKeys, (fk) => {
|
|
929
|
+
if (!Arr.every(fk.columnReference, (r) => Arr.contains(names, r))) error(ctx, "foreign key columnReference references a column that does not exist");
|
|
930
|
+
});
|
|
931
|
+
return {
|
|
932
|
+
...optional("id", idOf(obj, ctx)),
|
|
933
|
+
columns,
|
|
934
|
+
...optional("primaryKey", references("primaryKey")),
|
|
935
|
+
...optional("rowTitles", references("rowTitles")),
|
|
936
|
+
foreignKeys,
|
|
937
|
+
inherited: inheritedOf(obj, ctx),
|
|
938
|
+
common: commonProperties(obj, ctx)
|
|
939
|
+
};
|
|
940
|
+
};
|
|
941
|
+
const isEncoding = (encoding) => Result.isSuccess(Result.try(() => new TextDecoder(encoding)));
|
|
942
|
+
const dialectOf = (obj, ctx) => {
|
|
943
|
+
checkKeys(obj, "Dialect", ctx);
|
|
944
|
+
const d = defaultDialect;
|
|
945
|
+
const header = booleanProperty(obj, "header", ctx);
|
|
946
|
+
const headerRowCount = nonNegativeInteger(obj, "headerRowCount", ctx);
|
|
947
|
+
const skipInitialSpace = booleanProperty(obj, "skipInitialSpace", ctx);
|
|
948
|
+
const trim = Option.flatMap(get(obj, "trim"), (v) => {
|
|
949
|
+
if (Predicate.isBoolean(v)) return Option.some(v ? "true" : "false");
|
|
950
|
+
if (v === "true" || v === "false" || v === "start" || v === "end") return Option.some(v);
|
|
951
|
+
warn(ctx, `trim must be a boolean or "true", "false", "start" or "end", not ${quote(v)}`);
|
|
952
|
+
return Option.none();
|
|
953
|
+
});
|
|
954
|
+
const quoteChar = Option.flatMap(get(obj, "quoteChar"), (v) => {
|
|
955
|
+
if (Predicate.isString(v) || Predicate.isNull(v)) return Option.some(v);
|
|
956
|
+
warn(ctx, `quoteChar must be a string or null, not ${quote(v)}`);
|
|
957
|
+
return Option.none();
|
|
958
|
+
});
|
|
959
|
+
const lineTerminators = Option.flatMap(get(obj, "lineTerminators"), (v) => {
|
|
960
|
+
if (Predicate.isString(v)) return Option.some([v]);
|
|
961
|
+
if (isArray(v) && Arr.every(v, Predicate.isString)) return Option.some(Arr.filter(v, Predicate.isString));
|
|
962
|
+
warn(ctx, "lineTerminators must be a string or an array of strings");
|
|
963
|
+
return Option.none();
|
|
964
|
+
});
|
|
965
|
+
const encoding = Option.flatMap(stringProperty(obj, "encoding", ctx), (e) => {
|
|
966
|
+
if (isEncoding(e)) return Option.some(e);
|
|
967
|
+
warn(ctx, `unknown encoding ${quote(e)}`);
|
|
968
|
+
return Option.none();
|
|
969
|
+
});
|
|
970
|
+
return {
|
|
971
|
+
...optional("id", idOf(obj, ctx)),
|
|
972
|
+
...optional("commentPrefix", stringProperty(obj, "commentPrefix", ctx)),
|
|
973
|
+
delimiter: Option.getOrElse(stringProperty(obj, "delimiter", ctx), () => d.delimiter),
|
|
974
|
+
isDoubleQuoted: Option.getOrElse(booleanProperty(obj, "doubleQuote", ctx), () => d.isDoubleQuoted),
|
|
975
|
+
encoding: Option.getOrElse(encoding, () => d.encoding),
|
|
976
|
+
headerRowCount: Option.getOrElse(headerRowCount, () => Option.getOrElse(Option.map(header, (h) => h ? 1 : 0), () => d.headerRowCount)),
|
|
977
|
+
lineTerminators: Option.getOrElse(lineTerminators, () => d.lineTerminators),
|
|
978
|
+
quoteChar: Option.getOrElse(quoteChar, () => d.quoteChar),
|
|
979
|
+
shouldSkipBlankRows: Option.getOrElse(booleanProperty(obj, "skipBlankRows", ctx), () => d.shouldSkipBlankRows),
|
|
980
|
+
skipColumns: Option.getOrElse(nonNegativeInteger(obj, "skipColumns", ctx), () => d.skipColumns),
|
|
981
|
+
skipRows: Option.getOrElse(nonNegativeInteger(obj, "skipRows", ctx), () => d.skipRows),
|
|
982
|
+
trim: Option.getOrElse(trim, () => Option.getOrElse(Option.map(skipInitialSpace, (s) => s ? "start" : "false"), () => d.trim))
|
|
983
|
+
};
|
|
984
|
+
};
|
|
985
|
+
const transformationOf = (obj, ctx) => {
|
|
986
|
+
checkKeys(obj, "Template", ctx);
|
|
987
|
+
const required = (key) => {
|
|
988
|
+
const v = linkProperty(obj, key, ctx);
|
|
989
|
+
if (Option.isNone(v)) error(ctx, `transformation needs ${key}`);
|
|
990
|
+
return v;
|
|
991
|
+
};
|
|
992
|
+
const url = required("url");
|
|
993
|
+
const scriptFormat = required("scriptFormat");
|
|
994
|
+
const targetFormat = required("targetFormat");
|
|
995
|
+
const source = Option.flatMap(stringProperty(obj, "source", ctx), (s) => {
|
|
996
|
+
if (s === "json" || s === "rdf") return Option.some(s);
|
|
997
|
+
warn(ctx, `transformation source must be "json" or "rdf", not ${quote(s)}`);
|
|
998
|
+
return Option.none();
|
|
999
|
+
});
|
|
1000
|
+
return Option.map(Option.all([
|
|
1001
|
+
url,
|
|
1002
|
+
scriptFormat,
|
|
1003
|
+
targetFormat
|
|
1004
|
+
]), ([u, sf, tf]) => ({
|
|
1005
|
+
...optional("id", idOf(obj, ctx)),
|
|
1006
|
+
url: u,
|
|
1007
|
+
scriptFormat: sf,
|
|
1008
|
+
targetFormat: tf,
|
|
1009
|
+
...optional("source", source),
|
|
1010
|
+
titles: Option.match(get(obj, "titles"), {
|
|
1011
|
+
onNone: () => ({}),
|
|
1012
|
+
onSome: (v) => naturalLanguage(v, "titles", ctx)
|
|
1013
|
+
}),
|
|
1014
|
+
common: commonProperties(obj, ctx)
|
|
1015
|
+
}));
|
|
1016
|
+
};
|
|
1017
|
+
const tableDirectionOf = (obj, ctx) => Option.flatMap(get(obj, "tableDirection"), (v) => {
|
|
1018
|
+
if (v === "ltr" || v === "rtl" || v === "auto") return Option.some(v);
|
|
1019
|
+
warn(ctx, `tableDirection must be "ltr", "rtl" or "auto", not ${quote(v)}`);
|
|
1020
|
+
return Option.some("auto");
|
|
1021
|
+
});
|
|
1022
|
+
const contextOf = (doc, url, issues, required) => {
|
|
1023
|
+
const fail = (message) => Result.fail(new MetadataError({
|
|
1024
|
+
message,
|
|
1025
|
+
url
|
|
1026
|
+
}));
|
|
1027
|
+
const ctx = {
|
|
1028
|
+
url,
|
|
1029
|
+
base: url,
|
|
1030
|
+
language: Option.none(),
|
|
1031
|
+
issues
|
|
1032
|
+
};
|
|
1033
|
+
return Option.match(get(doc, "@context"), {
|
|
1034
|
+
onNone: () => required ? fail("a metadata document must have a @context") : Result.succeed(ctx),
|
|
1035
|
+
onSome: (c) => {
|
|
1036
|
+
if (c === CSVW_CONTEXT) return Result.succeed(ctx);
|
|
1037
|
+
if (!isArray(c) || Arr.length(c) !== 2 || c[0] !== CSVW_CONTEXT) return fail(`@context must be "${CSVW_CONTEXT}" or ["${CSVW_CONTEXT}", {…}]`);
|
|
1038
|
+
const local = c[1];
|
|
1039
|
+
if (local === void 0 || !isObject(local)) return fail("the local @context must be an object");
|
|
1040
|
+
const others = Arr.filter(keys(local), (k) => k !== "@base" && k !== "@language");
|
|
1041
|
+
if (Arr.isReadonlyArrayNonEmpty(others)) return fail(`the local @context must only define @base and @language, not ${Arr.join(others, ", ")}`);
|
|
1042
|
+
const base = Option.match(get(local, "@base"), {
|
|
1043
|
+
onNone: () => url,
|
|
1044
|
+
onSome: (b) => {
|
|
1045
|
+
if (Predicate.isString(b)) return resolve(b, url);
|
|
1046
|
+
issues.push(warning("@base must be a string", { table: url }));
|
|
1047
|
+
return url;
|
|
1048
|
+
}
|
|
1049
|
+
});
|
|
1050
|
+
const language = Option.flatMap(get(local, "@language"), (l) => {
|
|
1051
|
+
if (Predicate.isString(l) && isLanguageTag(l)) return Option.some(l);
|
|
1052
|
+
issues.push(warning(`@language ${quote(l)} is not a valid language tag`, { table: url }));
|
|
1053
|
+
return Option.none();
|
|
1054
|
+
});
|
|
1055
|
+
return Result.succeed({
|
|
1056
|
+
url,
|
|
1057
|
+
base,
|
|
1058
|
+
language,
|
|
1059
|
+
issues
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
});
|
|
1063
|
+
};
|
|
1064
|
+
const parseDocument = (text, url) => Result.mapError(parseJson(text), (message) => new MetadataError({
|
|
1065
|
+
message: `invalid JSON: ${message}`,
|
|
1066
|
+
url
|
|
1067
|
+
}));
|
|
1068
|
+
const objectProperty = (obj, key, ctx, load) => Option.match(get(obj, key), {
|
|
1069
|
+
onNone: () => Effect.succeedNone,
|
|
1070
|
+
onSome: (v) => {
|
|
1071
|
+
if (isObject(v)) {
|
|
1072
|
+
if (has(v, "@context")) error(ctx, `${key} must not have a @context`);
|
|
1073
|
+
return Effect.succeedSome({
|
|
1074
|
+
obj: v,
|
|
1075
|
+
ctx
|
|
1076
|
+
});
|
|
1077
|
+
}
|
|
1078
|
+
if (Predicate.isString(v)) {
|
|
1079
|
+
const url = resolve(v, ctx.base);
|
|
1080
|
+
return Effect.flatMap(load(url), (text) => Effect.fromResult(Result.flatMap(parseDocument(text, url), (doc) => {
|
|
1081
|
+
if (!isObject(doc)) return Result.fail(new MetadataError({
|
|
1082
|
+
message: `${key} must be an object`,
|
|
1083
|
+
url
|
|
1084
|
+
}));
|
|
1085
|
+
return Result.map(contextOf(doc, url, ctx.issues, false), (sub) => Option.some({
|
|
1086
|
+
obj: has(doc, "@id") ? doc : set(doc, "@id", url),
|
|
1087
|
+
ctx: sub
|
|
1088
|
+
}));
|
|
1089
|
+
})));
|
|
1090
|
+
}
|
|
1091
|
+
warn(ctx, `${key} must be an object or a URL, not ${quote(v)}`);
|
|
1092
|
+
return Effect.succeedSome({
|
|
1093
|
+
obj: {},
|
|
1094
|
+
ctx
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
/** The properties table and table group descriptions share. */
|
|
1099
|
+
const sharedProperties = Effect.fnUntraced(function* (obj, ctx, load) {
|
|
1100
|
+
const schema = yield* objectProperty(obj, "tableSchema", ctx, load);
|
|
1101
|
+
const dialect = yield* objectProperty(obj, "dialect", ctx, load);
|
|
1102
|
+
return {
|
|
1103
|
+
...optional("id", idOf(obj, ctx)),
|
|
1104
|
+
...optional("dialect", Option.map(dialect, (d) => dialectOf(d.obj, d.ctx))),
|
|
1105
|
+
notes: notesOf(obj, ctx),
|
|
1106
|
+
...optional("tableDirection", tableDirectionOf(obj, ctx)),
|
|
1107
|
+
...optional("tableSchema", Option.map(schema, (s) => schemaOf(s.obj, s.ctx))),
|
|
1108
|
+
transformations: Arr.getSomes(Arr.map(arrayProperty(obj, "transformations", ctx), (t) => transformationOf(t, ctx))),
|
|
1109
|
+
inherited: inheritedOf(obj, ctx),
|
|
1110
|
+
common: commonProperties(obj, ctx)
|
|
1111
|
+
};
|
|
1112
|
+
});
|
|
1113
|
+
const describedTable = Effect.fnUntraced(function* (obj, ctx, load) {
|
|
1114
|
+
checkKeys(obj, "Table", ctx);
|
|
1115
|
+
const url = linkProperty(obj, "url", ctx);
|
|
1116
|
+
if (Option.isNone(url) || !Predicate.isString(obj["url"])) error(ctx, "a table must have a url");
|
|
1117
|
+
return {
|
|
1118
|
+
...yield* sharedProperties(obj, ctx, load),
|
|
1119
|
+
url: Option.getOrElse(url, () => ctx.base),
|
|
1120
|
+
isSuppressed: Option.getOrElse(booleanProperty(obj, "suppressOutput", ctx), () => false)
|
|
1121
|
+
};
|
|
1122
|
+
});
|
|
1123
|
+
const describedGroup = Effect.fnUntraced(function* (obj, ctx, load) {
|
|
1124
|
+
checkKeys(obj, "TableGroup", ctx);
|
|
1125
|
+
const tables = yield* Effect.forEach(arrayProperty(obj, "tables", ctx), (t) => describedTable(t, ctx, load), { concurrency: 1 });
|
|
1126
|
+
if (!Arr.isReadonlyArrayNonEmpty(tables)) error(ctx, "a table group must have at least one table");
|
|
1127
|
+
return {
|
|
1128
|
+
...yield* sharedProperties(obj, ctx, load),
|
|
1129
|
+
tables
|
|
1130
|
+
};
|
|
1131
|
+
});
|
|
1132
|
+
/**
|
|
1133
|
+
* Decodes a parsed metadata document found at `url` into a normalized table
|
|
1134
|
+
* group (a table description becomes a group of one), fetching the schemas
|
|
1135
|
+
* and dialects it references by URL with `load`. Warnings are returned with
|
|
1136
|
+
* the group; errors fail with `MetadataError`.
|
|
1137
|
+
*
|
|
1138
|
+
* @since 0.1.0
|
|
1139
|
+
* @category decoding
|
|
1140
|
+
*/
|
|
1141
|
+
const decodeJson = Effect.fnUntraced(function* (document, url, load) {
|
|
1142
|
+
if (!isObject(document)) return yield* new MetadataError({
|
|
1143
|
+
message: "a metadata document must be an object",
|
|
1144
|
+
url
|
|
1145
|
+
});
|
|
1146
|
+
const issues = [];
|
|
1147
|
+
const ctx = yield* Effect.fromResult(contextOf(document, url, issues, true));
|
|
1148
|
+
const isGroup = has(document, "tables");
|
|
1149
|
+
if (!isGroup && !has(document, "url")) return yield* new MetadataError({
|
|
1150
|
+
message: "a metadata document must describe a table group (tables) or a table (url)",
|
|
1151
|
+
url
|
|
1152
|
+
});
|
|
1153
|
+
const group = isGroup ? yield* describedGroup(document, ctx, load) : {
|
|
1154
|
+
tables: [yield* describedTable(document, ctx, load)],
|
|
1155
|
+
notes: [],
|
|
1156
|
+
transformations: [],
|
|
1157
|
+
inherited: {},
|
|
1158
|
+
common: {}
|
|
1159
|
+
};
|
|
1160
|
+
const first = Arr.findFirst(issues, (i) => i.level === "error");
|
|
1161
|
+
if (Option.isSome(first)) return yield* new MetadataError({
|
|
1162
|
+
message: first.value.message,
|
|
1163
|
+
url
|
|
1164
|
+
});
|
|
1165
|
+
return {
|
|
1166
|
+
group,
|
|
1167
|
+
warnings: issues
|
|
1168
|
+
};
|
|
1169
|
+
});
|
|
1170
|
+
/**
|
|
1171
|
+
* Decodes metadata text found at `url` (see `decodeJson`); invalid JSON fails
|
|
1172
|
+
* with `MetadataError`.
|
|
1173
|
+
*
|
|
1174
|
+
* @since 0.1.0
|
|
1175
|
+
* @category decoding
|
|
1176
|
+
*/
|
|
1177
|
+
const decode = (text, url, load) => Effect.flatMap(Effect.fromResult(parseDocument(text, url)), (doc) => decodeJson(doc, url, load));
|
|
1178
|
+
/**
|
|
1179
|
+
* A `Fetch` that fails for every URL: for metadata that references no other
|
|
1180
|
+
* document.
|
|
1181
|
+
*
|
|
1182
|
+
* @since 0.1.0
|
|
1183
|
+
* @category decoding
|
|
1184
|
+
*/
|
|
1185
|
+
const noFetch = (url) => Effect.fail(new MetadataError({
|
|
1186
|
+
message: `cannot fetch ${url}`,
|
|
1187
|
+
url
|
|
1188
|
+
}));
|
|
1189
|
+
/**
|
|
1190
|
+
* The effective inherited properties of a column: its own, then its schema's,
|
|
1191
|
+
* its table's and its group's.
|
|
1192
|
+
*
|
|
1193
|
+
* @since 0.1.0
|
|
1194
|
+
* @category inheritance
|
|
1195
|
+
*/
|
|
1196
|
+
const inherit = (...levels) => Arr.reduceRight(levels, noInherited, (acc, level) => ({
|
|
1197
|
+
...acc,
|
|
1198
|
+
...level
|
|
1199
|
+
}));
|
|
1200
|
+
const noInherited = {};
|
|
1201
|
+
/**
|
|
1202
|
+
* The table's effective schema: its own, or its group's.
|
|
1203
|
+
*
|
|
1204
|
+
* @since 0.1.0
|
|
1205
|
+
* @category inheritance
|
|
1206
|
+
*/
|
|
1207
|
+
const schemaOfTable = (group, table) => Option.orElse(Option.fromNullishOr(table.tableSchema), () => Option.fromNullishOr(group.tableSchema));
|
|
1208
|
+
/**
|
|
1209
|
+
* The table's effective dialect: its own, its group's, or the default.
|
|
1210
|
+
*
|
|
1211
|
+
* @since 0.1.0
|
|
1212
|
+
* @category inheritance
|
|
1213
|
+
*/
|
|
1214
|
+
const dialectOfTable = (group, table) => table.dialect ?? group.dialect ?? defaultDialect;
|
|
1215
|
+
/**
|
|
1216
|
+
* Whether two language tags match for title comparison: `und` matches any
|
|
1217
|
+
* language, and tags match when equal after truncation to the shorter one.
|
|
1218
|
+
*
|
|
1219
|
+
* @since 0.1.0
|
|
1220
|
+
* @category compatibility
|
|
1221
|
+
*/
|
|
1222
|
+
const languagesMatch = (a, b) => {
|
|
1223
|
+
if (a === "und" || b === "und") return true;
|
|
1224
|
+
const x = a.toLowerCase().split("-");
|
|
1225
|
+
const y = b.toLowerCase().split("-");
|
|
1226
|
+
const n = Math.min(Arr.length(x), Arr.length(y));
|
|
1227
|
+
return Arr.join(Arr.take(x, n), "-") === Arr.join(Arr.take(y, n), "-");
|
|
1228
|
+
};
|
|
1229
|
+
const titleEntries = (titles) => Arr.flatMap(Record.toEntries(titles), ([lang, ts]) => Arr.map(ts, (t) => [lang, t]));
|
|
1230
|
+
/**
|
|
1231
|
+
* Whether two column descriptions are compatible (§Schema Compatibility).
|
|
1232
|
+
*
|
|
1233
|
+
* @since 0.1.0
|
|
1234
|
+
* @category compatibility
|
|
1235
|
+
*/
|
|
1236
|
+
const columnsCompatible = (a, b, validating) => {
|
|
1237
|
+
const aTitles = titleEntries(a.titles);
|
|
1238
|
+
const bTitles = titleEntries(b.titles);
|
|
1239
|
+
const aEmpty = a.name === void 0 && !Arr.isReadonlyArrayNonEmpty(aTitles);
|
|
1240
|
+
const bEmpty = b.name === void 0 && !Arr.isReadonlyArrayNonEmpty(bTitles);
|
|
1241
|
+
if (aEmpty || bEmpty) return true;
|
|
1242
|
+
if (a.name !== void 0 && a.name === b.name) return true;
|
|
1243
|
+
if (Arr.some(aTitles, ([la, ta]) => Arr.some(bTitles, ([lb, tb]) => ta === tb && languagesMatch(la, lb)))) return true;
|
|
1244
|
+
if (!validating) {
|
|
1245
|
+
const nameOnly = (c, ts) => c.name !== void 0 && !Arr.isReadonlyArrayNonEmpty(ts);
|
|
1246
|
+
const titlesOnly = (c, ts) => c.name === void 0 && Arr.isReadonlyArrayNonEmpty(ts);
|
|
1247
|
+
if (nameOnly(a, aTitles) && titlesOnly(b, bTitles) || titlesOnly(a, aTitles) && nameOnly(b, bTitles)) return true;
|
|
1248
|
+
}
|
|
1249
|
+
return false;
|
|
1250
|
+
};
|
|
1251
|
+
/**
|
|
1252
|
+
* Checks a table's schema against the columns embedded in its data
|
|
1253
|
+
* (§Schema Compatibility), returning the reason they are incompatible.
|
|
1254
|
+
*
|
|
1255
|
+
* @since 0.1.0
|
|
1256
|
+
* @category compatibility
|
|
1257
|
+
*/
|
|
1258
|
+
const checkCompatible = (schema, embedded, validating) => {
|
|
1259
|
+
const real = Arr.filter(schema, (c) => !c.isVirtual);
|
|
1260
|
+
if (Arr.length(real) !== Arr.length(embedded)) return Option.some(`the metadata describes ${Arr.length(real)} columns but the data has ${Arr.length(embedded)}`);
|
|
1261
|
+
return Option.map(Arr.findFirstIndex(Arr.zip(real, embedded), ([a, b]) => !columnsCompatible(a, b, validating)), (i) => `column ${i + 1} of the metadata is not compatible with the data's header`);
|
|
1262
|
+
};
|
|
1263
|
+
/**
|
|
1264
|
+
* Whether a table group describes the table at `url` (URLs compared after
|
|
1265
|
+
* normalization).
|
|
1266
|
+
*
|
|
1267
|
+
* @since 0.1.0
|
|
1268
|
+
* @category compatibility
|
|
1269
|
+
*/
|
|
1270
|
+
const describes = (group, url) => Arr.some(group.tables, (t) => normalize(t.url) === normalize(url));
|
|
1271
|
+
export { normalize as A, keys as B, dialectOfTable as C, schemaOfTable as D, noFetch as E, entries as F, get$1 as I, has as L, withoutFragment as M, optional as N, decodeName as O, describe as P, isArray as R, describes as S, languagesMatch as T, mapValues as V, checkCompatible as _, Inherited as a, decodeJson as b, Metadata_exports as c, TableDirection as d, TableGroup as f, Trim as g, Transformation as h, ForeignKey as i, resolve as j, encodeName as k, Reference as l, TextDirection as m, CommonProperties as n, LanguageMap as o, TableSchema as p, Dialect as r, MetadataError as s, Column as t, Table as u, columnsCompatible as v, inherit as w, defaultDialect as x, decode as y, isObject as z };
|
|
1272
|
+
|
|
1273
|
+
//# sourceMappingURL=Metadata-D4HsQNXr.mjs.map
|