@nicia-ai/typegraph 0.45.0 → 0.46.1
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/dist/backend/drizzle/indexes.cjs +11 -11
- package/dist/backend/drizzle/indexes.d.cts +1 -1
- package/dist/backend/drizzle/indexes.d.ts +1 -1
- package/dist/backend/drizzle/indexes.js +7 -7
- package/dist/backend/index.cjs +53 -54
- package/dist/backend/index.d.cts +3 -3
- package/dist/backend/index.d.ts +3 -3
- package/dist/backend/index.js +13 -14
- package/dist/backend/postgres/index.cjs +29 -30
- package/dist/backend/postgres/index.d.cts +7 -7
- package/dist/backend/postgres/index.d.ts +7 -7
- package/dist/backend/postgres/index.js +16 -17
- package/dist/backend/postgres/pglite-store.cjs +48 -42
- package/dist/backend/postgres/pglite-store.cjs.map +1 -1
- package/dist/backend/postgres/pglite-store.d.cts +15 -9
- package/dist/backend/postgres/pglite-store.d.ts +15 -9
- package/dist/backend/postgres/pglite-store.js +44 -38
- package/dist/backend/postgres/pglite-store.js.map +1 -1
- package/dist/backend/postgres/pglite.cjs +18 -19
- package/dist/backend/postgres/pglite.d.cts +4 -4
- package/dist/backend/postgres/pglite.d.ts +4 -4
- package/dist/backend/postgres/pglite.js +17 -18
- package/dist/backend/sqlite/index.cjs +26 -27
- package/dist/backend/sqlite/index.d.cts +6 -6
- package/dist/backend/sqlite/index.d.ts +6 -6
- package/dist/backend/sqlite/index.js +14 -15
- package/dist/backend/sqlite/libsql.cjs +21 -22
- package/dist/backend/sqlite/libsql.cjs.map +1 -1
- package/dist/backend/sqlite/libsql.d.cts +15 -8
- package/dist/backend/sqlite/libsql.d.ts +15 -8
- package/dist/backend/sqlite/libsql.js +17 -18
- package/dist/backend/sqlite/libsql.js.map +1 -1
- package/dist/backend/sqlite/local-store.cjs +49 -43
- package/dist/backend/sqlite/local-store.cjs.map +1 -1
- package/dist/backend/sqlite/local-store.d.cts +15 -10
- package/dist/backend/sqlite/local-store.d.ts +15 -10
- package/dist/backend/sqlite/local-store.js +45 -39
- package/dist/backend/sqlite/local-store.js.map +1 -1
- package/dist/backend/sqlite/local.cjs +19 -20
- package/dist/backend/sqlite/local.d.cts +3 -3
- package/dist/backend/sqlite/local.d.ts +3 -3
- package/dist/backend/sqlite/local.js +17 -18
- package/dist/{chunk-S3ZRKJHY.js → chunk-2LG2XB2M.js} +3 -3
- package/dist/{chunk-S3ZRKJHY.js.map → chunk-2LG2XB2M.js.map} +1 -1
- package/dist/{chunk-7PF2L3H6.cjs → chunk-2NA5DYLO.cjs} +4 -4
- package/dist/{chunk-7PF2L3H6.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
- package/dist/chunk-2Z2Z3ZD6.js +58 -0
- package/dist/chunk-2Z2Z3ZD6.js.map +1 -0
- package/dist/{chunk-VVQM4CZD.cjs → chunk-3DHZCOT7.cjs} +20 -20
- package/dist/{chunk-VVQM4CZD.cjs.map → chunk-3DHZCOT7.cjs.map} +1 -1
- package/dist/{chunk-JXUTCSXX.cjs → chunk-4UGOKMI5.cjs} +250 -158
- package/dist/chunk-4UGOKMI5.cjs.map +1 -0
- package/dist/{chunk-RFRM3Q5K.js → chunk-5262ZMTR.js} +14 -5
- package/dist/chunk-5262ZMTR.js.map +1 -0
- package/dist/{chunk-QRNYDV5Z.js → chunk-5763DULU.js} +214 -69
- package/dist/chunk-5763DULU.js.map +1 -0
- package/dist/{chunk-BGYJW37L.js → chunk-5UVRGXD3.js} +277 -7
- package/dist/chunk-5UVRGXD3.js.map +1 -0
- package/dist/{chunk-QR24DJDF.cjs → chunk-62ZP23AW.cjs} +15 -15
- package/dist/{chunk-QR24DJDF.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
- package/dist/{chunk-ZI6VQSZA.cjs → chunk-65E3XWGF.cjs} +724 -577
- package/dist/chunk-65E3XWGF.cjs.map +1 -0
- package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
- package/dist/chunk-775A4ZMN.js.map +1 -0
- package/dist/{chunk-J2ICGNHO.cjs → chunk-7BQXPCGN.cjs} +830 -169
- package/dist/chunk-7BQXPCGN.cjs.map +1 -0
- package/dist/{chunk-FJMPR3OH.cjs → chunk-7EO3TCQB.cjs} +33 -7
- package/dist/chunk-7EO3TCQB.cjs.map +1 -0
- package/dist/{chunk-DXEEHSGN.js → chunk-7VQXLT5O.js} +436 -43
- package/dist/chunk-7VQXLT5O.js.map +1 -0
- package/dist/chunk-A4OC4DVN.cjs +12 -0
- package/dist/{chunk-4SZ6XPTG.cjs.map → chunk-A4OC4DVN.cjs.map} +1 -1
- package/dist/{chunk-TDXIBCGY.cjs → chunk-A7J2YDDI.cjs} +5 -3
- package/dist/chunk-A7J2YDDI.cjs.map +1 -0
- package/dist/{chunk-55ITBQJI.js → chunk-AKLS3BYZ.js} +56 -5
- package/dist/chunk-AKLS3BYZ.js.map +1 -0
- package/dist/{chunk-D7PG5D5K.js → chunk-AMKPPFUO.js} +32 -6
- package/dist/chunk-AMKPPFUO.js.map +1 -0
- package/dist/{chunk-WUFASQUO.js → chunk-ASTI57H3.js} +3 -3
- package/dist/{chunk-WUFASQUO.js.map → chunk-ASTI57H3.js.map} +1 -1
- package/dist/{chunk-4QIKLIGG.js → chunk-BKCUOV7A.js} +15 -5
- package/dist/chunk-BKCUOV7A.js.map +1 -0
- package/dist/{chunk-JQXSZHF2.cjs → chunk-BSFJMMV3.cjs} +134 -7
- package/dist/chunk-BSFJMMV3.cjs.map +1 -0
- package/dist/{chunk-4GUTQPVO.js → chunk-C23WSN5E.js} +185 -24
- package/dist/chunk-C23WSN5E.js.map +1 -0
- package/dist/{chunk-QLUXRWKL.js → chunk-CBTIUB76.js} +3 -3
- package/dist/{chunk-QLUXRWKL.js.map → chunk-CBTIUB76.js.map} +1 -1
- package/dist/chunk-CMWHLBVN.cjs +2082 -0
- package/dist/chunk-CMWHLBVN.cjs.map +1 -0
- package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
- package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
- package/dist/{chunk-FL5UQRES.js → chunk-DCQVHAYQ.js} +5 -5
- package/dist/{chunk-FL5UQRES.js.map → chunk-DCQVHAYQ.js.map} +1 -1
- package/dist/chunk-DTVWX77L.cjs +3432 -0
- package/dist/chunk-DTVWX77L.cjs.map +1 -0
- package/dist/chunk-DYATYRY4.js +47 -0
- package/dist/chunk-DYATYRY4.js.map +1 -0
- package/dist/chunk-E4WNQBEF.cjs +217 -0
- package/dist/chunk-E4WNQBEF.cjs.map +1 -0
- package/dist/{chunk-G6Q5UM7U.js → chunk-FWJKWH6U.js} +5 -3
- package/dist/chunk-FWJKWH6U.js.map +1 -0
- package/dist/chunk-GF3KXUTW.js +3393 -0
- package/dist/chunk-GF3KXUTW.js.map +1 -0
- package/dist/{chunk-VTN3C3CH.js → chunk-HFHTMECK.js} +7 -7
- package/dist/{chunk-VTN3C3CH.js.map → chunk-HFHTMECK.js.map} +1 -1
- package/dist/{chunk-FLEQ2HBK.js → chunk-I5MOXA4H.js} +20 -14
- package/dist/chunk-I5MOXA4H.js.map +1 -0
- package/dist/{chunk-4MB3AQAQ.js → chunk-J3WZ3FA2.js} +77 -3
- package/dist/chunk-J3WZ3FA2.js.map +1 -0
- package/dist/{chunk-UR7W5YQK.js → chunk-JBQQ7THH.js} +5 -3
- package/dist/chunk-JBQQ7THH.js.map +1 -0
- package/dist/{chunk-TKP5T34P.js → chunk-JXA2ZP2Q.js} +6 -16
- package/dist/chunk-JXA2ZP2Q.js.map +1 -0
- package/dist/{chunk-GYA4JRP5.js → chunk-JXXDZTMN.js} +2 -2
- package/dist/chunk-JXXDZTMN.js.map +1 -0
- package/dist/chunk-JZUR7ZWE.js +254 -0
- package/dist/chunk-JZUR7ZWE.js.map +1 -0
- package/dist/{chunk-42PYUGLS.js → chunk-K5ELX2GT.js} +108 -8
- package/dist/chunk-K5ELX2GT.js.map +1 -0
- package/dist/{chunk-Q6EDCUXV.js → chunk-L65OU2U3.js} +556 -204
- package/dist/chunk-L65OU2U3.js.map +1 -0
- package/dist/{chunk-D54WH24V.cjs → chunk-LBJKZXDE.cjs} +115 -13
- package/dist/chunk-LBJKZXDE.cjs.map +1 -0
- package/dist/{chunk-FQ7ZPOTZ.js → chunk-LGHCOKTT.js} +637 -493
- package/dist/chunk-LGHCOKTT.js.map +1 -0
- package/dist/chunk-M3WP7RQZ.js +736 -0
- package/dist/chunk-M3WP7RQZ.js.map +1 -0
- package/dist/{chunk-4MEWSUVM.cjs → chunk-M4BDU5RX.cjs} +12 -12
- package/dist/chunk-M4BDU5RX.cjs.map +1 -0
- package/dist/chunk-MCLYU6BN.cjs +332 -0
- package/dist/chunk-MCLYU6BN.cjs.map +1 -0
- package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
- package/dist/chunk-MSY7FSX4.js.map +1 -0
- package/dist/{chunk-H7VE3FL4.cjs → chunk-MUK4BU7K.cjs} +519 -125
- package/dist/chunk-MUK4BU7K.cjs.map +1 -0
- package/dist/{chunk-D56XG4EI.cjs → chunk-MXJDTH5B.cjs} +56 -45
- package/dist/chunk-MXJDTH5B.cjs.map +1 -0
- package/dist/{chunk-5EKPX6QU.js → chunk-MZLPX2R7.js} +8 -9
- package/dist/chunk-MZLPX2R7.js.map +1 -0
- package/dist/chunk-N66HCGCY.cjs +57 -0
- package/dist/chunk-N66HCGCY.cjs.map +1 -0
- package/dist/{chunk-CPEL3YIR.cjs → chunk-NFCVHQ5P.cjs} +55 -22
- package/dist/chunk-NFCVHQ5P.cjs.map +1 -0
- package/dist/{chunk-C4F7VJ5D.cjs → chunk-NI72YOJB.cjs} +84 -2
- package/dist/chunk-NI72YOJB.cjs.map +1 -0
- package/dist/{chunk-BNS75YNF.cjs → chunk-NK5Q7UNE.cjs} +10 -20
- package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
- package/dist/{chunk-TKORQCG4.js → chunk-NLI2AVEF.js} +386 -862
- package/dist/chunk-NLI2AVEF.js.map +1 -0
- package/dist/{chunk-YMTXMPV6.js → chunk-NMWDXFPH.js} +4 -4
- package/dist/{chunk-YMTXMPV6.js.map → chunk-NMWDXFPH.js.map} +1 -1
- package/dist/{chunk-J7LXTUTP.cjs → chunk-PF6F5NLJ.cjs} +604 -1094
- package/dist/chunk-PF6F5NLJ.cjs.map +1 -0
- package/dist/{chunk-NAAMUYMS.cjs → chunk-PNN7RHVR.cjs} +58 -48
- package/dist/chunk-PNN7RHVR.cjs.map +1 -0
- package/dist/{chunk-YOALGKRE.cjs → chunk-PNTCATDE.cjs} +3528 -1763
- package/dist/chunk-PNTCATDE.cjs.map +1 -0
- package/dist/{chunk-6DCB664D.js → chunk-PQBQG7IM.js} +3 -3
- package/dist/{chunk-6DCB664D.js.map → chunk-PQBQG7IM.js.map} +1 -1
- package/dist/{chunk-UCQ3BFSY.cjs → chunk-PT7RIRIZ.cjs} +684 -332
- package/dist/chunk-PT7RIRIZ.cjs.map +1 -0
- package/dist/{chunk-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
- package/dist/chunk-PWLJ77UV.cjs.map +1 -0
- package/dist/chunk-Q3G6A4I3.cjs +755 -0
- package/dist/chunk-Q3G6A4I3.cjs.map +1 -0
- package/dist/{chunk-Z3WO6MND.cjs → chunk-RMQLSPA2.cjs} +297 -27
- package/dist/chunk-RMQLSPA2.cjs.map +1 -0
- package/dist/{chunk-SJDMVITW.cjs → chunk-RT5ZY4XA.cjs} +6 -5
- package/dist/chunk-RT5ZY4XA.cjs.map +1 -0
- package/dist/{chunk-ID4WXTKL.js → chunk-S6PW7VV5.js} +2382 -617
- package/dist/chunk-S6PW7VV5.js.map +1 -0
- package/dist/{chunk-4GUBTVPV.js → chunk-T4XNKYXB.js} +780 -126
- package/dist/chunk-T4XNKYXB.js.map +1 -0
- package/dist/{chunk-YDWLUT5V.cjs → chunk-TQR4KBY2.cjs} +323 -178
- package/dist/chunk-TQR4KBY2.cjs.map +1 -0
- package/dist/{chunk-OOA273IJ.cjs → chunk-U5SON7R2.cjs} +27 -27
- package/dist/{chunk-OOA273IJ.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
- package/dist/{chunk-IX64T5OL.cjs → chunk-U63GDNRC.cjs} +32 -26
- package/dist/chunk-U63GDNRC.cjs.map +1 -0
- package/dist/{chunk-WDBXJOU5.cjs → chunk-UDISNXDL.cjs} +56 -47
- package/dist/chunk-UDISNXDL.cjs.map +1 -0
- package/dist/{chunk-EFEOOCJ3.js → chunk-UV3SN74I.js} +5 -5
- package/dist/{chunk-EFEOOCJ3.js.map → chunk-UV3SN74I.js.map} +1 -1
- package/dist/{chunk-U5W4LKZV.cjs → chunk-VCRRKBLN.cjs} +9 -9
- package/dist/{chunk-U5W4LKZV.cjs.map → chunk-VCRRKBLN.cjs.map} +1 -1
- package/dist/{chunk-ISLPNELU.js → chunk-VGTJPTIC.js} +16 -5
- package/dist/chunk-VGTJPTIC.js.map +1 -0
- package/dist/chunk-VLT6PEWR.cjs +60 -0
- package/dist/chunk-VLT6PEWR.cjs.map +1 -0
- package/dist/chunk-VQH4VAWD.cjs +12 -0
- package/dist/{chunk-B3F2D3SP.cjs.map → chunk-VQH4VAWD.cjs.map} +1 -1
- package/dist/{chunk-SNXVDZAJ.js → chunk-W6OG3HDG.js} +5 -4
- package/dist/chunk-W6OG3HDG.js.map +1 -0
- package/dist/chunk-WDGA7IYB.js +207 -0
- package/dist/chunk-WDGA7IYB.js.map +1 -0
- package/dist/chunk-WQZLUGVR.js +2057 -0
- package/dist/chunk-WQZLUGVR.js.map +1 -0
- package/dist/{chunk-EKFUG4G7.cjs → chunk-XBYVV3MP.cjs} +60 -5
- package/dist/chunk-XBYVV3MP.cjs.map +1 -0
- package/dist/{chunk-5GAONX5G.cjs → chunk-XCAGZAKP.cjs} +7 -7
- package/dist/{chunk-5GAONX5G.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
- package/dist/chunk-XL7SLCXS.js +309 -0
- package/dist/chunk-XL7SLCXS.js.map +1 -0
- package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
- package/dist/chunk-XUO3KQFO.cjs.map +1 -0
- package/dist/{chunk-F4NHQHEZ.cjs → chunk-YAAM3M2S.cjs} +10 -10
- package/dist/{chunk-F4NHQHEZ.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
- package/dist/{chunk-RUQS6M7G.js → chunk-YBFHZUXX.js} +6 -6
- package/dist/chunk-YBFHZUXX.js.map +1 -0
- package/dist/{chunk-KMXWZLQX.cjs → chunk-YBQOHKHN.cjs} +99 -100
- package/dist/chunk-YBQOHKHN.cjs.map +1 -0
- package/dist/{chunk-PVUI6KGR.js → chunk-YDFDBE6D.js} +93 -6
- package/dist/chunk-YDFDBE6D.js.map +1 -0
- package/dist/{chunk-P7GTYOLB.cjs → chunk-YVWGEQJE.cjs} +297 -135
- package/dist/chunk-YVWGEQJE.cjs.map +1 -0
- package/dist/{chunk-QT6V3YRH.js → chunk-YWGVVALJ.js} +3 -3
- package/dist/{chunk-QT6V3YRH.js.map → chunk-YWGVVALJ.js.map} +1 -1
- package/dist/core/index.cjs +40 -40
- package/dist/core/index.d.cts +4 -5
- package/dist/core/index.d.ts +4 -5
- package/dist/core/index.js +8 -8
- package/dist/{ddl-BG4J805L.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
- package/dist/{ddl-CgiS9QLj.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
- package/dist/graph-extension/index.cjs +26 -22
- package/dist/graph-extension/index.d.cts +16 -6
- package/dist/graph-extension/index.d.ts +16 -6
- package/dist/graph-extension/index.js +7 -7
- package/dist/graph-merge/index.cjs +2459 -654
- package/dist/graph-merge/index.cjs.map +1 -1
- package/dist/graph-merge/index.d.cts +170 -33
- package/dist/graph-merge/index.d.ts +170 -33
- package/dist/graph-merge/index.js +2269 -467
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-C3y_98iN.d.cts → index-BSHvKfok.d.ts} +221 -10
- package/dist/{index-BBxZCUdu.d.ts → index-DxaYCv8Y.d.cts} +221 -10
- package/dist/index.cjs +330 -268
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +590 -576
- package/dist/index.d.ts +590 -576
- package/dist/index.js +73 -49
- package/dist/index.js.map +1 -1
- package/dist/indexes/index.cjs +17 -17
- package/dist/indexes/index.d.cts +4 -4
- package/dist/indexes/index.d.ts +4 -4
- package/dist/indexes/index.js +10 -10
- package/dist/interchange/index.cjs +165 -51
- package/dist/interchange/index.cjs.map +1 -1
- package/dist/interchange/index.d.cts +261 -16
- package/dist/interchange/index.d.ts +261 -16
- package/dist/interchange/index.js +128 -25
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-YoLEfcc1.d.ts → manager-CfZAimti.d.ts} +36 -5
- package/dist/{manager-KS7CGQQT.d.cts → manager-HGk6E_HW.d.cts} +36 -5
- package/dist/{materialize-indexes-Bhhyb1B3.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
- package/dist/{materialize-indexes-OHRWypW6.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
- package/dist/{postgres-DpkW3R5Y.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
- package/dist/{postgres-DwqyIniy.d.ts → postgres-e7a9TdvR.d.ts} +1961 -439
- package/dist/profiler/index.cjs +15 -15
- package/dist/profiler/index.d.cts +9 -10
- package/dist/profiler/index.d.ts +9 -10
- package/dist/profiler/index.js +4 -4
- package/dist/provenance/index.cjs +46 -48
- package/dist/provenance/index.cjs.map +1 -1
- package/dist/provenance/index.d.cts +7 -7
- package/dist/provenance/index.d.ts +7 -7
- package/dist/provenance/index.js +12 -14
- package/dist/provenance/index.js.map +1 -1
- package/dist/schema/index.cjs +50 -48
- package/dist/schema/index.d.cts +9 -16
- package/dist/schema/index.d.ts +9 -16
- package/dist/schema/index.js +23 -21
- package/dist/{searchable-DLWEfC4a.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
- package/dist/{searchable-CIZL8Hyw.d.cts → searchable-CIje5XYD.d.cts} +1 -2
- package/dist/{sqlite-DY0WODUK.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
- package/dist/{sqlite-L-VIRzqA.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
- package/dist/{store-view-A85FFRnk.d.cts → store-B0h6x7wo.d.cts} +1289 -767
- package/dist/{store-view-66p92IPi.d.ts → store-ClQ-MZQS.d.ts} +1289 -767
- package/dist/{temporal-BNbjXqer.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
- package/dist/{temporal-Bob6Nfbp.d.ts → temporal-BtM4UALv.d.ts} +1 -1
- package/dist/{types-DeORZhxn.d.cts → types-CoIx8HX5.d.cts} +1 -1
- package/dist/{types-Ch9a0Dx6.d.ts → types-HkveCCx0.d.cts} +726 -5
- package/dist/{types-Ch9a0Dx6.d.cts → types-HkveCCx0.d.ts} +726 -5
- package/dist/{types-ClCzT-dT.d.ts → types-KFfk-8Ah.d.ts} +1 -1
- package/dist/{where-DPw52ksb.d.cts → where--fk7_0kv.d.cts} +1 -1
- package/dist/{where-kWUZPvEA.d.ts → where-ws5hf-Ov.d.ts} +1 -1
- package/package.json +3 -3
- package/dist/chunk-2L54C2C2.js +0 -144
- package/dist/chunk-2L54C2C2.js.map +0 -1
- package/dist/chunk-35S6P5ZU.js +0 -27
- package/dist/chunk-35S6P5ZU.js.map +0 -1
- package/dist/chunk-42PYUGLS.js.map +0 -1
- package/dist/chunk-4GUBTVPV.js.map +0 -1
- package/dist/chunk-4GUTQPVO.js.map +0 -1
- package/dist/chunk-4MB3AQAQ.js.map +0 -1
- package/dist/chunk-4MEWSUVM.cjs.map +0 -1
- package/dist/chunk-4QIKLIGG.js.map +0 -1
- package/dist/chunk-4SZ6XPTG.cjs +0 -12
- package/dist/chunk-55ITBQJI.js.map +0 -1
- package/dist/chunk-5EKPX6QU.js.map +0 -1
- package/dist/chunk-6RYPD3NJ.cjs +0 -1282
- package/dist/chunk-6RYPD3NJ.cjs.map +0 -1
- package/dist/chunk-764JHTLT.cjs +0 -15
- package/dist/chunk-764JHTLT.cjs.map +0 -1
- package/dist/chunk-ACSVZPK7.cjs.map +0 -1
- package/dist/chunk-B3F2D3SP.cjs +0 -12
- package/dist/chunk-BGYJW37L.js.map +0 -1
- package/dist/chunk-BNS75YNF.cjs.map +0 -1
- package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
- package/dist/chunk-CBKG6HEP.js +0 -1263
- package/dist/chunk-CBKG6HEP.js.map +0 -1
- package/dist/chunk-CPEL3YIR.cjs.map +0 -1
- package/dist/chunk-D54WH24V.cjs.map +0 -1
- package/dist/chunk-D56XG4EI.cjs.map +0 -1
- package/dist/chunk-D7PG5D5K.js.map +0 -1
- package/dist/chunk-DI74SMXS.cjs +0 -29
- package/dist/chunk-DI74SMXS.cjs.map +0 -1
- package/dist/chunk-DK2S42XB.js +0 -77
- package/dist/chunk-DK2S42XB.js.map +0 -1
- package/dist/chunk-DRACN6XG.js +0 -27
- package/dist/chunk-DRACN6XG.js.map +0 -1
- package/dist/chunk-DXEEHSGN.js.map +0 -1
- package/dist/chunk-EKFUG4G7.cjs.map +0 -1
- package/dist/chunk-EQ7JKLZO.cjs +0 -157
- package/dist/chunk-EQ7JKLZO.cjs.map +0 -1
- package/dist/chunk-FJMPR3OH.cjs.map +0 -1
- package/dist/chunk-FLEQ2HBK.js.map +0 -1
- package/dist/chunk-FQ7ZPOTZ.js.map +0 -1
- package/dist/chunk-G6Q5UM7U.js.map +0 -1
- package/dist/chunk-GYA4JRP5.js.map +0 -1
- package/dist/chunk-H7VE3FL4.cjs.map +0 -1
- package/dist/chunk-ID4WXTKL.js.map +0 -1
- package/dist/chunk-ISLPNELU.js.map +0 -1
- package/dist/chunk-ITE4IXAK.js +0 -25
- package/dist/chunk-ITE4IXAK.js.map +0 -1
- package/dist/chunk-IX64T5OL.cjs.map +0 -1
- package/dist/chunk-J2ICGNHO.cjs.map +0 -1
- package/dist/chunk-J7LXTUTP.cjs.map +0 -1
- package/dist/chunk-JQXSZHF2.cjs.map +0 -1
- package/dist/chunk-JXUTCSXX.cjs.map +0 -1
- package/dist/chunk-KCO5EFJU.js +0 -79
- package/dist/chunk-KCO5EFJU.js.map +0 -1
- package/dist/chunk-KKYELPZ2.cjs +0 -83
- package/dist/chunk-KKYELPZ2.cjs.map +0 -1
- package/dist/chunk-KMXWZLQX.cjs.map +0 -1
- package/dist/chunk-MIJKEVV7.js.map +0 -1
- package/dist/chunk-NAAMUYMS.cjs.map +0 -1
- package/dist/chunk-P7GTYOLB.cjs.map +0 -1
- package/dist/chunk-PVUI6KGR.js.map +0 -1
- package/dist/chunk-Q6EDCUXV.js.map +0 -1
- package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
- package/dist/chunk-QC4MCOFV.cjs +0 -83
- package/dist/chunk-QC4MCOFV.cjs.map +0 -1
- package/dist/chunk-QMQLUA66.js +0 -12
- package/dist/chunk-QMQLUA66.js.map +0 -1
- package/dist/chunk-QRNYDV5Z.js.map +0 -1
- package/dist/chunk-RFRM3Q5K.js.map +0 -1
- package/dist/chunk-RUQS6M7G.js.map +0 -1
- package/dist/chunk-S4KQ5LV4.js.map +0 -1
- package/dist/chunk-SJDMVITW.cjs.map +0 -1
- package/dist/chunk-SNXVDZAJ.js.map +0 -1
- package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
- package/dist/chunk-TDXIBCGY.cjs.map +0 -1
- package/dist/chunk-TKORQCG4.js.map +0 -1
- package/dist/chunk-TKP5T34P.js.map +0 -1
- package/dist/chunk-TRF4EBJT.cjs +0 -30
- package/dist/chunk-TRF4EBJT.cjs.map +0 -1
- package/dist/chunk-UCQ3BFSY.cjs.map +0 -1
- package/dist/chunk-UR7W5YQK.js.map +0 -1
- package/dist/chunk-V34A6R5V.js +0 -134
- package/dist/chunk-V34A6R5V.js.map +0 -1
- package/dist/chunk-WDAVPX46.js +0 -81
- package/dist/chunk-WDAVPX46.js.map +0 -1
- package/dist/chunk-WDBXJOU5.cjs.map +0 -1
- package/dist/chunk-YDWLUT5V.cjs.map +0 -1
- package/dist/chunk-YOALGKRE.cjs.map +0 -1
- package/dist/chunk-Z3WO6MND.cjs.map +0 -1
- package/dist/chunk-ZDH3DX3C.cjs +0 -30
- package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
- package/dist/chunk-ZI6VQSZA.cjs.map +0 -1
- package/dist/chunk-ZTAJL4DT.cjs +0 -85
- package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
- package/dist/define-graph-BGrJahvp.d.ts +0 -173
- package/dist/define-graph-alREY2wj.d.cts +0 -173
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
3
|
+
var chunkXUO3KQFO_cjs = require('./chunk-XUO3KQFO.cjs');
|
|
4
|
+
var chunkLBJKZXDE_cjs = require('./chunk-LBJKZXDE.cjs');
|
|
5
|
+
var chunkNI72YOJB_cjs = require('./chunk-NI72YOJB.cjs');
|
|
6
|
+
var chunkA7J2YDDI_cjs = require('./chunk-A7J2YDDI.cjs');
|
|
7
|
+
var chunkN66HCGCY_cjs = require('./chunk-N66HCGCY.cjs');
|
|
8
8
|
|
|
9
9
|
// src/ontology/closures.ts
|
|
10
10
|
function computeTransitiveClosure(relations) {
|
|
@@ -77,6 +77,7 @@ var GRAPH_EXTENSION_ISSUE_CODES = [
|
|
|
77
77
|
"ONTOLOGY_CYCLE",
|
|
78
78
|
"ONTOLOGY_SELF_LOOP",
|
|
79
79
|
"ONTOLOGY_DISJOINT_CONFLICT",
|
|
80
|
+
"ONTOLOGY_INVERSE_MULTIPLE_PARTNERS",
|
|
80
81
|
"DUPLICATE_ONTOLOGY_RELATION",
|
|
81
82
|
"INVALID_DOCUMENT_SHAPE",
|
|
82
83
|
"UNKNOWN_DOCUMENT_KEY",
|
|
@@ -86,7 +87,7 @@ var GRAPH_EXTENSION_ISSUE_CODES = [
|
|
|
86
87
|
"EMPTY_INDEX_FIELDS",
|
|
87
88
|
"UNKNOWN_PROPERTY_KEY"
|
|
88
89
|
];
|
|
89
|
-
var GraphExtensionError = class extends
|
|
90
|
+
var GraphExtensionError = class extends chunkNI72YOJB_cjs.TypeGraphError {
|
|
90
91
|
constructor(spec) {
|
|
91
92
|
super(spec.message, spec.code, {
|
|
92
93
|
details: spec.details,
|
|
@@ -197,6 +198,21 @@ var GraphExtensionUnresolvedEndpointError = class extends GraphExtensionError {
|
|
|
197
198
|
this.endpoint = endpoint;
|
|
198
199
|
}
|
|
199
200
|
};
|
|
201
|
+
var GraphExtensionUnresolvedOntologyEndpointError = class extends GraphExtensionError {
|
|
202
|
+
code = "GRAPH_EXTENSION_UNRESOLVED_ONTOLOGY_ENDPOINT";
|
|
203
|
+
metaEdge;
|
|
204
|
+
endpoint;
|
|
205
|
+
constructor(metaEdge, endpoint, graphId) {
|
|
206
|
+
super({
|
|
207
|
+
message: `Graph-extension ${metaEdge} endpoint "${endpoint}" does not resolve to a registered edge kind on graph "${graphId}".`,
|
|
208
|
+
code: "GRAPH_EXTENSION_UNRESOLVED_ONTOLOGY_ENDPOINT",
|
|
209
|
+
details: { metaEdge, endpoint, graphId },
|
|
210
|
+
suggestion: "Correct the local edge-kind name, register that edge, or use an absolute http:// or https:// IRI for a deliberate inert external reference."
|
|
211
|
+
});
|
|
212
|
+
this.metaEdge = metaEdge;
|
|
213
|
+
this.endpoint = endpoint;
|
|
214
|
+
}
|
|
215
|
+
};
|
|
200
216
|
var RemoveCompileTimeKindError = class extends GraphExtensionError {
|
|
201
217
|
code = "REMOVE_COMPILE_TIME_KIND";
|
|
202
218
|
kindName;
|
|
@@ -277,8 +293,725 @@ var GRAPH_EXTENSION_TOP_LEVEL_KEYS = [
|
|
|
277
293
|
"indexes"
|
|
278
294
|
];
|
|
279
295
|
|
|
296
|
+
// src/ontology/external-iri.ts
|
|
297
|
+
function isExternalIri(value) {
|
|
298
|
+
return value.startsWith("http://") || value.startsWith("https://");
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// src/registry/kind-registry.ts
|
|
302
|
+
var KindRegistry = class {
|
|
303
|
+
// === Node & Edge Kinds ===
|
|
304
|
+
nodeKinds;
|
|
305
|
+
edgeKinds;
|
|
306
|
+
/**
|
|
307
|
+
* Durable graph identity capability; supplies the identity defaults for
|
|
308
|
+
* every query builder built from this registry (compile-only and
|
|
309
|
+
* store-bound).
|
|
310
|
+
*/
|
|
311
|
+
identity;
|
|
312
|
+
// === Subsumption (subClassOf) ===
|
|
313
|
+
// Transitive closure for inheritance
|
|
314
|
+
subClassAncestors;
|
|
315
|
+
subClassDescendants;
|
|
316
|
+
// === Hierarchy (broader/narrower) ===
|
|
317
|
+
// Transitive closure for concept hierarchy (separate from subClassOf!)
|
|
318
|
+
broaderClosure;
|
|
319
|
+
narrowerClosure;
|
|
320
|
+
// === Equivalence ===
|
|
321
|
+
equivalenceSets;
|
|
322
|
+
iriToKind;
|
|
323
|
+
relatedKinds;
|
|
324
|
+
// === Constraints ===
|
|
325
|
+
disjointPairs;
|
|
326
|
+
// Normalized pairs: "Organization|Person"
|
|
327
|
+
// === Composition ===
|
|
328
|
+
partOfClosure;
|
|
329
|
+
hasPartClosure;
|
|
330
|
+
// === Edge Relationships ===
|
|
331
|
+
edgeInverses;
|
|
332
|
+
edgeImplicationsClosure;
|
|
333
|
+
edgeImplyingClosure;
|
|
334
|
+
constructor(nodeKinds, edgeKinds, closures, identity) {
|
|
335
|
+
this.nodeKinds = nodeKinds;
|
|
336
|
+
this.edgeKinds = edgeKinds;
|
|
337
|
+
this.identity = identity;
|
|
338
|
+
this.subClassAncestors = closures.subClassAncestors;
|
|
339
|
+
this.subClassDescendants = closures.subClassDescendants;
|
|
340
|
+
this.broaderClosure = closures.broaderClosure;
|
|
341
|
+
this.narrowerClosure = closures.narrowerClosure;
|
|
342
|
+
this.equivalenceSets = closures.equivalenceSets;
|
|
343
|
+
this.iriToKind = closures.iriToKind;
|
|
344
|
+
this.relatedKinds = closures.relatedKinds;
|
|
345
|
+
this.disjointPairs = closures.disjointPairs;
|
|
346
|
+
this.partOfClosure = closures.partOfClosure;
|
|
347
|
+
this.hasPartClosure = closures.hasPartClosure;
|
|
348
|
+
this.edgeInverses = closures.edgeInverses;
|
|
349
|
+
this.edgeImplicationsClosure = closures.edgeImplicationsClosure;
|
|
350
|
+
this.edgeImplyingClosure = closures.edgeImplyingClosure;
|
|
351
|
+
}
|
|
352
|
+
// === Subsumption Methods ===
|
|
353
|
+
/**
|
|
354
|
+
* Checks if child is a subclass of parent (directly or transitively).
|
|
355
|
+
*/
|
|
356
|
+
isSubClassOf(child, parent) {
|
|
357
|
+
return isReachable(this.subClassAncestors, child, parent);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Expands a kind to include all its subclasses.
|
|
361
|
+
* Returns [kind, ...subclasses].
|
|
362
|
+
*/
|
|
363
|
+
expandSubClasses(kind) {
|
|
364
|
+
const descendants = this.subClassDescendants.get(kind) ?? /* @__PURE__ */ new Set();
|
|
365
|
+
return [kind, ...descendants];
|
|
366
|
+
}
|
|
367
|
+
/**
|
|
368
|
+
* Gets all ancestors of a kind (via subClassOf).
|
|
369
|
+
*/
|
|
370
|
+
getAncestors(kind) {
|
|
371
|
+
return this.subClassAncestors.get(kind) ?? /* @__PURE__ */ new Set();
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* Gets all descendants of a kind (via subClassOf).
|
|
375
|
+
*/
|
|
376
|
+
getDescendants(kind) {
|
|
377
|
+
return this.subClassDescendants.get(kind) ?? /* @__PURE__ */ new Set();
|
|
378
|
+
}
|
|
379
|
+
// === Hierarchy Methods ===
|
|
380
|
+
/**
|
|
381
|
+
* Checks if narrowerConcept is narrower than broaderConcept.
|
|
382
|
+
*/
|
|
383
|
+
isNarrowerThan(narrowerConcept, broaderConcept) {
|
|
384
|
+
return isReachable(this.broaderClosure, narrowerConcept, broaderConcept);
|
|
385
|
+
}
|
|
386
|
+
/**
|
|
387
|
+
* Checks if broaderConcept is broader than narrowerConcept.
|
|
388
|
+
*/
|
|
389
|
+
isBroaderThan(broaderConcept, narrowerConcept) {
|
|
390
|
+
return isReachable(this.narrowerClosure, broaderConcept, narrowerConcept);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* Expands to include all narrower concepts.
|
|
394
|
+
*/
|
|
395
|
+
expandNarrower(kind) {
|
|
396
|
+
const narrower = this.narrowerClosure.get(kind) ?? /* @__PURE__ */ new Set();
|
|
397
|
+
return [kind, ...narrower];
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Expands to include all broader concepts.
|
|
401
|
+
*/
|
|
402
|
+
expandBroader(kind) {
|
|
403
|
+
const broader = this.broaderClosure.get(kind) ?? /* @__PURE__ */ new Set();
|
|
404
|
+
return [kind, ...broader];
|
|
405
|
+
}
|
|
406
|
+
// === Equivalence Methods ===
|
|
407
|
+
/**
|
|
408
|
+
* Checks if two kinds are equivalent.
|
|
409
|
+
*/
|
|
410
|
+
areEquivalent(a, b) {
|
|
411
|
+
const equivalents = this.equivalenceSets.get(a);
|
|
412
|
+
return equivalents?.has(b) ?? false;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Gets all equivalents of a kind (including external IRIs).
|
|
416
|
+
*/
|
|
417
|
+
getEquivalents(kind) {
|
|
418
|
+
const equivalents = this.equivalenceSets.get(kind);
|
|
419
|
+
return equivalents ? [...equivalents] : [];
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Resolves an external IRI to an internal kind name.
|
|
423
|
+
*/
|
|
424
|
+
resolveIri(iri) {
|
|
425
|
+
return this.iriToKind.get(iri);
|
|
426
|
+
}
|
|
427
|
+
/** Gets directly associated kinds declared through symmetric `relatedTo`. */
|
|
428
|
+
getRelatedKinds(kind) {
|
|
429
|
+
const related = this.relatedKinds.get(kind);
|
|
430
|
+
return related === void 0 ? [] : [...related];
|
|
431
|
+
}
|
|
432
|
+
// === Constraint Methods ===
|
|
433
|
+
/**
|
|
434
|
+
* Checks if two kinds are disjoint.
|
|
435
|
+
*/
|
|
436
|
+
areDisjoint(a, b) {
|
|
437
|
+
const normalizedPair = a < b ? `${a}|${b}` : `${b}|${a}`;
|
|
438
|
+
return this.disjointPairs.has(normalizedPair);
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Gets all kinds that are disjoint with the given kind.
|
|
442
|
+
*/
|
|
443
|
+
getDisjointKinds(kind) {
|
|
444
|
+
const result = [];
|
|
445
|
+
for (const pair of this.disjointPairs) {
|
|
446
|
+
const parts = pair.split("|");
|
|
447
|
+
const firstKind = chunkN66HCGCY_cjs.requireDefined(parts[0]);
|
|
448
|
+
const secondKind = chunkN66HCGCY_cjs.requireDefined(parts[1]);
|
|
449
|
+
if (firstKind === kind) result.push(secondKind);
|
|
450
|
+
else if (secondKind === kind) result.push(firstKind);
|
|
451
|
+
}
|
|
452
|
+
return result;
|
|
453
|
+
}
|
|
454
|
+
// === Composition Methods ===
|
|
455
|
+
/**
|
|
456
|
+
* Checks if part is part of whole (directly or transitively).
|
|
457
|
+
*/
|
|
458
|
+
isPartOf(part, whole) {
|
|
459
|
+
return isReachable(this.partOfClosure, part, whole);
|
|
460
|
+
}
|
|
461
|
+
/**
|
|
462
|
+
* Gets all wholes that contain this part.
|
|
463
|
+
*/
|
|
464
|
+
getWholes(part) {
|
|
465
|
+
const wholes = this.partOfClosure.get(part);
|
|
466
|
+
return wholes ? [...wholes] : [];
|
|
467
|
+
}
|
|
468
|
+
/**
|
|
469
|
+
* Gets all parts of this whole.
|
|
470
|
+
*/
|
|
471
|
+
getParts(whole) {
|
|
472
|
+
const parts = this.hasPartClosure.get(whole);
|
|
473
|
+
return parts ? [...parts] : [];
|
|
474
|
+
}
|
|
475
|
+
// === Edge Relationship Methods ===
|
|
476
|
+
/**
|
|
477
|
+
* Gets the inverse edge kind for a given edge kind.
|
|
478
|
+
* If edgeA inverseOf edgeB, then getInverseEdge("edgeA") returns "edgeB".
|
|
479
|
+
*/
|
|
480
|
+
getInverseEdge(edgeKind) {
|
|
481
|
+
return this.edgeInverses.get(edgeKind);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* Gets all edges implied by a given edge (transitively).
|
|
485
|
+
* If A implies B and B implies C, then getImpliedEdges("A") returns ["B", "C"].
|
|
486
|
+
*/
|
|
487
|
+
getImpliedEdges(edgeKind) {
|
|
488
|
+
const implied = this.edgeImplicationsClosure.get(edgeKind);
|
|
489
|
+
return implied ? [...implied] : [];
|
|
490
|
+
}
|
|
491
|
+
/**
|
|
492
|
+
* Gets all edges that imply a given edge (transitively).
|
|
493
|
+
* If A implies B and B implies C, then getImplyingEdges("C") returns ["A", "B"].
|
|
494
|
+
* Used for query-time expansion: when querying for C, also include A and B edges.
|
|
495
|
+
*/
|
|
496
|
+
getImplyingEdges(edgeKind) {
|
|
497
|
+
const implying = this.edgeImplyingClosure.get(edgeKind);
|
|
498
|
+
return implying ? [...implying] : [];
|
|
499
|
+
}
|
|
500
|
+
/**
|
|
501
|
+
* Expands an edge kind to include all edges that imply it.
|
|
502
|
+
* Returns [edgeKind, ...implyingEdges].
|
|
503
|
+
*/
|
|
504
|
+
expandImplyingEdges(edgeKind) {
|
|
505
|
+
const implying = this.edgeImplyingClosure.get(edgeKind) ?? /* @__PURE__ */ new Set();
|
|
506
|
+
return [edgeKind, ...implying];
|
|
507
|
+
}
|
|
508
|
+
// === Edge Endpoint Validation ===
|
|
509
|
+
/**
|
|
510
|
+
* Checks if a concrete kind is assignable to a target kind.
|
|
511
|
+
* Uses subsumption: Company is assignable to Organization if Company subClassOf Organization.
|
|
512
|
+
*/
|
|
513
|
+
isAssignableTo(concreteKind, targetKind) {
|
|
514
|
+
if (concreteKind === targetKind) return true;
|
|
515
|
+
return this.isSubClassOf(concreteKind, targetKind);
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Checks if a concrete kind is assignable to at least one of the given
|
|
519
|
+
* target kinds. Shared by every "is this kind usable where one of these
|
|
520
|
+
* kinds is expected" check (edge endpoint validation, ontology relation
|
|
521
|
+
* endpoint compatibility) so they can't independently drift.
|
|
522
|
+
*/
|
|
523
|
+
isAssignableToAny(concreteKind, targetKinds) {
|
|
524
|
+
return targetKinds.some(
|
|
525
|
+
(targetKind) => this.isAssignableTo(concreteKind, targetKind)
|
|
526
|
+
);
|
|
527
|
+
}
|
|
528
|
+
/**
|
|
529
|
+
* Validates that a kind exists in the registry.
|
|
530
|
+
*/
|
|
531
|
+
hasNodeType(name) {
|
|
532
|
+
return this.nodeKinds.has(name);
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* Validates that an edge kind exists in the registry.
|
|
536
|
+
*/
|
|
537
|
+
hasEdgeType(name) {
|
|
538
|
+
return this.edgeKinds.has(name);
|
|
539
|
+
}
|
|
540
|
+
/**
|
|
541
|
+
* Gets a node kind by name.
|
|
542
|
+
*/
|
|
543
|
+
getNodeType(name) {
|
|
544
|
+
return this.nodeKinds.get(name);
|
|
545
|
+
}
|
|
546
|
+
/**
|
|
547
|
+
* Gets an edge kind by name.
|
|
548
|
+
*/
|
|
549
|
+
getEdgeType(name) {
|
|
550
|
+
return this.edgeKinds.get(name);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
function createEmptyClosures() {
|
|
554
|
+
return {
|
|
555
|
+
subClassAncestors: /* @__PURE__ */ new Map(),
|
|
556
|
+
subClassDescendants: /* @__PURE__ */ new Map(),
|
|
557
|
+
broaderClosure: /* @__PURE__ */ new Map(),
|
|
558
|
+
narrowerClosure: /* @__PURE__ */ new Map(),
|
|
559
|
+
equivalenceSets: /* @__PURE__ */ new Map(),
|
|
560
|
+
iriToKind: /* @__PURE__ */ new Map(),
|
|
561
|
+
relatedKinds: /* @__PURE__ */ new Map(),
|
|
562
|
+
disjointPairs: /* @__PURE__ */ new Set(),
|
|
563
|
+
partOfClosure: /* @__PURE__ */ new Map(),
|
|
564
|
+
hasPartClosure: /* @__PURE__ */ new Map(),
|
|
565
|
+
edgeInverses: /* @__PURE__ */ new Map(),
|
|
566
|
+
edgeImplicationsClosure: /* @__PURE__ */ new Map(),
|
|
567
|
+
edgeImplyingClosure: /* @__PURE__ */ new Map()
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
function computeClosuresFromOntology(ontology) {
|
|
571
|
+
return computeClosuresFromNamedOntology(
|
|
572
|
+
ontology.map((relation) => ({
|
|
573
|
+
metaEdge: relation.metaEdge.name,
|
|
574
|
+
from: getKindName(relation.from),
|
|
575
|
+
to: getKindName(relation.to)
|
|
576
|
+
}))
|
|
577
|
+
);
|
|
578
|
+
}
|
|
579
|
+
function collectOntologyRelations(ontology) {
|
|
580
|
+
const subClass = [];
|
|
581
|
+
const broader = [];
|
|
582
|
+
const equivalent = [];
|
|
583
|
+
const related = [];
|
|
584
|
+
const disjoint = [];
|
|
585
|
+
const partOf = [];
|
|
586
|
+
const inverseOf = [];
|
|
587
|
+
const implies = [];
|
|
588
|
+
for (const relation of ontology) {
|
|
589
|
+
const fromName = relation.from;
|
|
590
|
+
const toName = relation.to;
|
|
591
|
+
switch (relation.metaEdge) {
|
|
592
|
+
case chunkXUO3KQFO_cjs.META_EDGE_SUB_CLASS_OF: {
|
|
593
|
+
subClass.push([fromName, toName]);
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
case chunkXUO3KQFO_cjs.META_EDGE_BROADER: {
|
|
597
|
+
broader.push([fromName, toName]);
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
case chunkXUO3KQFO_cjs.META_EDGE_NARROWER: {
|
|
601
|
+
broader.push([toName, fromName]);
|
|
602
|
+
break;
|
|
603
|
+
}
|
|
604
|
+
case chunkXUO3KQFO_cjs.META_EDGE_EQUIVALENT_TO:
|
|
605
|
+
case chunkXUO3KQFO_cjs.META_EDGE_SAME_AS: {
|
|
606
|
+
equivalent.push([fromName, toName]);
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
case chunkXUO3KQFO_cjs.META_EDGE_RELATED_TO: {
|
|
610
|
+
related.push([fromName, toName]);
|
|
611
|
+
break;
|
|
612
|
+
}
|
|
613
|
+
case chunkXUO3KQFO_cjs.META_EDGE_DISJOINT_WITH: {
|
|
614
|
+
disjoint.push([fromName, toName]);
|
|
615
|
+
break;
|
|
616
|
+
}
|
|
617
|
+
case chunkXUO3KQFO_cjs.META_EDGE_PART_OF: {
|
|
618
|
+
partOf.push([fromName, toName]);
|
|
619
|
+
break;
|
|
620
|
+
}
|
|
621
|
+
case chunkXUO3KQFO_cjs.META_EDGE_HAS_PART: {
|
|
622
|
+
partOf.push([toName, fromName]);
|
|
623
|
+
break;
|
|
624
|
+
}
|
|
625
|
+
case chunkXUO3KQFO_cjs.META_EDGE_INVERSE_OF: {
|
|
626
|
+
inverseOf.push([fromName, toName]);
|
|
627
|
+
break;
|
|
628
|
+
}
|
|
629
|
+
case chunkXUO3KQFO_cjs.META_EDGE_IMPLIES: {
|
|
630
|
+
implies.push([fromName, toName]);
|
|
631
|
+
break;
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
return {
|
|
636
|
+
subClass,
|
|
637
|
+
broader,
|
|
638
|
+
equivalent,
|
|
639
|
+
related,
|
|
640
|
+
disjoint,
|
|
641
|
+
partOf,
|
|
642
|
+
inverseOf,
|
|
643
|
+
implies
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
function computeSubsumptionAndEquivalenceClosures(collected) {
|
|
647
|
+
const subClassAncestors = computeTransitiveClosure(collected.subClass);
|
|
648
|
+
return {
|
|
649
|
+
subClassAncestors,
|
|
650
|
+
subClassDescendants: invertClosure(subClassAncestors),
|
|
651
|
+
equivalenceSets: computeEquivalenceSets(collected.equivalent)
|
|
652
|
+
};
|
|
653
|
+
}
|
|
654
|
+
function computeDisjointExpansionClosures(ontology) {
|
|
655
|
+
return computeSubsumptionAndEquivalenceClosures(
|
|
656
|
+
collectOntologyRelations(ontology)
|
|
657
|
+
);
|
|
658
|
+
}
|
|
659
|
+
function computeClosuresFromNamedOntology(ontology) {
|
|
660
|
+
const collected = collectOntologyRelations(ontology);
|
|
661
|
+
const { subClassAncestors, subClassDescendants, equivalenceSets } = computeSubsumptionAndEquivalenceClosures(collected);
|
|
662
|
+
const broaderClosure = computeTransitiveClosure(collected.broader);
|
|
663
|
+
const narrowerClosure = invertClosure(broaderClosure);
|
|
664
|
+
const iriToKind = computeIriMapping(collected.equivalent);
|
|
665
|
+
const relatedKinds = computeSymmetricRelations(collected.related);
|
|
666
|
+
const disjointPairs = computeDisjointPairs(collected.disjoint, {
|
|
667
|
+
subClassDescendants,
|
|
668
|
+
equivalenceSets
|
|
669
|
+
});
|
|
670
|
+
const partOfClosure = computeTransitiveClosure(collected.partOf);
|
|
671
|
+
const hasPartClosure = invertClosure(partOfClosure);
|
|
672
|
+
const edgeInverses = computeEdgeInverses(collected.inverseOf);
|
|
673
|
+
const edgeImplicationsClosure = computeTransitiveClosure(collected.implies);
|
|
674
|
+
const edgeImplyingClosure = invertClosure(edgeImplicationsClosure);
|
|
675
|
+
return {
|
|
676
|
+
subClassAncestors,
|
|
677
|
+
subClassDescendants,
|
|
678
|
+
broaderClosure,
|
|
679
|
+
narrowerClosure,
|
|
680
|
+
equivalenceSets,
|
|
681
|
+
iriToKind,
|
|
682
|
+
relatedKinds,
|
|
683
|
+
disjointPairs,
|
|
684
|
+
partOfClosure,
|
|
685
|
+
hasPartClosure,
|
|
686
|
+
edgeInverses,
|
|
687
|
+
edgeImplicationsClosure,
|
|
688
|
+
edgeImplyingClosure
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function getKindName(kindOrIri) {
|
|
692
|
+
if (typeof kindOrIri === "string") {
|
|
693
|
+
return kindOrIri;
|
|
694
|
+
}
|
|
695
|
+
return kindOrIri.kind;
|
|
696
|
+
}
|
|
697
|
+
function computeEquivalenceSets(relations) {
|
|
698
|
+
const parent = /* @__PURE__ */ new Map();
|
|
699
|
+
const size = /* @__PURE__ */ new Map();
|
|
700
|
+
function find(x) {
|
|
701
|
+
if (!parent.has(x)) {
|
|
702
|
+
parent.set(x, x);
|
|
703
|
+
size.set(x, 1);
|
|
704
|
+
return x;
|
|
705
|
+
}
|
|
706
|
+
let root = x;
|
|
707
|
+
while (chunkN66HCGCY_cjs.requireDefined(parent.get(root)) !== root) {
|
|
708
|
+
root = chunkN66HCGCY_cjs.requireDefined(parent.get(root));
|
|
709
|
+
}
|
|
710
|
+
let cursor = x;
|
|
711
|
+
while (cursor !== root) {
|
|
712
|
+
const next = chunkN66HCGCY_cjs.requireDefined(parent.get(cursor));
|
|
713
|
+
parent.set(cursor, root);
|
|
714
|
+
cursor = next;
|
|
715
|
+
}
|
|
716
|
+
return root;
|
|
717
|
+
}
|
|
718
|
+
function union(a, b) {
|
|
719
|
+
const rootA = find(a);
|
|
720
|
+
const rootB = find(b);
|
|
721
|
+
if (rootA === rootB) return;
|
|
722
|
+
const sizeA = chunkN66HCGCY_cjs.requireDefined(size.get(rootA));
|
|
723
|
+
const sizeB = chunkN66HCGCY_cjs.requireDefined(size.get(rootB));
|
|
724
|
+
const [root, child] = sizeA >= sizeB ? [rootA, rootB] : [rootB, rootA];
|
|
725
|
+
parent.set(child, root);
|
|
726
|
+
size.set(root, sizeA + sizeB);
|
|
727
|
+
}
|
|
728
|
+
for (const [a, b] of relations) {
|
|
729
|
+
union(a, b);
|
|
730
|
+
}
|
|
731
|
+
const classes = /* @__PURE__ */ new Map();
|
|
732
|
+
for (const key of parent.keys()) {
|
|
733
|
+
const root = find(key);
|
|
734
|
+
const existing = classes.get(root) ?? /* @__PURE__ */ new Set();
|
|
735
|
+
existing.add(key);
|
|
736
|
+
classes.set(root, existing);
|
|
737
|
+
}
|
|
738
|
+
const result = /* @__PURE__ */ new Map();
|
|
739
|
+
for (const members of classes.values()) {
|
|
740
|
+
for (const member of members) {
|
|
741
|
+
result.set(member, new ExcludingReadonlySet(members, member));
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
return result;
|
|
745
|
+
}
|
|
746
|
+
var ExcludingReadonlySet = class {
|
|
747
|
+
#members;
|
|
748
|
+
#excludedMember;
|
|
749
|
+
[Symbol.toStringTag] = "Set";
|
|
750
|
+
constructor(members, excludedMember) {
|
|
751
|
+
this.#members = members;
|
|
752
|
+
this.#excludedMember = excludedMember;
|
|
753
|
+
}
|
|
754
|
+
get size() {
|
|
755
|
+
return this.#members.size - (this.#members.has(this.#excludedMember) ? 1 : 0);
|
|
756
|
+
}
|
|
757
|
+
has(value) {
|
|
758
|
+
return value !== this.#excludedMember && this.#members.has(value);
|
|
759
|
+
}
|
|
760
|
+
*entries() {
|
|
761
|
+
for (const value of this) yield [value, value];
|
|
762
|
+
}
|
|
763
|
+
keys() {
|
|
764
|
+
return this.values();
|
|
765
|
+
}
|
|
766
|
+
*values() {
|
|
767
|
+
for (const value of this.#members) {
|
|
768
|
+
if (value !== this.#excludedMember) yield value;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
forEach(callbackFunction, thisArgument) {
|
|
772
|
+
for (const value of this) {
|
|
773
|
+
callbackFunction.call(thisArgument, value, value, this);
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
[Symbol.iterator]() {
|
|
777
|
+
return this.values();
|
|
778
|
+
}
|
|
779
|
+
union(other) {
|
|
780
|
+
return this.materialize().union(other);
|
|
781
|
+
}
|
|
782
|
+
intersection(other) {
|
|
783
|
+
return this.materialize().intersection(other);
|
|
784
|
+
}
|
|
785
|
+
difference(other) {
|
|
786
|
+
return this.materialize().difference(other);
|
|
787
|
+
}
|
|
788
|
+
symmetricDifference(other) {
|
|
789
|
+
return this.materialize().symmetricDifference(other);
|
|
790
|
+
}
|
|
791
|
+
isSubsetOf(other) {
|
|
792
|
+
return this.materialize().isSubsetOf(other);
|
|
793
|
+
}
|
|
794
|
+
isSupersetOf(other) {
|
|
795
|
+
return this.materialize().isSupersetOf(other);
|
|
796
|
+
}
|
|
797
|
+
isDisjointFrom(other) {
|
|
798
|
+
return this.materialize().isDisjointFrom(other);
|
|
799
|
+
}
|
|
800
|
+
materialize() {
|
|
801
|
+
return new Set(this);
|
|
802
|
+
}
|
|
803
|
+
};
|
|
804
|
+
function computeIriMapping(relations) {
|
|
805
|
+
const result = /* @__PURE__ */ new Map();
|
|
806
|
+
for (const [a, b] of relations) {
|
|
807
|
+
if (isExternalIri(a) && !isExternalIri(b)) {
|
|
808
|
+
result.set(a, b);
|
|
809
|
+
} else if (isExternalIri(b) && !isExternalIri(a)) {
|
|
810
|
+
result.set(b, a);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
return result;
|
|
814
|
+
}
|
|
815
|
+
function computeDisjointPairs(relations, closures) {
|
|
816
|
+
const result = /* @__PURE__ */ new Set();
|
|
817
|
+
for (const [a, b] of relations) {
|
|
818
|
+
const leftKinds = expandDisjointSide(a, closures);
|
|
819
|
+
const rightKinds = expandDisjointSide(b, closures);
|
|
820
|
+
for (const left of leftKinds) {
|
|
821
|
+
for (const right of rightKinds) {
|
|
822
|
+
if (left === right) continue;
|
|
823
|
+
const normalized = left < right ? `${left}|${right}` : `${right}|${left}`;
|
|
824
|
+
result.add(normalized);
|
|
825
|
+
}
|
|
826
|
+
}
|
|
827
|
+
}
|
|
828
|
+
return result;
|
|
829
|
+
}
|
|
830
|
+
function expandDisjointSide(kind, closures) {
|
|
831
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
832
|
+
const consumedEquivalenceClasses = /* @__PURE__ */ new Set();
|
|
833
|
+
const pending = [kind];
|
|
834
|
+
while (pending.length > 0) {
|
|
835
|
+
const current = chunkN66HCGCY_cjs.requireDefined(pending.pop());
|
|
836
|
+
if (expanded.has(current) || isExternalIri(current)) continue;
|
|
837
|
+
expanded.add(current);
|
|
838
|
+
if (!consumedEquivalenceClasses.has(current)) {
|
|
839
|
+
consumedEquivalenceClasses.add(current);
|
|
840
|
+
for (const equivalent of closures.equivalenceSets.get(current) ?? []) {
|
|
841
|
+
consumedEquivalenceClasses.add(equivalent);
|
|
842
|
+
pending.push(equivalent);
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
for (const descendant of closures.subClassDescendants.get(current) ?? []) {
|
|
846
|
+
pending.push(descendant);
|
|
847
|
+
}
|
|
848
|
+
}
|
|
849
|
+
return [...expanded];
|
|
850
|
+
}
|
|
851
|
+
function computeSymmetricRelations(relations) {
|
|
852
|
+
const result = /* @__PURE__ */ new Map();
|
|
853
|
+
for (const [a, b] of relations) {
|
|
854
|
+
const relatedToA = result.get(a) ?? /* @__PURE__ */ new Set();
|
|
855
|
+
relatedToA.add(b);
|
|
856
|
+
result.set(a, relatedToA);
|
|
857
|
+
const relatedToB = result.get(b) ?? /* @__PURE__ */ new Set();
|
|
858
|
+
relatedToB.add(a);
|
|
859
|
+
result.set(b, relatedToB);
|
|
860
|
+
}
|
|
861
|
+
return result;
|
|
862
|
+
}
|
|
863
|
+
function computeEdgeInverses(relations) {
|
|
864
|
+
const result = /* @__PURE__ */ new Map();
|
|
865
|
+
for (const [a, b] of relations) {
|
|
866
|
+
result.set(a, b);
|
|
867
|
+
result.set(b, a);
|
|
868
|
+
}
|
|
869
|
+
return result;
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
// src/ontology/validation.ts
|
|
873
|
+
var STRICTLY_HIERARCHICAL = /* @__PURE__ */ new Set([
|
|
874
|
+
chunkXUO3KQFO_cjs.META_EDGE_SUB_CLASS_OF,
|
|
875
|
+
chunkXUO3KQFO_cjs.META_EDGE_BROADER,
|
|
876
|
+
chunkXUO3KQFO_cjs.META_EDGE_NARROWER,
|
|
877
|
+
chunkXUO3KQFO_cjs.META_EDGE_PART_OF,
|
|
878
|
+
chunkXUO3KQFO_cjs.META_EDGE_HAS_PART
|
|
879
|
+
]);
|
|
880
|
+
var HIERARCHICAL_NORMALIZATION = /* @__PURE__ */ new Map([
|
|
881
|
+
[chunkXUO3KQFO_cjs.META_EDGE_SUB_CLASS_OF, { canonical: chunkXUO3KQFO_cjs.META_EDGE_SUB_CLASS_OF, flip: false }],
|
|
882
|
+
[chunkXUO3KQFO_cjs.META_EDGE_BROADER, { canonical: chunkXUO3KQFO_cjs.META_EDGE_BROADER, flip: false }],
|
|
883
|
+
[chunkXUO3KQFO_cjs.META_EDGE_NARROWER, { canonical: chunkXUO3KQFO_cjs.META_EDGE_BROADER, flip: true }],
|
|
884
|
+
[chunkXUO3KQFO_cjs.META_EDGE_PART_OF, { canonical: chunkXUO3KQFO_cjs.META_EDGE_PART_OF, flip: false }],
|
|
885
|
+
[chunkXUO3KQFO_cjs.META_EDGE_HAS_PART, { canonical: chunkXUO3KQFO_cjs.META_EDGE_PART_OF, flip: true }]
|
|
886
|
+
]);
|
|
887
|
+
function validateOntologyRelations(ontology) {
|
|
888
|
+
const issues = [];
|
|
889
|
+
validateSelfLoopsAndDuplicates(ontology, issues);
|
|
890
|
+
detectHierarchicalCycles(ontology, issues);
|
|
891
|
+
detectDisjointExpansionConflicts(ontology, issues);
|
|
892
|
+
detectMultipleInversePartners(ontology, issues);
|
|
893
|
+
return issues;
|
|
894
|
+
}
|
|
895
|
+
function validateSelfLoopsAndDuplicates(ontology, issues) {
|
|
896
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
897
|
+
for (const [index, relation] of ontology.entries()) {
|
|
898
|
+
if (relation.from === relation.to) {
|
|
899
|
+
if (STRICTLY_HIERARCHICAL.has(relation.metaEdge)) {
|
|
900
|
+
issues.push({
|
|
901
|
+
relationIndex: index,
|
|
902
|
+
message: `Hierarchical meta-edge "${relation.metaEdge}" cannot be a self-loop ("${relation.from}" \u2192 "${relation.to}").`,
|
|
903
|
+
code: "ONTOLOGY_SELF_LOOP",
|
|
904
|
+
details: { metaEdge: relation.metaEdge, kind: relation.from }
|
|
905
|
+
});
|
|
906
|
+
} else if (relation.metaEdge === chunkXUO3KQFO_cjs.META_EDGE_DISJOINT_WITH) {
|
|
907
|
+
issues.push({
|
|
908
|
+
relationIndex: index,
|
|
909
|
+
message: `Contradiction: kind "${relation.from}" cannot be declared disjointWith itself.`,
|
|
910
|
+
code: "ONTOLOGY_DISJOINT_CONFLICT",
|
|
911
|
+
details: { from: relation.from, to: relation.to }
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
const key = `${relation.metaEdge}::${relation.from}->${relation.to}`;
|
|
916
|
+
if (seenKeys.has(key)) {
|
|
917
|
+
issues.push({
|
|
918
|
+
relationIndex: index,
|
|
919
|
+
message: `Duplicate ontology relation "${relation.metaEdge}" (${relation.from} \u2192 ${relation.to}).`,
|
|
920
|
+
code: "DUPLICATE_ONTOLOGY_RELATION",
|
|
921
|
+
details: { ...relation }
|
|
922
|
+
});
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
seenKeys.add(key);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
function buildHierarchicalGroups(ontology) {
|
|
929
|
+
const groups = /* @__PURE__ */ new Map();
|
|
930
|
+
for (const [index, relation] of ontology.entries()) {
|
|
931
|
+
const normalization = HIERARCHICAL_NORMALIZATION.get(relation.metaEdge);
|
|
932
|
+
if (normalization === void 0) continue;
|
|
933
|
+
if (relation.from === relation.to) continue;
|
|
934
|
+
const from = normalization.flip ? relation.to : relation.from;
|
|
935
|
+
const to = normalization.flip ? relation.from : relation.to;
|
|
936
|
+
const edges = groups.get(normalization.canonical) ?? [];
|
|
937
|
+
edges.push({ from, to, originalIndex: index });
|
|
938
|
+
groups.set(normalization.canonical, edges);
|
|
939
|
+
}
|
|
940
|
+
return groups;
|
|
941
|
+
}
|
|
942
|
+
function detectHierarchicalCycles(ontology, issues) {
|
|
943
|
+
const groups = buildHierarchicalGroups(ontology);
|
|
944
|
+
for (const [name, edges] of groups) {
|
|
945
|
+
const closure = computeTransitiveClosure(
|
|
946
|
+
edges.map((edge) => [edge.from, edge.to])
|
|
947
|
+
);
|
|
948
|
+
const reportedNodes = /* @__PURE__ */ new Set();
|
|
949
|
+
for (const [from, reachable] of closure) {
|
|
950
|
+
if (!reachable.has(from) || reportedNodes.has(from)) continue;
|
|
951
|
+
reportedNodes.add(from);
|
|
952
|
+
const offendingEdge = edges.find((edge) => edge.from === from);
|
|
953
|
+
issues.push({
|
|
954
|
+
...offendingEdge === void 0 ? {} : { relationIndex: offendingEdge.originalIndex },
|
|
955
|
+
message: `Cycle detected in "${name}" relations involving "${from}".`,
|
|
956
|
+
code: "ONTOLOGY_CYCLE",
|
|
957
|
+
details: { metaEdge: name, kind: from }
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
function collectDisjointDeclarations(ontology) {
|
|
963
|
+
const declarations = [];
|
|
964
|
+
for (const [index, relation] of ontology.entries()) {
|
|
965
|
+
if (relation.metaEdge !== chunkXUO3KQFO_cjs.META_EDGE_DISJOINT_WITH) continue;
|
|
966
|
+
if (relation.from === relation.to) continue;
|
|
967
|
+
declarations.push({ a: relation.from, b: relation.to, index });
|
|
968
|
+
}
|
|
969
|
+
return declarations;
|
|
970
|
+
}
|
|
971
|
+
function detectDisjointExpansionConflicts(ontology, issues) {
|
|
972
|
+
const declarations = collectDisjointDeclarations(ontology);
|
|
973
|
+
if (declarations.length === 0) return;
|
|
974
|
+
const closures = computeDisjointExpansionClosures(ontology);
|
|
975
|
+
for (const { a, b, index } of declarations) {
|
|
976
|
+
const left = expandDisjointSide(a, closures);
|
|
977
|
+
const right = new Set(expandDisjointSide(b, closures));
|
|
978
|
+
const overlappingKind = [...left].filter((kind) => right.has(kind)).toSorted()[0];
|
|
979
|
+
if (overlappingKind === void 0) continue;
|
|
980
|
+
issues.push({
|
|
981
|
+
relationIndex: index,
|
|
982
|
+
message: `Contradiction: the propagated disjointWith sides "${a}" and "${b}" both contain kind "${overlappingKind}".`,
|
|
983
|
+
code: "ONTOLOGY_DISJOINT_CONFLICT",
|
|
984
|
+
details: { kind: overlappingKind, from: a, to: b }
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
function detectMultipleInversePartners(ontology, issues) {
|
|
989
|
+
const partners = /* @__PURE__ */ new Map();
|
|
990
|
+
for (const [index, relation] of ontology.entries()) {
|
|
991
|
+
if (relation.metaEdge !== chunkXUO3KQFO_cjs.META_EDGE_INVERSE_OF) continue;
|
|
992
|
+
recordInversePartner(relation.from, relation.to, index, partners, issues);
|
|
993
|
+
if (relation.from !== relation.to) {
|
|
994
|
+
recordInversePartner(relation.to, relation.from, index, partners, issues);
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
function recordInversePartner(edgeKind, partnerKind, relationIndex, partners, issues) {
|
|
999
|
+
const existingPartner = partners.get(edgeKind);
|
|
1000
|
+
if (existingPartner === void 0) {
|
|
1001
|
+
partners.set(edgeKind, partnerKind);
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
if (existingPartner === partnerKind) return;
|
|
1005
|
+
issues.push({
|
|
1006
|
+
relationIndex,
|
|
1007
|
+
message: `Edge kind "${edgeKind}" has multiple distinct inverseOf partners ("${existingPartner}" and "${partnerKind}").`,
|
|
1008
|
+
code: "ONTOLOGY_INVERSE_MULTIPLE_PARTNERS",
|
|
1009
|
+
details: { edgeKind, existingPartner, conflictingPartner: partnerKind }
|
|
1010
|
+
});
|
|
1011
|
+
}
|
|
1012
|
+
|
|
280
1013
|
// src/graph-extension/validation.ts
|
|
281
|
-
var META_EDGE_NAME_SET = new Set(
|
|
1014
|
+
var META_EDGE_NAME_SET = new Set(chunkXUO3KQFO_cjs.ALL_META_EDGE_NAMES);
|
|
282
1015
|
var SUPPORTED_PROPERTY_TYPES = /* @__PURE__ */ new Set([
|
|
283
1016
|
"string",
|
|
284
1017
|
"number",
|
|
@@ -315,7 +1048,7 @@ function rejectUnknownPropertyKeys(raw, type, path, issues) {
|
|
|
315
1048
|
for (const key of Object.keys(raw)) {
|
|
316
1049
|
if (COMMON_PROPERTY_KEYS.has(key) || typeKeys.has(key)) continue;
|
|
317
1050
|
issues.push({
|
|
318
|
-
path: `${path}/${
|
|
1051
|
+
path: `${path}/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(key)}`,
|
|
319
1052
|
message: `Unknown property key "${key}" for type "${type}". Recognized keys: ${recognized.join(", ")}.`,
|
|
320
1053
|
code: "UNKNOWN_PROPERTY_KEY"
|
|
321
1054
|
});
|
|
@@ -325,7 +1058,7 @@ function rejectUnknownObjectKeys(raw, allowed, label, path, code, issues) {
|
|
|
325
1058
|
for (const key of Object.keys(raw)) {
|
|
326
1059
|
if (allowed.has(key)) continue;
|
|
327
1060
|
issues.push({
|
|
328
|
-
path: `${path}/${
|
|
1061
|
+
path: `${path}/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(key)}`,
|
|
329
1062
|
message: `Unknown ${label} key "${key}". Allowed: ${[...allowed].join(", ")}.`,
|
|
330
1063
|
code
|
|
331
1064
|
});
|
|
@@ -384,7 +1117,7 @@ var EDGE_INDEX_KEYS = /* @__PURE__ */ new Set([
|
|
|
384
1117
|
function validateGraphExtension(input, options = {}) {
|
|
385
1118
|
const issues = [];
|
|
386
1119
|
const strict = options.strict === true;
|
|
387
|
-
if (!
|
|
1120
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(input)) {
|
|
388
1121
|
issues.push({
|
|
389
1122
|
path: "",
|
|
390
1123
|
message: "Document must be a plain object.",
|
|
@@ -397,7 +1130,7 @@ function validateGraphExtension(input, options = {}) {
|
|
|
397
1130
|
for (const key of Object.keys(documentRecord)) {
|
|
398
1131
|
if (!KNOWN_DOCUMENT_KEYS.has(key)) {
|
|
399
1132
|
issues.push({
|
|
400
|
-
path: `/${
|
|
1133
|
+
path: `/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(key)}`,
|
|
401
1134
|
message: `Unknown top-level key "${key}". Did you mean one of: ${[...KNOWN_DOCUMENT_KEYS].join(", ")}?`,
|
|
402
1135
|
code: "UNKNOWN_DOCUMENT_KEY"
|
|
403
1136
|
});
|
|
@@ -413,7 +1146,7 @@ function validateGraphExtension(input, options = {}) {
|
|
|
413
1146
|
strict
|
|
414
1147
|
);
|
|
415
1148
|
if (ontology !== void 0) {
|
|
416
|
-
validateOntology(ontology,
|
|
1149
|
+
validateOntology(ontology, issues);
|
|
417
1150
|
}
|
|
418
1151
|
const indexes = validateIndexesSection(
|
|
419
1152
|
documentRecord["indexes"],
|
|
@@ -445,7 +1178,7 @@ function validateVersion(raw, issues) {
|
|
|
445
1178
|
}
|
|
446
1179
|
function validateNodesSection(rawNodes, issues, strict) {
|
|
447
1180
|
if (rawNodes === void 0) return void 0;
|
|
448
|
-
if (!
|
|
1181
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(rawNodes)) {
|
|
449
1182
|
issues.push({
|
|
450
1183
|
path: "/nodes",
|
|
451
1184
|
message: "`nodes` must be a plain object keyed by node-kind name.",
|
|
@@ -453,10 +1186,10 @@ function validateNodesSection(rawNodes, issues, strict) {
|
|
|
453
1186
|
});
|
|
454
1187
|
return void 0;
|
|
455
1188
|
}
|
|
456
|
-
const result =
|
|
1189
|
+
const result = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
457
1190
|
const recorded = /* @__PURE__ */ new Set();
|
|
458
1191
|
for (const [kindName, rawNode] of Object.entries(rawNodes)) {
|
|
459
|
-
const path = `/nodes/${
|
|
1192
|
+
const path = `/nodes/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(kindName)}`;
|
|
460
1193
|
if (!isValidKindName(kindName)) {
|
|
461
1194
|
issues.push({
|
|
462
1195
|
path,
|
|
@@ -478,10 +1211,10 @@ function validateNodesSection(rawNodes, issues, strict) {
|
|
|
478
1211
|
result[kindName] = node;
|
|
479
1212
|
recorded.add(kindName);
|
|
480
1213
|
}
|
|
481
|
-
return result;
|
|
1214
|
+
return { ...result };
|
|
482
1215
|
}
|
|
483
1216
|
function validateNodeDocument(kindName, raw, path, issues, strict) {
|
|
484
|
-
if (!
|
|
1217
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
485
1218
|
issues.push({
|
|
486
1219
|
path,
|
|
487
1220
|
message: `Node "${kindName}" must be a plain object.`,
|
|
@@ -530,7 +1263,7 @@ function validateNodeDocument(kindName, raw, path, issues, strict) {
|
|
|
530
1263
|
issues,
|
|
531
1264
|
strict
|
|
532
1265
|
);
|
|
533
|
-
return
|
|
1266
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
534
1267
|
description,
|
|
535
1268
|
annotations,
|
|
536
1269
|
properties,
|
|
@@ -539,7 +1272,7 @@ function validateNodeDocument(kindName, raw, path, issues, strict) {
|
|
|
539
1272
|
}
|
|
540
1273
|
function validateEdgesSection(rawEdges, issues, strict) {
|
|
541
1274
|
if (rawEdges === void 0) return void 0;
|
|
542
|
-
if (!
|
|
1275
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(rawEdges)) {
|
|
543
1276
|
issues.push({
|
|
544
1277
|
path: "/edges",
|
|
545
1278
|
message: "`edges` must be a plain object keyed by edge-kind name.",
|
|
@@ -547,10 +1280,10 @@ function validateEdgesSection(rawEdges, issues, strict) {
|
|
|
547
1280
|
});
|
|
548
1281
|
return void 0;
|
|
549
1282
|
}
|
|
550
|
-
const result =
|
|
1283
|
+
const result = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
551
1284
|
const recorded = /* @__PURE__ */ new Set();
|
|
552
1285
|
for (const [kindName, rawEdge] of Object.entries(rawEdges)) {
|
|
553
|
-
const path = `/edges/${
|
|
1286
|
+
const path = `/edges/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(kindName)}`;
|
|
554
1287
|
if (!isValidKindName(kindName)) {
|
|
555
1288
|
issues.push({
|
|
556
1289
|
path,
|
|
@@ -572,10 +1305,10 @@ function validateEdgesSection(rawEdges, issues, strict) {
|
|
|
572
1305
|
result[kindName] = edge;
|
|
573
1306
|
recorded.add(kindName);
|
|
574
1307
|
}
|
|
575
|
-
return result;
|
|
1308
|
+
return { ...result };
|
|
576
1309
|
}
|
|
577
1310
|
function validateEdgeDocument(kindName, raw, path, issues, strict) {
|
|
578
|
-
if (!
|
|
1311
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
579
1312
|
issues.push({
|
|
580
1313
|
path,
|
|
581
1314
|
message: `Edge "${kindName}" must be a plain object.`,
|
|
@@ -619,7 +1352,7 @@ function validateEdgeDocument(kindName, raw, path, issues, strict) {
|
|
|
619
1352
|
strict
|
|
620
1353
|
);
|
|
621
1354
|
if (properties === void 0) return void 0;
|
|
622
|
-
return
|
|
1355
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
623
1356
|
description,
|
|
624
1357
|
annotations,
|
|
625
1358
|
from,
|
|
@@ -671,7 +1404,7 @@ function validateOntologySection(raw, issues, strict) {
|
|
|
671
1404
|
const result = [];
|
|
672
1405
|
for (const [index, entry] of raw.entries()) {
|
|
673
1406
|
const path = `/ontology/${index}`;
|
|
674
|
-
if (!
|
|
1407
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(entry)) {
|
|
675
1408
|
issues.push({
|
|
676
1409
|
path,
|
|
677
1410
|
message: "Ontology entry must be a plain object.",
|
|
@@ -695,7 +1428,7 @@ function validateOntologySection(raw, issues, strict) {
|
|
|
695
1428
|
if (typeof metaEdge !== "string" || !META_EDGE_NAME_SET.has(metaEdge)) {
|
|
696
1429
|
issues.push({
|
|
697
1430
|
path: `${path}/metaEdge`,
|
|
698
|
-
message: `Unknown meta-edge ${describeUnknownValue(metaEdge)}. Allowed: ${[...
|
|
1431
|
+
message: `Unknown meta-edge ${describeUnknownValue(metaEdge)}. Allowed: ${[...chunkXUO3KQFO_cjs.ALL_META_EDGE_NAMES].join(", ")}.`,
|
|
699
1432
|
code: "UNKNOWN_META_EDGE"
|
|
700
1433
|
});
|
|
701
1434
|
continue;
|
|
@@ -720,113 +1453,14 @@ function validateOntologySection(raw, issues, strict) {
|
|
|
720
1453
|
}
|
|
721
1454
|
return result;
|
|
722
1455
|
}
|
|
723
|
-
function validateOntology(ontology,
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
code: "ONTOLOGY_SELF_LOOP"
|
|
732
|
-
});
|
|
733
|
-
}
|
|
734
|
-
const key = `${relation.metaEdge}::${relation.from}->${relation.to}`;
|
|
735
|
-
if (seenKey.has(key)) {
|
|
736
|
-
issues.push({
|
|
737
|
-
path,
|
|
738
|
-
message: `Duplicate ontology relation "${relation.metaEdge}" (${relation.from} \u2192 ${relation.to}).`,
|
|
739
|
-
code: "DUPLICATE_ONTOLOGY_RELATION"
|
|
740
|
-
});
|
|
741
|
-
continue;
|
|
742
|
-
}
|
|
743
|
-
seenKey.add(key);
|
|
744
|
-
}
|
|
745
|
-
detectHierarchicalCycles(ontology, issues);
|
|
746
|
-
detectDisjointHierarchyContradictions(ontology, issues);
|
|
747
|
-
}
|
|
748
|
-
var STRICTLY_HIERARCHICAL = /* @__PURE__ */ new Set([
|
|
749
|
-
"subClassOf",
|
|
750
|
-
"broader",
|
|
751
|
-
"narrower",
|
|
752
|
-
"partOf",
|
|
753
|
-
"hasPart"
|
|
754
|
-
]);
|
|
755
|
-
function isStrictlyHierarchicalMetaEdge(name) {
|
|
756
|
-
return STRICTLY_HIERARCHICAL.has(name);
|
|
757
|
-
}
|
|
758
|
-
var HIERARCHICAL_NORMALIZATION = /* @__PURE__ */ new Map([
|
|
759
|
-
["subClassOf", { canonical: "subClassOf", flip: false }],
|
|
760
|
-
["broader", { canonical: "broader", flip: false }],
|
|
761
|
-
["narrower", { canonical: "broader", flip: true }],
|
|
762
|
-
["partOf", { canonical: "partOf", flip: false }],
|
|
763
|
-
["hasPart", { canonical: "partOf", flip: true }]
|
|
764
|
-
]);
|
|
765
|
-
function buildHierarchicalGroups(ontology, options) {
|
|
766
|
-
const groups = /* @__PURE__ */ new Map();
|
|
767
|
-
for (const [index, relation] of ontology.entries()) {
|
|
768
|
-
const normalization = HIERARCHICAL_NORMALIZATION.get(relation.metaEdge);
|
|
769
|
-
if (normalization === void 0) continue;
|
|
770
|
-
if (options.skipSelfLoops && relation.from === relation.to) continue;
|
|
771
|
-
const from = normalization.flip ? relation.to : relation.from;
|
|
772
|
-
const to = normalization.flip ? relation.from : relation.to;
|
|
773
|
-
const list = groups.get(normalization.canonical) ?? [];
|
|
774
|
-
list.push({ from, to, originalIndex: index });
|
|
775
|
-
groups.set(normalization.canonical, list);
|
|
776
|
-
}
|
|
777
|
-
return groups;
|
|
778
|
-
}
|
|
779
|
-
function detectHierarchicalCycles(ontology, issues) {
|
|
780
|
-
const groups = buildHierarchicalGroups(ontology, { skipSelfLoops: true });
|
|
781
|
-
for (const [name, edges] of groups) {
|
|
782
|
-
const closure = computeTransitiveClosure(
|
|
783
|
-
edges.map((edge) => [edge.from, edge.to])
|
|
784
|
-
);
|
|
785
|
-
const reportedNodes = /* @__PURE__ */ new Set();
|
|
786
|
-
for (const [from, reachable] of closure) {
|
|
787
|
-
if (!reachable.has(from) || reportedNodes.has(from)) continue;
|
|
788
|
-
reportedNodes.add(from);
|
|
789
|
-
const offendingEdge = edges.find((edge) => edge.from === from);
|
|
790
|
-
const path = offendingEdge === void 0 ? "/ontology" : `/ontology/${offendingEdge.originalIndex}`;
|
|
791
|
-
issues.push({
|
|
792
|
-
path,
|
|
793
|
-
message: `Cycle detected in "${name}" relations involving "${from}".`,
|
|
794
|
-
code: "ONTOLOGY_CYCLE"
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
}
|
|
799
|
-
function detectDisjointHierarchyContradictions(ontology, issues) {
|
|
800
|
-
const disjointPairs = /* @__PURE__ */ new Set();
|
|
801
|
-
const disjointPath = /* @__PURE__ */ new Map();
|
|
802
|
-
for (const [index, relation] of ontology.entries()) {
|
|
803
|
-
if (relation.metaEdge !== "disjointWith") continue;
|
|
804
|
-
disjointPairs.add(`${relation.from}|${relation.to}`);
|
|
805
|
-
disjointPairs.add(`${relation.to}|${relation.from}`);
|
|
806
|
-
disjointPath.set(`${relation.from}|${relation.to}`, `/ontology/${index}`);
|
|
807
|
-
disjointPath.set(`${relation.to}|${relation.from}`, `/ontology/${index}`);
|
|
808
|
-
}
|
|
809
|
-
if (disjointPairs.size === 0) return;
|
|
810
|
-
const groups = buildHierarchicalGroups(ontology, { skipSelfLoops: false });
|
|
811
|
-
const reported = /* @__PURE__ */ new Set();
|
|
812
|
-
for (const [name, edges] of groups) {
|
|
813
|
-
const closure = computeTransitiveClosure(
|
|
814
|
-
edges.map((edge) => [edge.from, edge.to])
|
|
815
|
-
);
|
|
816
|
-
for (const [from, reachable] of closure) {
|
|
817
|
-
for (const to of reachable) {
|
|
818
|
-
const pairKey = `${from}|${to}`;
|
|
819
|
-
if (!disjointPairs.has(pairKey)) continue;
|
|
820
|
-
if (reported.has(pairKey)) continue;
|
|
821
|
-
reported.add(pairKey);
|
|
822
|
-
issues.push({
|
|
823
|
-
path: disjointPath.get(pairKey) ?? "/ontology",
|
|
824
|
-
message: `Contradiction: "${from}" and "${to}" are declared disjointWith but also related by "${name}" (directly or transitively).`,
|
|
825
|
-
code: "ONTOLOGY_DISJOINT_CONFLICT"
|
|
826
|
-
});
|
|
827
|
-
}
|
|
828
|
-
}
|
|
829
|
-
}
|
|
1456
|
+
function validateOntology(ontology, issues) {
|
|
1457
|
+
issues.push(
|
|
1458
|
+
...validateOntologyRelations(ontology).map((issue) => ({
|
|
1459
|
+
path: issue.relationIndex === void 0 ? "/ontology" : `/ontology/${issue.relationIndex}`,
|
|
1460
|
+
message: issue.message,
|
|
1461
|
+
code: issue.code
|
|
1462
|
+
}))
|
|
1463
|
+
);
|
|
830
1464
|
}
|
|
831
1465
|
var INDEX_SCOPE_VALUES = ["graphAndKind", "graph", "none"];
|
|
832
1466
|
var EDGE_INDEX_DIRECTION_VALUES = ["out", "in", "none"];
|
|
@@ -866,7 +1500,7 @@ function validateIndexesSection(rawIndexes, issues, strict) {
|
|
|
866
1500
|
return result;
|
|
867
1501
|
}
|
|
868
1502
|
function validateIndexEntry(raw, path, issues, strict) {
|
|
869
|
-
if (!
|
|
1503
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
870
1504
|
issues.push({
|
|
871
1505
|
path,
|
|
872
1506
|
message: "Index entry must be a plain object.",
|
|
@@ -950,7 +1584,7 @@ function validateIndexEntry(raw, path, issues, strict) {
|
|
|
950
1584
|
strict
|
|
951
1585
|
);
|
|
952
1586
|
if (entity === "node") {
|
|
953
|
-
return
|
|
1587
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
954
1588
|
entity: "node",
|
|
955
1589
|
kind: raw["kind"],
|
|
956
1590
|
name,
|
|
@@ -971,7 +1605,7 @@ function validateIndexEntry(raw, path, issues, strict) {
|
|
|
971
1605
|
);
|
|
972
1606
|
if (!directionResult.ok) return void 0;
|
|
973
1607
|
const direction = directionResult.value;
|
|
974
|
-
return
|
|
1608
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
975
1609
|
entity: "edge",
|
|
976
1610
|
kind: raw["kind"],
|
|
977
1611
|
name,
|
|
@@ -1035,7 +1669,7 @@ function validateStringList(raw, path, issues, options) {
|
|
|
1035
1669
|
}
|
|
1036
1670
|
function validateGraphExtensionIndexWhere(raw, path, issues, strict) {
|
|
1037
1671
|
if (raw === void 0) return void 0;
|
|
1038
|
-
if (!
|
|
1672
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
1039
1673
|
issues.push({
|
|
1040
1674
|
path,
|
|
1041
1675
|
message: "Index `where` must be a plain object.",
|
|
@@ -1074,8 +1708,17 @@ function validateGraphExtensionIndexWhere(raw, path, issues, strict) {
|
|
|
1074
1708
|
op: raw["op"]
|
|
1075
1709
|
});
|
|
1076
1710
|
}
|
|
1711
|
+
function refuseUnstorablePropertyName(propertyName, propertyPath, owner, issues) {
|
|
1712
|
+
if (!chunkLBJKZXDE_cjs.isUnstorablePropertyName(propertyName)) return false;
|
|
1713
|
+
issues.push({
|
|
1714
|
+
path: propertyPath,
|
|
1715
|
+
message: `Property name "${propertyName}" is not allowed for ${owner}: ${chunkLBJKZXDE_cjs.UNSTORABLE_PROPERTY_NAME_REASON}.`,
|
|
1716
|
+
code: "RESERVED_PROPERTY_NAME"
|
|
1717
|
+
});
|
|
1718
|
+
return true;
|
|
1719
|
+
}
|
|
1077
1720
|
function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict) {
|
|
1078
|
-
if (!
|
|
1721
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
1079
1722
|
issues.push({
|
|
1080
1723
|
path,
|
|
1081
1724
|
message: `\`properties\` must be a plain object.`,
|
|
@@ -1083,10 +1726,18 @@ function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict)
|
|
|
1083
1726
|
});
|
|
1084
1727
|
return void 0;
|
|
1085
1728
|
}
|
|
1086
|
-
const reserved = ownerType === "node" ?
|
|
1087
|
-
const result =
|
|
1729
|
+
const reserved = ownerType === "node" ? chunkLBJKZXDE_cjs.RESERVED_NODE_KEYS : chunkLBJKZXDE_cjs.RESERVED_EDGE_KEYS;
|
|
1730
|
+
const result = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1088
1731
|
for (const [propertyName, propertyValue] of Object.entries(raw)) {
|
|
1089
|
-
const propertyPath = `${path}/${
|
|
1732
|
+
const propertyPath = `${path}/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(propertyName)}`;
|
|
1733
|
+
if (refuseUnstorablePropertyName(
|
|
1734
|
+
propertyName,
|
|
1735
|
+
propertyPath,
|
|
1736
|
+
`${ownerType} "${ownerName}"`,
|
|
1737
|
+
issues
|
|
1738
|
+
)) {
|
|
1739
|
+
continue;
|
|
1740
|
+
}
|
|
1090
1741
|
if (reserved.has(propertyName)) {
|
|
1091
1742
|
issues.push({
|
|
1092
1743
|
path: propertyPath,
|
|
@@ -1113,10 +1764,10 @@ function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict)
|
|
|
1113
1764
|
if (validated === void 0) continue;
|
|
1114
1765
|
result[propertyName] = validated;
|
|
1115
1766
|
}
|
|
1116
|
-
return result;
|
|
1767
|
+
return { ...result };
|
|
1117
1768
|
}
|
|
1118
1769
|
function validateProperty(raw, path, depth, issues, strict) {
|
|
1119
|
-
if (!
|
|
1770
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
1120
1771
|
issues.push({
|
|
1121
1772
|
path,
|
|
1122
1773
|
message: "Property descriptor must be a plain object with a `type` field.",
|
|
@@ -1346,7 +1997,7 @@ function validateArrayProperty(raw, path, depth, issues, strict) {
|
|
|
1346
1997
|
});
|
|
1347
1998
|
return void 0;
|
|
1348
1999
|
}
|
|
1349
|
-
if (!
|
|
2000
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(itemsRaw)) {
|
|
1350
2001
|
issues.push({
|
|
1351
2002
|
path: `${path}/items`,
|
|
1352
2003
|
message: "`array.items` must be a plain property descriptor.",
|
|
@@ -1392,7 +2043,7 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1392
2043
|
return void 0;
|
|
1393
2044
|
}
|
|
1394
2045
|
const propertiesRaw = raw["properties"];
|
|
1395
|
-
if (!
|
|
2046
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(propertiesRaw)) {
|
|
1396
2047
|
issues.push({
|
|
1397
2048
|
path: `${path}/properties`,
|
|
1398
2049
|
message: "`object.properties` must be a plain object.",
|
|
@@ -1409,10 +2060,13 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1409
2060
|
});
|
|
1410
2061
|
return void 0;
|
|
1411
2062
|
}
|
|
1412
|
-
const fields =
|
|
2063
|
+
const fields = chunkN66HCGCY_cjs.createDataKeyedBag();
|
|
1413
2064
|
for (const [name, value] of propertiesEntries) {
|
|
1414
|
-
const fieldPath = `${path}/properties/${
|
|
1415
|
-
if (
|
|
2065
|
+
const fieldPath = `${path}/properties/${chunkA7J2YDDI_cjs.encodeJsonPointerSegment(name)}`;
|
|
2066
|
+
if (refuseUnstorablePropertyName(name, fieldPath, "a nested object", issues)) {
|
|
2067
|
+
continue;
|
|
2068
|
+
}
|
|
2069
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(value)) {
|
|
1416
2070
|
issues.push({
|
|
1417
2071
|
path: fieldPath,
|
|
1418
2072
|
message: "Object field descriptor must be a plain object.",
|
|
@@ -1437,12 +2091,12 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1437
2091
|
if (modifiers === void 0) return void 0;
|
|
1438
2092
|
return finalizeProperty(
|
|
1439
2093
|
"object",
|
|
1440
|
-
{ properties: fields },
|
|
2094
|
+
{ properties: { ...fields } },
|
|
1441
2095
|
modifiers
|
|
1442
2096
|
);
|
|
1443
2097
|
}
|
|
1444
2098
|
function finalizeProperty(type, specific, modifiers) {
|
|
1445
|
-
return
|
|
2099
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
1446
2100
|
type,
|
|
1447
2101
|
...specific,
|
|
1448
2102
|
optional: modifiers.optional,
|
|
@@ -1468,7 +2122,7 @@ function validatePropertyModifiers(raw, path, propertyType, issues) {
|
|
|
1468
2122
|
message: `\`searchable\` is only valid on string properties (got "${propertyType}").`,
|
|
1469
2123
|
code: "INVALID_MODIFIER_TARGET"
|
|
1470
2124
|
});
|
|
1471
|
-
} else if (
|
|
2125
|
+
} else if (chunkN66HCGCY_cjs.isPlainObject(raw["searchable"])) {
|
|
1472
2126
|
const searchableRaw = raw["searchable"];
|
|
1473
2127
|
const language = searchableRaw["language"];
|
|
1474
2128
|
if (language === void 0) {
|
|
@@ -1496,14 +2150,14 @@ function validatePropertyModifiers(raw, path, propertyType, issues) {
|
|
|
1496
2150
|
if (raw["embedding"] !== void 0) {
|
|
1497
2151
|
if (propertyType === "array") {
|
|
1498
2152
|
const itemsRaw = raw["items"];
|
|
1499
|
-
const itemType =
|
|
2153
|
+
const itemType = chunkN66HCGCY_cjs.isPlainObject(itemsRaw) ? itemsRaw["type"] : void 0;
|
|
1500
2154
|
if (itemType !== "number") {
|
|
1501
2155
|
issues.push({
|
|
1502
2156
|
path: `${path}/embedding`,
|
|
1503
2157
|
message: '`embedding` requires `array.items.type === "number"`.',
|
|
1504
2158
|
code: "INVALID_MODIFIER_TARGET"
|
|
1505
2159
|
});
|
|
1506
|
-
} else if (
|
|
2160
|
+
} else if (chunkN66HCGCY_cjs.isPlainObject(raw["embedding"])) {
|
|
1507
2161
|
const dim = raw["embedding"]["dimensions"];
|
|
1508
2162
|
if (typeof dim !== "number" || !Number.isInteger(dim) || dim <= 0) {
|
|
1509
2163
|
issues.push({
|
|
@@ -1512,7 +2166,7 @@ function validatePropertyModifiers(raw, path, propertyType, issues) {
|
|
|
1512
2166
|
code: "INVALID_EMBEDDING_DIMENSIONS"
|
|
1513
2167
|
});
|
|
1514
2168
|
} else {
|
|
1515
|
-
const itemsObject =
|
|
2169
|
+
const itemsObject = chunkN66HCGCY_cjs.isPlainObject(itemsRaw) ? itemsRaw : {};
|
|
1516
2170
|
const extraneous = Object.keys(itemsObject).filter(
|
|
1517
2171
|
(key) => key !== "type"
|
|
1518
2172
|
);
|
|
@@ -1554,7 +2208,7 @@ function validatePropertyModifiers(raw, path, propertyType, issues) {
|
|
|
1554
2208
|
}
|
|
1555
2209
|
}
|
|
1556
2210
|
if (issues.length > issuesAtEntry) return void 0;
|
|
1557
|
-
return
|
|
2211
|
+
return chunkN66HCGCY_cjs.compactUndefined({
|
|
1558
2212
|
optional,
|
|
1559
2213
|
searchable,
|
|
1560
2214
|
embedding,
|
|
@@ -1575,7 +2229,7 @@ function validateUniqueConstraints(raw, path, properties, issues, strict) {
|
|
|
1575
2229
|
const names = /* @__PURE__ */ new Set();
|
|
1576
2230
|
for (const [index, entry] of raw.entries()) {
|
|
1577
2231
|
const constraintPath = `${path}/${index}`;
|
|
1578
|
-
if (!
|
|
2232
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(entry)) {
|
|
1579
2233
|
issues.push({
|
|
1580
2234
|
path: constraintPath,
|
|
1581
2235
|
message: "Unique constraint must be a plain object.",
|
|
@@ -1643,7 +2297,7 @@ function validateUniqueConstraints(raw, path, properties, issues, strict) {
|
|
|
1643
2297
|
fieldsValid = false;
|
|
1644
2298
|
break;
|
|
1645
2299
|
}
|
|
1646
|
-
if (!(field
|
|
2300
|
+
if (!chunkN66HCGCY_cjs.hasOwnKey(properties, field)) {
|
|
1647
2301
|
issues.push({
|
|
1648
2302
|
path: `${constraintPath}/fields/${fieldIndex}`,
|
|
1649
2303
|
message: `Unique constraint field "${field}" is not declared on this kind.`,
|
|
@@ -1685,7 +2339,7 @@ function validateUniqueConstraints(raw, path, properties, issues, strict) {
|
|
|
1685
2339
|
);
|
|
1686
2340
|
if (constraint["where"] !== void 0 && where === void 0) continue;
|
|
1687
2341
|
result.push(
|
|
1688
|
-
|
|
2342
|
+
chunkN66HCGCY_cjs.compactUndefined({
|
|
1689
2343
|
name,
|
|
1690
2344
|
fields,
|
|
1691
2345
|
scope,
|
|
@@ -1697,7 +2351,7 @@ function validateUniqueConstraints(raw, path, properties, issues, strict) {
|
|
|
1697
2351
|
return result;
|
|
1698
2352
|
}
|
|
1699
2353
|
function validateUniqueWhere(raw, path, properties, issues, strict) {
|
|
1700
|
-
if (!
|
|
2354
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
1701
2355
|
issues.push({
|
|
1702
2356
|
path,
|
|
1703
2357
|
message: "Unique constraint `where` must be `{ field, op }`.",
|
|
@@ -1725,7 +2379,7 @@ function validateUniqueWhere(raw, path, properties, issues, strict) {
|
|
|
1725
2379
|
});
|
|
1726
2380
|
return void 0;
|
|
1727
2381
|
}
|
|
1728
|
-
if (!(field
|
|
2382
|
+
if (!chunkN66HCGCY_cjs.hasOwnKey(properties, field)) {
|
|
1729
2383
|
issues.push({
|
|
1730
2384
|
path: `${path}/field`,
|
|
1731
2385
|
message: `Unique \`where.field\` "${field}" is not declared on this kind.`,
|
|
@@ -1745,7 +2399,7 @@ function validateUniqueWhere(raw, path, properties, issues, strict) {
|
|
|
1745
2399
|
}
|
|
1746
2400
|
function validateAnnotations(raw, path, ownerLabel, issues) {
|
|
1747
2401
|
if (raw === void 0) return void 0;
|
|
1748
|
-
if (!
|
|
2402
|
+
if (!chunkN66HCGCY_cjs.isPlainObject(raw)) {
|
|
1749
2403
|
issues.push({
|
|
1750
2404
|
path,
|
|
1751
2405
|
message: `Annotations must be a plain JSON object.`,
|
|
@@ -1754,9 +2408,9 @@ function validateAnnotations(raw, path, ownerLabel, issues) {
|
|
|
1754
2408
|
return void 0;
|
|
1755
2409
|
}
|
|
1756
2410
|
try {
|
|
1757
|
-
|
|
2411
|
+
chunkLBJKZXDE_cjs.assertJsonValue(raw, "annotations", ownerLabel);
|
|
1758
2412
|
} catch (error) {
|
|
1759
|
-
if (error instanceof
|
|
2413
|
+
if (error instanceof chunkNI72YOJB_cjs.ConfigurationError) {
|
|
1760
2414
|
const detailPath = error.details["path"];
|
|
1761
2415
|
const annotationPath = typeof detailPath === "string" ? `${path}/${detailPath.replace(/^annotations\.?/, "").replaceAll(".", "/")}` : path;
|
|
1762
2416
|
issues.push({
|
|
@@ -1831,14 +2485,14 @@ function describeUnknownValue(value) {
|
|
|
1831
2485
|
}
|
|
1832
2486
|
function freezeDocument(input) {
|
|
1833
2487
|
return Object.freeze(
|
|
1834
|
-
|
|
2488
|
+
chunkN66HCGCY_cjs.compactUndefined({
|
|
1835
2489
|
version: input.version,
|
|
1836
|
-
nodes: input.nodes === void 0 ? void 0 :
|
|
1837
|
-
edges: input.edges === void 0 ? void 0 :
|
|
2490
|
+
nodes: input.nodes === void 0 ? void 0 : chunkN66HCGCY_cjs.freezeDeep(input.nodes),
|
|
2491
|
+
edges: input.edges === void 0 ? void 0 : chunkN66HCGCY_cjs.freezeDeep(input.edges),
|
|
1838
2492
|
ontology: input.ontology === void 0 ? void 0 : Object.freeze(
|
|
1839
2493
|
input.ontology.map((entry) => Object.freeze({ ...entry }))
|
|
1840
2494
|
),
|
|
1841
|
-
indexes: input.indexes === void 0 ? void 0 : Object.freeze(input.indexes.map((entry) =>
|
|
2495
|
+
indexes: input.indexes === void 0 ? void 0 : Object.freeze(input.indexes.map((entry) => chunkN66HCGCY_cjs.freezeDeep({ ...entry })))
|
|
1842
2496
|
})
|
|
1843
2497
|
);
|
|
1844
2498
|
}
|
|
@@ -1848,22 +2502,29 @@ exports.GRAPH_EXTENSION_ISSUE_CODES = GRAPH_EXTENSION_ISSUE_CODES;
|
|
|
1848
2502
|
exports.GRAPH_EXTENSION_TOP_LEVEL_KEYS = GRAPH_EXTENSION_TOP_LEVEL_KEYS;
|
|
1849
2503
|
exports.GraphExtensionError = GraphExtensionError;
|
|
1850
2504
|
exports.GraphExtensionUnresolvedEndpointError = GraphExtensionUnresolvedEndpointError;
|
|
2505
|
+
exports.GraphExtensionUnresolvedOntologyEndpointError = GraphExtensionUnresolvedOntologyEndpointError;
|
|
1851
2506
|
exports.GraphExtensionValidationError = GraphExtensionValidationError;
|
|
1852
2507
|
exports.GraphExtensionVersionUnsupportedError = GraphExtensionVersionUnsupportedError;
|
|
1853
2508
|
exports.INCOMPATIBLE_CHANGE_TYPES = INCOMPATIBLE_CHANGE_TYPES;
|
|
1854
2509
|
exports.IncompatibleChangeError = IncompatibleChangeError;
|
|
1855
2510
|
exports.KindCollisionError = KindCollisionError;
|
|
1856
2511
|
exports.KindHasReferentsError = KindHasReferentsError;
|
|
2512
|
+
exports.KindRegistry = KindRegistry;
|
|
1857
2513
|
exports.LEGACY_GRAPH_EXTENSION_VERSION = LEGACY_GRAPH_EXTENSION_VERSION;
|
|
1858
2514
|
exports.RemoveCompileTimeKindError = RemoveCompileTimeKindError;
|
|
2515
|
+
exports.computeClosuresFromNamedOntology = computeClosuresFromNamedOntology;
|
|
2516
|
+
exports.computeClosuresFromOntology = computeClosuresFromOntology;
|
|
1859
2517
|
exports.computeTransitiveClosure = computeTransitiveClosure;
|
|
2518
|
+
exports.createEmptyClosures = createEmptyClosures;
|
|
1860
2519
|
exports.err = err;
|
|
1861
2520
|
exports.invertClosure = invertClosure;
|
|
1862
2521
|
exports.isErr = isErr;
|
|
2522
|
+
exports.isExternalIri = isExternalIri;
|
|
1863
2523
|
exports.isOk = isOk;
|
|
1864
2524
|
exports.isReachable = isReachable;
|
|
1865
2525
|
exports.ok = ok;
|
|
1866
2526
|
exports.unwrap = unwrap;
|
|
1867
2527
|
exports.validateGraphExtension = validateGraphExtension;
|
|
1868
|
-
|
|
1869
|
-
//# sourceMappingURL=chunk-
|
|
2528
|
+
exports.validateOntologyRelations = validateOntologyRelations;
|
|
2529
|
+
//# sourceMappingURL=chunk-7BQXPCGN.cjs.map
|
|
2530
|
+
//# sourceMappingURL=chunk-7BQXPCGN.cjs.map
|