@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,8 +1,8 @@
|
|
|
1
|
-
import { ALL_META_EDGE_NAMES } from './chunk-
|
|
2
|
-
import { RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS, assertJsonValue } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { ALL_META_EDGE_NAMES, META_EDGE_DISJOINT_WITH, META_EDGE_INVERSE_OF, META_EDGE_IMPLIES, META_EDGE_HAS_PART, META_EDGE_PART_OF, META_EDGE_RELATED_TO, META_EDGE_SAME_AS, META_EDGE_EQUIVALENT_TO, META_EDGE_NARROWER, META_EDGE_BROADER, META_EDGE_SUB_CLASS_OF } from './chunk-JXXDZTMN.js';
|
|
2
|
+
import { RESERVED_NODE_KEYS, RESERVED_EDGE_KEYS, assertJsonValue, isUnstorablePropertyName, UNSTORABLE_PROPERTY_NAME_REASON } from './chunk-K5ELX2GT.js';
|
|
3
|
+
import { TypeGraphError, ConfigurationError } from './chunk-J3WZ3FA2.js';
|
|
4
|
+
import { encodeJsonPointerSegment } from './chunk-FWJKWH6U.js';
|
|
5
|
+
import { requireDefined, isPlainObject, createDataKeyedBag, compactUndefined, hasOwnKey, freezeDeep } from './chunk-DYATYRY4.js';
|
|
6
6
|
|
|
7
7
|
// src/ontology/closures.ts
|
|
8
8
|
function computeTransitiveClosure(relations) {
|
|
@@ -75,6 +75,7 @@ var GRAPH_EXTENSION_ISSUE_CODES = [
|
|
|
75
75
|
"ONTOLOGY_CYCLE",
|
|
76
76
|
"ONTOLOGY_SELF_LOOP",
|
|
77
77
|
"ONTOLOGY_DISJOINT_CONFLICT",
|
|
78
|
+
"ONTOLOGY_INVERSE_MULTIPLE_PARTNERS",
|
|
78
79
|
"DUPLICATE_ONTOLOGY_RELATION",
|
|
79
80
|
"INVALID_DOCUMENT_SHAPE",
|
|
80
81
|
"UNKNOWN_DOCUMENT_KEY",
|
|
@@ -195,6 +196,21 @@ var GraphExtensionUnresolvedEndpointError = class extends GraphExtensionError {
|
|
|
195
196
|
this.endpoint = endpoint;
|
|
196
197
|
}
|
|
197
198
|
};
|
|
199
|
+
var GraphExtensionUnresolvedOntologyEndpointError = class extends GraphExtensionError {
|
|
200
|
+
code = "GRAPH_EXTENSION_UNRESOLVED_ONTOLOGY_ENDPOINT";
|
|
201
|
+
metaEdge;
|
|
202
|
+
endpoint;
|
|
203
|
+
constructor(metaEdge, endpoint, graphId) {
|
|
204
|
+
super({
|
|
205
|
+
message: `Graph-extension ${metaEdge} endpoint "${endpoint}" does not resolve to a registered edge kind on graph "${graphId}".`,
|
|
206
|
+
code: "GRAPH_EXTENSION_UNRESOLVED_ONTOLOGY_ENDPOINT",
|
|
207
|
+
details: { metaEdge, endpoint, graphId },
|
|
208
|
+
suggestion: "Correct the local edge-kind name, register that edge, or use an absolute http:// or https:// IRI for a deliberate inert external reference."
|
|
209
|
+
});
|
|
210
|
+
this.metaEdge = metaEdge;
|
|
211
|
+
this.endpoint = endpoint;
|
|
212
|
+
}
|
|
213
|
+
};
|
|
198
214
|
var RemoveCompileTimeKindError = class extends GraphExtensionError {
|
|
199
215
|
code = "REMOVE_COMPILE_TIME_KIND";
|
|
200
216
|
kindName;
|
|
@@ -275,6 +291,723 @@ var GRAPH_EXTENSION_TOP_LEVEL_KEYS = [
|
|
|
275
291
|
"indexes"
|
|
276
292
|
];
|
|
277
293
|
|
|
294
|
+
// src/ontology/external-iri.ts
|
|
295
|
+
function isExternalIri(value) {
|
|
296
|
+
return value.startsWith("http://") || value.startsWith("https://");
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
// src/registry/kind-registry.ts
|
|
300
|
+
var KindRegistry = class {
|
|
301
|
+
// === Node & Edge Kinds ===
|
|
302
|
+
nodeKinds;
|
|
303
|
+
edgeKinds;
|
|
304
|
+
/**
|
|
305
|
+
* Durable graph identity capability; supplies the identity defaults for
|
|
306
|
+
* every query builder built from this registry (compile-only and
|
|
307
|
+
* store-bound).
|
|
308
|
+
*/
|
|
309
|
+
identity;
|
|
310
|
+
// === Subsumption (subClassOf) ===
|
|
311
|
+
// Transitive closure for inheritance
|
|
312
|
+
subClassAncestors;
|
|
313
|
+
subClassDescendants;
|
|
314
|
+
// === Hierarchy (broader/narrower) ===
|
|
315
|
+
// Transitive closure for concept hierarchy (separate from subClassOf!)
|
|
316
|
+
broaderClosure;
|
|
317
|
+
narrowerClosure;
|
|
318
|
+
// === Equivalence ===
|
|
319
|
+
equivalenceSets;
|
|
320
|
+
iriToKind;
|
|
321
|
+
relatedKinds;
|
|
322
|
+
// === Constraints ===
|
|
323
|
+
disjointPairs;
|
|
324
|
+
// Normalized pairs: "Organization|Person"
|
|
325
|
+
// === Composition ===
|
|
326
|
+
partOfClosure;
|
|
327
|
+
hasPartClosure;
|
|
328
|
+
// === Edge Relationships ===
|
|
329
|
+
edgeInverses;
|
|
330
|
+
edgeImplicationsClosure;
|
|
331
|
+
edgeImplyingClosure;
|
|
332
|
+
constructor(nodeKinds, edgeKinds, closures, identity) {
|
|
333
|
+
this.nodeKinds = nodeKinds;
|
|
334
|
+
this.edgeKinds = edgeKinds;
|
|
335
|
+
this.identity = identity;
|
|
336
|
+
this.subClassAncestors = closures.subClassAncestors;
|
|
337
|
+
this.subClassDescendants = closures.subClassDescendants;
|
|
338
|
+
this.broaderClosure = closures.broaderClosure;
|
|
339
|
+
this.narrowerClosure = closures.narrowerClosure;
|
|
340
|
+
this.equivalenceSets = closures.equivalenceSets;
|
|
341
|
+
this.iriToKind = closures.iriToKind;
|
|
342
|
+
this.relatedKinds = closures.relatedKinds;
|
|
343
|
+
this.disjointPairs = closures.disjointPairs;
|
|
344
|
+
this.partOfClosure = closures.partOfClosure;
|
|
345
|
+
this.hasPartClosure = closures.hasPartClosure;
|
|
346
|
+
this.edgeInverses = closures.edgeInverses;
|
|
347
|
+
this.edgeImplicationsClosure = closures.edgeImplicationsClosure;
|
|
348
|
+
this.edgeImplyingClosure = closures.edgeImplyingClosure;
|
|
349
|
+
}
|
|
350
|
+
// === Subsumption Methods ===
|
|
351
|
+
/**
|
|
352
|
+
* Checks if child is a subclass of parent (directly or transitively).
|
|
353
|
+
*/
|
|
354
|
+
isSubClassOf(child, parent) {
|
|
355
|
+
return isReachable(this.subClassAncestors, child, parent);
|
|
356
|
+
}
|
|
357
|
+
/**
|
|
358
|
+
* Expands a kind to include all its subclasses.
|
|
359
|
+
* Returns [kind, ...subclasses].
|
|
360
|
+
*/
|
|
361
|
+
expandSubClasses(kind) {
|
|
362
|
+
const descendants = this.subClassDescendants.get(kind) ?? /* @__PURE__ */ new Set();
|
|
363
|
+
return [kind, ...descendants];
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Gets all ancestors of a kind (via subClassOf).
|
|
367
|
+
*/
|
|
368
|
+
getAncestors(kind) {
|
|
369
|
+
return this.subClassAncestors.get(kind) ?? /* @__PURE__ */ new Set();
|
|
370
|
+
}
|
|
371
|
+
/**
|
|
372
|
+
* Gets all descendants of a kind (via subClassOf).
|
|
373
|
+
*/
|
|
374
|
+
getDescendants(kind) {
|
|
375
|
+
return this.subClassDescendants.get(kind) ?? /* @__PURE__ */ new Set();
|
|
376
|
+
}
|
|
377
|
+
// === Hierarchy Methods ===
|
|
378
|
+
/**
|
|
379
|
+
* Checks if narrowerConcept is narrower than broaderConcept.
|
|
380
|
+
*/
|
|
381
|
+
isNarrowerThan(narrowerConcept, broaderConcept) {
|
|
382
|
+
return isReachable(this.broaderClosure, narrowerConcept, broaderConcept);
|
|
383
|
+
}
|
|
384
|
+
/**
|
|
385
|
+
* Checks if broaderConcept is broader than narrowerConcept.
|
|
386
|
+
*/
|
|
387
|
+
isBroaderThan(broaderConcept, narrowerConcept) {
|
|
388
|
+
return isReachable(this.narrowerClosure, broaderConcept, narrowerConcept);
|
|
389
|
+
}
|
|
390
|
+
/**
|
|
391
|
+
* Expands to include all narrower concepts.
|
|
392
|
+
*/
|
|
393
|
+
expandNarrower(kind) {
|
|
394
|
+
const narrower = this.narrowerClosure.get(kind) ?? /* @__PURE__ */ new Set();
|
|
395
|
+
return [kind, ...narrower];
|
|
396
|
+
}
|
|
397
|
+
/**
|
|
398
|
+
* Expands to include all broader concepts.
|
|
399
|
+
*/
|
|
400
|
+
expandBroader(kind) {
|
|
401
|
+
const broader = this.broaderClosure.get(kind) ?? /* @__PURE__ */ new Set();
|
|
402
|
+
return [kind, ...broader];
|
|
403
|
+
}
|
|
404
|
+
// === Equivalence Methods ===
|
|
405
|
+
/**
|
|
406
|
+
* Checks if two kinds are equivalent.
|
|
407
|
+
*/
|
|
408
|
+
areEquivalent(a, b) {
|
|
409
|
+
const equivalents = this.equivalenceSets.get(a);
|
|
410
|
+
return equivalents?.has(b) ?? false;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Gets all equivalents of a kind (including external IRIs).
|
|
414
|
+
*/
|
|
415
|
+
getEquivalents(kind) {
|
|
416
|
+
const equivalents = this.equivalenceSets.get(kind);
|
|
417
|
+
return equivalents ? [...equivalents] : [];
|
|
418
|
+
}
|
|
419
|
+
/**
|
|
420
|
+
* Resolves an external IRI to an internal kind name.
|
|
421
|
+
*/
|
|
422
|
+
resolveIri(iri) {
|
|
423
|
+
return this.iriToKind.get(iri);
|
|
424
|
+
}
|
|
425
|
+
/** Gets directly associated kinds declared through symmetric `relatedTo`. */
|
|
426
|
+
getRelatedKinds(kind) {
|
|
427
|
+
const related = this.relatedKinds.get(kind);
|
|
428
|
+
return related === void 0 ? [] : [...related];
|
|
429
|
+
}
|
|
430
|
+
// === Constraint Methods ===
|
|
431
|
+
/**
|
|
432
|
+
* Checks if two kinds are disjoint.
|
|
433
|
+
*/
|
|
434
|
+
areDisjoint(a, b) {
|
|
435
|
+
const normalizedPair = a < b ? `${a}|${b}` : `${b}|${a}`;
|
|
436
|
+
return this.disjointPairs.has(normalizedPair);
|
|
437
|
+
}
|
|
438
|
+
/**
|
|
439
|
+
* Gets all kinds that are disjoint with the given kind.
|
|
440
|
+
*/
|
|
441
|
+
getDisjointKinds(kind) {
|
|
442
|
+
const result = [];
|
|
443
|
+
for (const pair of this.disjointPairs) {
|
|
444
|
+
const parts = pair.split("|");
|
|
445
|
+
const firstKind = requireDefined(parts[0]);
|
|
446
|
+
const secondKind = requireDefined(parts[1]);
|
|
447
|
+
if (firstKind === kind) result.push(secondKind);
|
|
448
|
+
else if (secondKind === kind) result.push(firstKind);
|
|
449
|
+
}
|
|
450
|
+
return result;
|
|
451
|
+
}
|
|
452
|
+
// === Composition Methods ===
|
|
453
|
+
/**
|
|
454
|
+
* Checks if part is part of whole (directly or transitively).
|
|
455
|
+
*/
|
|
456
|
+
isPartOf(part, whole) {
|
|
457
|
+
return isReachable(this.partOfClosure, part, whole);
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Gets all wholes that contain this part.
|
|
461
|
+
*/
|
|
462
|
+
getWholes(part) {
|
|
463
|
+
const wholes = this.partOfClosure.get(part);
|
|
464
|
+
return wholes ? [...wholes] : [];
|
|
465
|
+
}
|
|
466
|
+
/**
|
|
467
|
+
* Gets all parts of this whole.
|
|
468
|
+
*/
|
|
469
|
+
getParts(whole) {
|
|
470
|
+
const parts = this.hasPartClosure.get(whole);
|
|
471
|
+
return parts ? [...parts] : [];
|
|
472
|
+
}
|
|
473
|
+
// === Edge Relationship Methods ===
|
|
474
|
+
/**
|
|
475
|
+
* Gets the inverse edge kind for a given edge kind.
|
|
476
|
+
* If edgeA inverseOf edgeB, then getInverseEdge("edgeA") returns "edgeB".
|
|
477
|
+
*/
|
|
478
|
+
getInverseEdge(edgeKind) {
|
|
479
|
+
return this.edgeInverses.get(edgeKind);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Gets all edges implied by a given edge (transitively).
|
|
483
|
+
* If A implies B and B implies C, then getImpliedEdges("A") returns ["B", "C"].
|
|
484
|
+
*/
|
|
485
|
+
getImpliedEdges(edgeKind) {
|
|
486
|
+
const implied = this.edgeImplicationsClosure.get(edgeKind);
|
|
487
|
+
return implied ? [...implied] : [];
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* Gets all edges that imply a given edge (transitively).
|
|
491
|
+
* If A implies B and B implies C, then getImplyingEdges("C") returns ["A", "B"].
|
|
492
|
+
* Used for query-time expansion: when querying for C, also include A and B edges.
|
|
493
|
+
*/
|
|
494
|
+
getImplyingEdges(edgeKind) {
|
|
495
|
+
const implying = this.edgeImplyingClosure.get(edgeKind);
|
|
496
|
+
return implying ? [...implying] : [];
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Expands an edge kind to include all edges that imply it.
|
|
500
|
+
* Returns [edgeKind, ...implyingEdges].
|
|
501
|
+
*/
|
|
502
|
+
expandImplyingEdges(edgeKind) {
|
|
503
|
+
const implying = this.edgeImplyingClosure.get(edgeKind) ?? /* @__PURE__ */ new Set();
|
|
504
|
+
return [edgeKind, ...implying];
|
|
505
|
+
}
|
|
506
|
+
// === Edge Endpoint Validation ===
|
|
507
|
+
/**
|
|
508
|
+
* Checks if a concrete kind is assignable to a target kind.
|
|
509
|
+
* Uses subsumption: Company is assignable to Organization if Company subClassOf Organization.
|
|
510
|
+
*/
|
|
511
|
+
isAssignableTo(concreteKind, targetKind) {
|
|
512
|
+
if (concreteKind === targetKind) return true;
|
|
513
|
+
return this.isSubClassOf(concreteKind, targetKind);
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Checks if a concrete kind is assignable to at least one of the given
|
|
517
|
+
* target kinds. Shared by every "is this kind usable where one of these
|
|
518
|
+
* kinds is expected" check (edge endpoint validation, ontology relation
|
|
519
|
+
* endpoint compatibility) so they can't independently drift.
|
|
520
|
+
*/
|
|
521
|
+
isAssignableToAny(concreteKind, targetKinds) {
|
|
522
|
+
return targetKinds.some(
|
|
523
|
+
(targetKind) => this.isAssignableTo(concreteKind, targetKind)
|
|
524
|
+
);
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* Validates that a kind exists in the registry.
|
|
528
|
+
*/
|
|
529
|
+
hasNodeType(name) {
|
|
530
|
+
return this.nodeKinds.has(name);
|
|
531
|
+
}
|
|
532
|
+
/**
|
|
533
|
+
* Validates that an edge kind exists in the registry.
|
|
534
|
+
*/
|
|
535
|
+
hasEdgeType(name) {
|
|
536
|
+
return this.edgeKinds.has(name);
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Gets a node kind by name.
|
|
540
|
+
*/
|
|
541
|
+
getNodeType(name) {
|
|
542
|
+
return this.nodeKinds.get(name);
|
|
543
|
+
}
|
|
544
|
+
/**
|
|
545
|
+
* Gets an edge kind by name.
|
|
546
|
+
*/
|
|
547
|
+
getEdgeType(name) {
|
|
548
|
+
return this.edgeKinds.get(name);
|
|
549
|
+
}
|
|
550
|
+
};
|
|
551
|
+
function createEmptyClosures() {
|
|
552
|
+
return {
|
|
553
|
+
subClassAncestors: /* @__PURE__ */ new Map(),
|
|
554
|
+
subClassDescendants: /* @__PURE__ */ new Map(),
|
|
555
|
+
broaderClosure: /* @__PURE__ */ new Map(),
|
|
556
|
+
narrowerClosure: /* @__PURE__ */ new Map(),
|
|
557
|
+
equivalenceSets: /* @__PURE__ */ new Map(),
|
|
558
|
+
iriToKind: /* @__PURE__ */ new Map(),
|
|
559
|
+
relatedKinds: /* @__PURE__ */ new Map(),
|
|
560
|
+
disjointPairs: /* @__PURE__ */ new Set(),
|
|
561
|
+
partOfClosure: /* @__PURE__ */ new Map(),
|
|
562
|
+
hasPartClosure: /* @__PURE__ */ new Map(),
|
|
563
|
+
edgeInverses: /* @__PURE__ */ new Map(),
|
|
564
|
+
edgeImplicationsClosure: /* @__PURE__ */ new Map(),
|
|
565
|
+
edgeImplyingClosure: /* @__PURE__ */ new Map()
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
function computeClosuresFromOntology(ontology) {
|
|
569
|
+
return computeClosuresFromNamedOntology(
|
|
570
|
+
ontology.map((relation) => ({
|
|
571
|
+
metaEdge: relation.metaEdge.name,
|
|
572
|
+
from: getKindName(relation.from),
|
|
573
|
+
to: getKindName(relation.to)
|
|
574
|
+
}))
|
|
575
|
+
);
|
|
576
|
+
}
|
|
577
|
+
function collectOntologyRelations(ontology) {
|
|
578
|
+
const subClass = [];
|
|
579
|
+
const broader = [];
|
|
580
|
+
const equivalent = [];
|
|
581
|
+
const related = [];
|
|
582
|
+
const disjoint = [];
|
|
583
|
+
const partOf = [];
|
|
584
|
+
const inverseOf = [];
|
|
585
|
+
const implies = [];
|
|
586
|
+
for (const relation of ontology) {
|
|
587
|
+
const fromName = relation.from;
|
|
588
|
+
const toName = relation.to;
|
|
589
|
+
switch (relation.metaEdge) {
|
|
590
|
+
case META_EDGE_SUB_CLASS_OF: {
|
|
591
|
+
subClass.push([fromName, toName]);
|
|
592
|
+
break;
|
|
593
|
+
}
|
|
594
|
+
case META_EDGE_BROADER: {
|
|
595
|
+
broader.push([fromName, toName]);
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
case META_EDGE_NARROWER: {
|
|
599
|
+
broader.push([toName, fromName]);
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
case META_EDGE_EQUIVALENT_TO:
|
|
603
|
+
case META_EDGE_SAME_AS: {
|
|
604
|
+
equivalent.push([fromName, toName]);
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
case META_EDGE_RELATED_TO: {
|
|
608
|
+
related.push([fromName, toName]);
|
|
609
|
+
break;
|
|
610
|
+
}
|
|
611
|
+
case META_EDGE_DISJOINT_WITH: {
|
|
612
|
+
disjoint.push([fromName, toName]);
|
|
613
|
+
break;
|
|
614
|
+
}
|
|
615
|
+
case META_EDGE_PART_OF: {
|
|
616
|
+
partOf.push([fromName, toName]);
|
|
617
|
+
break;
|
|
618
|
+
}
|
|
619
|
+
case META_EDGE_HAS_PART: {
|
|
620
|
+
partOf.push([toName, fromName]);
|
|
621
|
+
break;
|
|
622
|
+
}
|
|
623
|
+
case META_EDGE_INVERSE_OF: {
|
|
624
|
+
inverseOf.push([fromName, toName]);
|
|
625
|
+
break;
|
|
626
|
+
}
|
|
627
|
+
case META_EDGE_IMPLIES: {
|
|
628
|
+
implies.push([fromName, toName]);
|
|
629
|
+
break;
|
|
630
|
+
}
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
return {
|
|
634
|
+
subClass,
|
|
635
|
+
broader,
|
|
636
|
+
equivalent,
|
|
637
|
+
related,
|
|
638
|
+
disjoint,
|
|
639
|
+
partOf,
|
|
640
|
+
inverseOf,
|
|
641
|
+
implies
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
function computeSubsumptionAndEquivalenceClosures(collected) {
|
|
645
|
+
const subClassAncestors = computeTransitiveClosure(collected.subClass);
|
|
646
|
+
return {
|
|
647
|
+
subClassAncestors,
|
|
648
|
+
subClassDescendants: invertClosure(subClassAncestors),
|
|
649
|
+
equivalenceSets: computeEquivalenceSets(collected.equivalent)
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
function computeDisjointExpansionClosures(ontology) {
|
|
653
|
+
return computeSubsumptionAndEquivalenceClosures(
|
|
654
|
+
collectOntologyRelations(ontology)
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
function computeClosuresFromNamedOntology(ontology) {
|
|
658
|
+
const collected = collectOntologyRelations(ontology);
|
|
659
|
+
const { subClassAncestors, subClassDescendants, equivalenceSets } = computeSubsumptionAndEquivalenceClosures(collected);
|
|
660
|
+
const broaderClosure = computeTransitiveClosure(collected.broader);
|
|
661
|
+
const narrowerClosure = invertClosure(broaderClosure);
|
|
662
|
+
const iriToKind = computeIriMapping(collected.equivalent);
|
|
663
|
+
const relatedKinds = computeSymmetricRelations(collected.related);
|
|
664
|
+
const disjointPairs = computeDisjointPairs(collected.disjoint, {
|
|
665
|
+
subClassDescendants,
|
|
666
|
+
equivalenceSets
|
|
667
|
+
});
|
|
668
|
+
const partOfClosure = computeTransitiveClosure(collected.partOf);
|
|
669
|
+
const hasPartClosure = invertClosure(partOfClosure);
|
|
670
|
+
const edgeInverses = computeEdgeInverses(collected.inverseOf);
|
|
671
|
+
const edgeImplicationsClosure = computeTransitiveClosure(collected.implies);
|
|
672
|
+
const edgeImplyingClosure = invertClosure(edgeImplicationsClosure);
|
|
673
|
+
return {
|
|
674
|
+
subClassAncestors,
|
|
675
|
+
subClassDescendants,
|
|
676
|
+
broaderClosure,
|
|
677
|
+
narrowerClosure,
|
|
678
|
+
equivalenceSets,
|
|
679
|
+
iriToKind,
|
|
680
|
+
relatedKinds,
|
|
681
|
+
disjointPairs,
|
|
682
|
+
partOfClosure,
|
|
683
|
+
hasPartClosure,
|
|
684
|
+
edgeInverses,
|
|
685
|
+
edgeImplicationsClosure,
|
|
686
|
+
edgeImplyingClosure
|
|
687
|
+
};
|
|
688
|
+
}
|
|
689
|
+
function getKindName(kindOrIri) {
|
|
690
|
+
if (typeof kindOrIri === "string") {
|
|
691
|
+
return kindOrIri;
|
|
692
|
+
}
|
|
693
|
+
return kindOrIri.kind;
|
|
694
|
+
}
|
|
695
|
+
function computeEquivalenceSets(relations) {
|
|
696
|
+
const parent = /* @__PURE__ */ new Map();
|
|
697
|
+
const size = /* @__PURE__ */ new Map();
|
|
698
|
+
function find(x) {
|
|
699
|
+
if (!parent.has(x)) {
|
|
700
|
+
parent.set(x, x);
|
|
701
|
+
size.set(x, 1);
|
|
702
|
+
return x;
|
|
703
|
+
}
|
|
704
|
+
let root = x;
|
|
705
|
+
while (requireDefined(parent.get(root)) !== root) {
|
|
706
|
+
root = requireDefined(parent.get(root));
|
|
707
|
+
}
|
|
708
|
+
let cursor = x;
|
|
709
|
+
while (cursor !== root) {
|
|
710
|
+
const next = requireDefined(parent.get(cursor));
|
|
711
|
+
parent.set(cursor, root);
|
|
712
|
+
cursor = next;
|
|
713
|
+
}
|
|
714
|
+
return root;
|
|
715
|
+
}
|
|
716
|
+
function union(a, b) {
|
|
717
|
+
const rootA = find(a);
|
|
718
|
+
const rootB = find(b);
|
|
719
|
+
if (rootA === rootB) return;
|
|
720
|
+
const sizeA = requireDefined(size.get(rootA));
|
|
721
|
+
const sizeB = requireDefined(size.get(rootB));
|
|
722
|
+
const [root, child] = sizeA >= sizeB ? [rootA, rootB] : [rootB, rootA];
|
|
723
|
+
parent.set(child, root);
|
|
724
|
+
size.set(root, sizeA + sizeB);
|
|
725
|
+
}
|
|
726
|
+
for (const [a, b] of relations) {
|
|
727
|
+
union(a, b);
|
|
728
|
+
}
|
|
729
|
+
const classes = /* @__PURE__ */ new Map();
|
|
730
|
+
for (const key of parent.keys()) {
|
|
731
|
+
const root = find(key);
|
|
732
|
+
const existing = classes.get(root) ?? /* @__PURE__ */ new Set();
|
|
733
|
+
existing.add(key);
|
|
734
|
+
classes.set(root, existing);
|
|
735
|
+
}
|
|
736
|
+
const result = /* @__PURE__ */ new Map();
|
|
737
|
+
for (const members of classes.values()) {
|
|
738
|
+
for (const member of members) {
|
|
739
|
+
result.set(member, new ExcludingReadonlySet(members, member));
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
return result;
|
|
743
|
+
}
|
|
744
|
+
var ExcludingReadonlySet = class {
|
|
745
|
+
#members;
|
|
746
|
+
#excludedMember;
|
|
747
|
+
[Symbol.toStringTag] = "Set";
|
|
748
|
+
constructor(members, excludedMember) {
|
|
749
|
+
this.#members = members;
|
|
750
|
+
this.#excludedMember = excludedMember;
|
|
751
|
+
}
|
|
752
|
+
get size() {
|
|
753
|
+
return this.#members.size - (this.#members.has(this.#excludedMember) ? 1 : 0);
|
|
754
|
+
}
|
|
755
|
+
has(value) {
|
|
756
|
+
return value !== this.#excludedMember && this.#members.has(value);
|
|
757
|
+
}
|
|
758
|
+
*entries() {
|
|
759
|
+
for (const value of this) yield [value, value];
|
|
760
|
+
}
|
|
761
|
+
keys() {
|
|
762
|
+
return this.values();
|
|
763
|
+
}
|
|
764
|
+
*values() {
|
|
765
|
+
for (const value of this.#members) {
|
|
766
|
+
if (value !== this.#excludedMember) yield value;
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
forEach(callbackFunction, thisArgument) {
|
|
770
|
+
for (const value of this) {
|
|
771
|
+
callbackFunction.call(thisArgument, value, value, this);
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
[Symbol.iterator]() {
|
|
775
|
+
return this.values();
|
|
776
|
+
}
|
|
777
|
+
union(other) {
|
|
778
|
+
return this.materialize().union(other);
|
|
779
|
+
}
|
|
780
|
+
intersection(other) {
|
|
781
|
+
return this.materialize().intersection(other);
|
|
782
|
+
}
|
|
783
|
+
difference(other) {
|
|
784
|
+
return this.materialize().difference(other);
|
|
785
|
+
}
|
|
786
|
+
symmetricDifference(other) {
|
|
787
|
+
return this.materialize().symmetricDifference(other);
|
|
788
|
+
}
|
|
789
|
+
isSubsetOf(other) {
|
|
790
|
+
return this.materialize().isSubsetOf(other);
|
|
791
|
+
}
|
|
792
|
+
isSupersetOf(other) {
|
|
793
|
+
return this.materialize().isSupersetOf(other);
|
|
794
|
+
}
|
|
795
|
+
isDisjointFrom(other) {
|
|
796
|
+
return this.materialize().isDisjointFrom(other);
|
|
797
|
+
}
|
|
798
|
+
materialize() {
|
|
799
|
+
return new Set(this);
|
|
800
|
+
}
|
|
801
|
+
};
|
|
802
|
+
function computeIriMapping(relations) {
|
|
803
|
+
const result = /* @__PURE__ */ new Map();
|
|
804
|
+
for (const [a, b] of relations) {
|
|
805
|
+
if (isExternalIri(a) && !isExternalIri(b)) {
|
|
806
|
+
result.set(a, b);
|
|
807
|
+
} else if (isExternalIri(b) && !isExternalIri(a)) {
|
|
808
|
+
result.set(b, a);
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
return result;
|
|
812
|
+
}
|
|
813
|
+
function computeDisjointPairs(relations, closures) {
|
|
814
|
+
const result = /* @__PURE__ */ new Set();
|
|
815
|
+
for (const [a, b] of relations) {
|
|
816
|
+
const leftKinds = expandDisjointSide(a, closures);
|
|
817
|
+
const rightKinds = expandDisjointSide(b, closures);
|
|
818
|
+
for (const left of leftKinds) {
|
|
819
|
+
for (const right of rightKinds) {
|
|
820
|
+
if (left === right) continue;
|
|
821
|
+
const normalized = left < right ? `${left}|${right}` : `${right}|${left}`;
|
|
822
|
+
result.add(normalized);
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
return result;
|
|
827
|
+
}
|
|
828
|
+
function expandDisjointSide(kind, closures) {
|
|
829
|
+
const expanded = /* @__PURE__ */ new Set();
|
|
830
|
+
const consumedEquivalenceClasses = /* @__PURE__ */ new Set();
|
|
831
|
+
const pending = [kind];
|
|
832
|
+
while (pending.length > 0) {
|
|
833
|
+
const current = requireDefined(pending.pop());
|
|
834
|
+
if (expanded.has(current) || isExternalIri(current)) continue;
|
|
835
|
+
expanded.add(current);
|
|
836
|
+
if (!consumedEquivalenceClasses.has(current)) {
|
|
837
|
+
consumedEquivalenceClasses.add(current);
|
|
838
|
+
for (const equivalent of closures.equivalenceSets.get(current) ?? []) {
|
|
839
|
+
consumedEquivalenceClasses.add(equivalent);
|
|
840
|
+
pending.push(equivalent);
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
for (const descendant of closures.subClassDescendants.get(current) ?? []) {
|
|
844
|
+
pending.push(descendant);
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
return [...expanded];
|
|
848
|
+
}
|
|
849
|
+
function computeSymmetricRelations(relations) {
|
|
850
|
+
const result = /* @__PURE__ */ new Map();
|
|
851
|
+
for (const [a, b] of relations) {
|
|
852
|
+
const relatedToA = result.get(a) ?? /* @__PURE__ */ new Set();
|
|
853
|
+
relatedToA.add(b);
|
|
854
|
+
result.set(a, relatedToA);
|
|
855
|
+
const relatedToB = result.get(b) ?? /* @__PURE__ */ new Set();
|
|
856
|
+
relatedToB.add(a);
|
|
857
|
+
result.set(b, relatedToB);
|
|
858
|
+
}
|
|
859
|
+
return result;
|
|
860
|
+
}
|
|
861
|
+
function computeEdgeInverses(relations) {
|
|
862
|
+
const result = /* @__PURE__ */ new Map();
|
|
863
|
+
for (const [a, b] of relations) {
|
|
864
|
+
result.set(a, b);
|
|
865
|
+
result.set(b, a);
|
|
866
|
+
}
|
|
867
|
+
return result;
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// src/ontology/validation.ts
|
|
871
|
+
var STRICTLY_HIERARCHICAL = /* @__PURE__ */ new Set([
|
|
872
|
+
META_EDGE_SUB_CLASS_OF,
|
|
873
|
+
META_EDGE_BROADER,
|
|
874
|
+
META_EDGE_NARROWER,
|
|
875
|
+
META_EDGE_PART_OF,
|
|
876
|
+
META_EDGE_HAS_PART
|
|
877
|
+
]);
|
|
878
|
+
var HIERARCHICAL_NORMALIZATION = /* @__PURE__ */ new Map([
|
|
879
|
+
[META_EDGE_SUB_CLASS_OF, { canonical: META_EDGE_SUB_CLASS_OF, flip: false }],
|
|
880
|
+
[META_EDGE_BROADER, { canonical: META_EDGE_BROADER, flip: false }],
|
|
881
|
+
[META_EDGE_NARROWER, { canonical: META_EDGE_BROADER, flip: true }],
|
|
882
|
+
[META_EDGE_PART_OF, { canonical: META_EDGE_PART_OF, flip: false }],
|
|
883
|
+
[META_EDGE_HAS_PART, { canonical: META_EDGE_PART_OF, flip: true }]
|
|
884
|
+
]);
|
|
885
|
+
function validateOntologyRelations(ontology) {
|
|
886
|
+
const issues = [];
|
|
887
|
+
validateSelfLoopsAndDuplicates(ontology, issues);
|
|
888
|
+
detectHierarchicalCycles(ontology, issues);
|
|
889
|
+
detectDisjointExpansionConflicts(ontology, issues);
|
|
890
|
+
detectMultipleInversePartners(ontology, issues);
|
|
891
|
+
return issues;
|
|
892
|
+
}
|
|
893
|
+
function validateSelfLoopsAndDuplicates(ontology, issues) {
|
|
894
|
+
const seenKeys = /* @__PURE__ */ new Set();
|
|
895
|
+
for (const [index, relation] of ontology.entries()) {
|
|
896
|
+
if (relation.from === relation.to) {
|
|
897
|
+
if (STRICTLY_HIERARCHICAL.has(relation.metaEdge)) {
|
|
898
|
+
issues.push({
|
|
899
|
+
relationIndex: index,
|
|
900
|
+
message: `Hierarchical meta-edge "${relation.metaEdge}" cannot be a self-loop ("${relation.from}" \u2192 "${relation.to}").`,
|
|
901
|
+
code: "ONTOLOGY_SELF_LOOP",
|
|
902
|
+
details: { metaEdge: relation.metaEdge, kind: relation.from }
|
|
903
|
+
});
|
|
904
|
+
} else if (relation.metaEdge === META_EDGE_DISJOINT_WITH) {
|
|
905
|
+
issues.push({
|
|
906
|
+
relationIndex: index,
|
|
907
|
+
message: `Contradiction: kind "${relation.from}" cannot be declared disjointWith itself.`,
|
|
908
|
+
code: "ONTOLOGY_DISJOINT_CONFLICT",
|
|
909
|
+
details: { from: relation.from, to: relation.to }
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
const key = `${relation.metaEdge}::${relation.from}->${relation.to}`;
|
|
914
|
+
if (seenKeys.has(key)) {
|
|
915
|
+
issues.push({
|
|
916
|
+
relationIndex: index,
|
|
917
|
+
message: `Duplicate ontology relation "${relation.metaEdge}" (${relation.from} \u2192 ${relation.to}).`,
|
|
918
|
+
code: "DUPLICATE_ONTOLOGY_RELATION",
|
|
919
|
+
details: { ...relation }
|
|
920
|
+
});
|
|
921
|
+
continue;
|
|
922
|
+
}
|
|
923
|
+
seenKeys.add(key);
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
function buildHierarchicalGroups(ontology) {
|
|
927
|
+
const groups = /* @__PURE__ */ new Map();
|
|
928
|
+
for (const [index, relation] of ontology.entries()) {
|
|
929
|
+
const normalization = HIERARCHICAL_NORMALIZATION.get(relation.metaEdge);
|
|
930
|
+
if (normalization === void 0) continue;
|
|
931
|
+
if (relation.from === relation.to) continue;
|
|
932
|
+
const from = normalization.flip ? relation.to : relation.from;
|
|
933
|
+
const to = normalization.flip ? relation.from : relation.to;
|
|
934
|
+
const edges = groups.get(normalization.canonical) ?? [];
|
|
935
|
+
edges.push({ from, to, originalIndex: index });
|
|
936
|
+
groups.set(normalization.canonical, edges);
|
|
937
|
+
}
|
|
938
|
+
return groups;
|
|
939
|
+
}
|
|
940
|
+
function detectHierarchicalCycles(ontology, issues) {
|
|
941
|
+
const groups = buildHierarchicalGroups(ontology);
|
|
942
|
+
for (const [name, edges] of groups) {
|
|
943
|
+
const closure = computeTransitiveClosure(
|
|
944
|
+
edges.map((edge) => [edge.from, edge.to])
|
|
945
|
+
);
|
|
946
|
+
const reportedNodes = /* @__PURE__ */ new Set();
|
|
947
|
+
for (const [from, reachable] of closure) {
|
|
948
|
+
if (!reachable.has(from) || reportedNodes.has(from)) continue;
|
|
949
|
+
reportedNodes.add(from);
|
|
950
|
+
const offendingEdge = edges.find((edge) => edge.from === from);
|
|
951
|
+
issues.push({
|
|
952
|
+
...offendingEdge === void 0 ? {} : { relationIndex: offendingEdge.originalIndex },
|
|
953
|
+
message: `Cycle detected in "${name}" relations involving "${from}".`,
|
|
954
|
+
code: "ONTOLOGY_CYCLE",
|
|
955
|
+
details: { metaEdge: name, kind: from }
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
function collectDisjointDeclarations(ontology) {
|
|
961
|
+
const declarations = [];
|
|
962
|
+
for (const [index, relation] of ontology.entries()) {
|
|
963
|
+
if (relation.metaEdge !== META_EDGE_DISJOINT_WITH) continue;
|
|
964
|
+
if (relation.from === relation.to) continue;
|
|
965
|
+
declarations.push({ a: relation.from, b: relation.to, index });
|
|
966
|
+
}
|
|
967
|
+
return declarations;
|
|
968
|
+
}
|
|
969
|
+
function detectDisjointExpansionConflicts(ontology, issues) {
|
|
970
|
+
const declarations = collectDisjointDeclarations(ontology);
|
|
971
|
+
if (declarations.length === 0) return;
|
|
972
|
+
const closures = computeDisjointExpansionClosures(ontology);
|
|
973
|
+
for (const { a, b, index } of declarations) {
|
|
974
|
+
const left = expandDisjointSide(a, closures);
|
|
975
|
+
const right = new Set(expandDisjointSide(b, closures));
|
|
976
|
+
const overlappingKind = [...left].filter((kind) => right.has(kind)).toSorted()[0];
|
|
977
|
+
if (overlappingKind === void 0) continue;
|
|
978
|
+
issues.push({
|
|
979
|
+
relationIndex: index,
|
|
980
|
+
message: `Contradiction: the propagated disjointWith sides "${a}" and "${b}" both contain kind "${overlappingKind}".`,
|
|
981
|
+
code: "ONTOLOGY_DISJOINT_CONFLICT",
|
|
982
|
+
details: { kind: overlappingKind, from: a, to: b }
|
|
983
|
+
});
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
function detectMultipleInversePartners(ontology, issues) {
|
|
987
|
+
const partners = /* @__PURE__ */ new Map();
|
|
988
|
+
for (const [index, relation] of ontology.entries()) {
|
|
989
|
+
if (relation.metaEdge !== META_EDGE_INVERSE_OF) continue;
|
|
990
|
+
recordInversePartner(relation.from, relation.to, index, partners, issues);
|
|
991
|
+
if (relation.from !== relation.to) {
|
|
992
|
+
recordInversePartner(relation.to, relation.from, index, partners, issues);
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
function recordInversePartner(edgeKind, partnerKind, relationIndex, partners, issues) {
|
|
997
|
+
const existingPartner = partners.get(edgeKind);
|
|
998
|
+
if (existingPartner === void 0) {
|
|
999
|
+
partners.set(edgeKind, partnerKind);
|
|
1000
|
+
return;
|
|
1001
|
+
}
|
|
1002
|
+
if (existingPartner === partnerKind) return;
|
|
1003
|
+
issues.push({
|
|
1004
|
+
relationIndex,
|
|
1005
|
+
message: `Edge kind "${edgeKind}" has multiple distinct inverseOf partners ("${existingPartner}" and "${partnerKind}").`,
|
|
1006
|
+
code: "ONTOLOGY_INVERSE_MULTIPLE_PARTNERS",
|
|
1007
|
+
details: { edgeKind, existingPartner, conflictingPartner: partnerKind }
|
|
1008
|
+
});
|
|
1009
|
+
}
|
|
1010
|
+
|
|
278
1011
|
// src/graph-extension/validation.ts
|
|
279
1012
|
var META_EDGE_NAME_SET = new Set(ALL_META_EDGE_NAMES);
|
|
280
1013
|
var SUPPORTED_PROPERTY_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -411,7 +1144,7 @@ function validateGraphExtension(input, options = {}) {
|
|
|
411
1144
|
strict
|
|
412
1145
|
);
|
|
413
1146
|
if (ontology !== void 0) {
|
|
414
|
-
validateOntology(ontology,
|
|
1147
|
+
validateOntology(ontology, issues);
|
|
415
1148
|
}
|
|
416
1149
|
const indexes = validateIndexesSection(
|
|
417
1150
|
documentRecord["indexes"],
|
|
@@ -451,7 +1184,7 @@ function validateNodesSection(rawNodes, issues, strict) {
|
|
|
451
1184
|
});
|
|
452
1185
|
return void 0;
|
|
453
1186
|
}
|
|
454
|
-
const result =
|
|
1187
|
+
const result = createDataKeyedBag();
|
|
455
1188
|
const recorded = /* @__PURE__ */ new Set();
|
|
456
1189
|
for (const [kindName, rawNode] of Object.entries(rawNodes)) {
|
|
457
1190
|
const path = `/nodes/${encodeJsonPointerSegment(kindName)}`;
|
|
@@ -476,7 +1209,7 @@ function validateNodesSection(rawNodes, issues, strict) {
|
|
|
476
1209
|
result[kindName] = node;
|
|
477
1210
|
recorded.add(kindName);
|
|
478
1211
|
}
|
|
479
|
-
return result;
|
|
1212
|
+
return { ...result };
|
|
480
1213
|
}
|
|
481
1214
|
function validateNodeDocument(kindName, raw, path, issues, strict) {
|
|
482
1215
|
if (!isPlainObject(raw)) {
|
|
@@ -545,7 +1278,7 @@ function validateEdgesSection(rawEdges, issues, strict) {
|
|
|
545
1278
|
});
|
|
546
1279
|
return void 0;
|
|
547
1280
|
}
|
|
548
|
-
const result =
|
|
1281
|
+
const result = createDataKeyedBag();
|
|
549
1282
|
const recorded = /* @__PURE__ */ new Set();
|
|
550
1283
|
for (const [kindName, rawEdge] of Object.entries(rawEdges)) {
|
|
551
1284
|
const path = `/edges/${encodeJsonPointerSegment(kindName)}`;
|
|
@@ -570,7 +1303,7 @@ function validateEdgesSection(rawEdges, issues, strict) {
|
|
|
570
1303
|
result[kindName] = edge;
|
|
571
1304
|
recorded.add(kindName);
|
|
572
1305
|
}
|
|
573
|
-
return result;
|
|
1306
|
+
return { ...result };
|
|
574
1307
|
}
|
|
575
1308
|
function validateEdgeDocument(kindName, raw, path, issues, strict) {
|
|
576
1309
|
if (!isPlainObject(raw)) {
|
|
@@ -718,113 +1451,14 @@ function validateOntologySection(raw, issues, strict) {
|
|
|
718
1451
|
}
|
|
719
1452
|
return result;
|
|
720
1453
|
}
|
|
721
|
-
function validateOntology(ontology,
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
code: "ONTOLOGY_SELF_LOOP"
|
|
730
|
-
});
|
|
731
|
-
}
|
|
732
|
-
const key = `${relation.metaEdge}::${relation.from}->${relation.to}`;
|
|
733
|
-
if (seenKey.has(key)) {
|
|
734
|
-
issues.push({
|
|
735
|
-
path,
|
|
736
|
-
message: `Duplicate ontology relation "${relation.metaEdge}" (${relation.from} \u2192 ${relation.to}).`,
|
|
737
|
-
code: "DUPLICATE_ONTOLOGY_RELATION"
|
|
738
|
-
});
|
|
739
|
-
continue;
|
|
740
|
-
}
|
|
741
|
-
seenKey.add(key);
|
|
742
|
-
}
|
|
743
|
-
detectHierarchicalCycles(ontology, issues);
|
|
744
|
-
detectDisjointHierarchyContradictions(ontology, issues);
|
|
745
|
-
}
|
|
746
|
-
var STRICTLY_HIERARCHICAL = /* @__PURE__ */ new Set([
|
|
747
|
-
"subClassOf",
|
|
748
|
-
"broader",
|
|
749
|
-
"narrower",
|
|
750
|
-
"partOf",
|
|
751
|
-
"hasPart"
|
|
752
|
-
]);
|
|
753
|
-
function isStrictlyHierarchicalMetaEdge(name) {
|
|
754
|
-
return STRICTLY_HIERARCHICAL.has(name);
|
|
755
|
-
}
|
|
756
|
-
var HIERARCHICAL_NORMALIZATION = /* @__PURE__ */ new Map([
|
|
757
|
-
["subClassOf", { canonical: "subClassOf", flip: false }],
|
|
758
|
-
["broader", { canonical: "broader", flip: false }],
|
|
759
|
-
["narrower", { canonical: "broader", flip: true }],
|
|
760
|
-
["partOf", { canonical: "partOf", flip: false }],
|
|
761
|
-
["hasPart", { canonical: "partOf", flip: true }]
|
|
762
|
-
]);
|
|
763
|
-
function buildHierarchicalGroups(ontology, options) {
|
|
764
|
-
const groups = /* @__PURE__ */ new Map();
|
|
765
|
-
for (const [index, relation] of ontology.entries()) {
|
|
766
|
-
const normalization = HIERARCHICAL_NORMALIZATION.get(relation.metaEdge);
|
|
767
|
-
if (normalization === void 0) continue;
|
|
768
|
-
if (options.skipSelfLoops && relation.from === relation.to) continue;
|
|
769
|
-
const from = normalization.flip ? relation.to : relation.from;
|
|
770
|
-
const to = normalization.flip ? relation.from : relation.to;
|
|
771
|
-
const list = groups.get(normalization.canonical) ?? [];
|
|
772
|
-
list.push({ from, to, originalIndex: index });
|
|
773
|
-
groups.set(normalization.canonical, list);
|
|
774
|
-
}
|
|
775
|
-
return groups;
|
|
776
|
-
}
|
|
777
|
-
function detectHierarchicalCycles(ontology, issues) {
|
|
778
|
-
const groups = buildHierarchicalGroups(ontology, { skipSelfLoops: true });
|
|
779
|
-
for (const [name, edges] of groups) {
|
|
780
|
-
const closure = computeTransitiveClosure(
|
|
781
|
-
edges.map((edge) => [edge.from, edge.to])
|
|
782
|
-
);
|
|
783
|
-
const reportedNodes = /* @__PURE__ */ new Set();
|
|
784
|
-
for (const [from, reachable] of closure) {
|
|
785
|
-
if (!reachable.has(from) || reportedNodes.has(from)) continue;
|
|
786
|
-
reportedNodes.add(from);
|
|
787
|
-
const offendingEdge = edges.find((edge) => edge.from === from);
|
|
788
|
-
const path = offendingEdge === void 0 ? "/ontology" : `/ontology/${offendingEdge.originalIndex}`;
|
|
789
|
-
issues.push({
|
|
790
|
-
path,
|
|
791
|
-
message: `Cycle detected in "${name}" relations involving "${from}".`,
|
|
792
|
-
code: "ONTOLOGY_CYCLE"
|
|
793
|
-
});
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
function detectDisjointHierarchyContradictions(ontology, issues) {
|
|
798
|
-
const disjointPairs = /* @__PURE__ */ new Set();
|
|
799
|
-
const disjointPath = /* @__PURE__ */ new Map();
|
|
800
|
-
for (const [index, relation] of ontology.entries()) {
|
|
801
|
-
if (relation.metaEdge !== "disjointWith") continue;
|
|
802
|
-
disjointPairs.add(`${relation.from}|${relation.to}`);
|
|
803
|
-
disjointPairs.add(`${relation.to}|${relation.from}`);
|
|
804
|
-
disjointPath.set(`${relation.from}|${relation.to}`, `/ontology/${index}`);
|
|
805
|
-
disjointPath.set(`${relation.to}|${relation.from}`, `/ontology/${index}`);
|
|
806
|
-
}
|
|
807
|
-
if (disjointPairs.size === 0) return;
|
|
808
|
-
const groups = buildHierarchicalGroups(ontology, { skipSelfLoops: false });
|
|
809
|
-
const reported = /* @__PURE__ */ new Set();
|
|
810
|
-
for (const [name, edges] of groups) {
|
|
811
|
-
const closure = computeTransitiveClosure(
|
|
812
|
-
edges.map((edge) => [edge.from, edge.to])
|
|
813
|
-
);
|
|
814
|
-
for (const [from, reachable] of closure) {
|
|
815
|
-
for (const to of reachable) {
|
|
816
|
-
const pairKey = `${from}|${to}`;
|
|
817
|
-
if (!disjointPairs.has(pairKey)) continue;
|
|
818
|
-
if (reported.has(pairKey)) continue;
|
|
819
|
-
reported.add(pairKey);
|
|
820
|
-
issues.push({
|
|
821
|
-
path: disjointPath.get(pairKey) ?? "/ontology",
|
|
822
|
-
message: `Contradiction: "${from}" and "${to}" are declared disjointWith but also related by "${name}" (directly or transitively).`,
|
|
823
|
-
code: "ONTOLOGY_DISJOINT_CONFLICT"
|
|
824
|
-
});
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
}
|
|
1454
|
+
function validateOntology(ontology, issues) {
|
|
1455
|
+
issues.push(
|
|
1456
|
+
...validateOntologyRelations(ontology).map((issue) => ({
|
|
1457
|
+
path: issue.relationIndex === void 0 ? "/ontology" : `/ontology/${issue.relationIndex}`,
|
|
1458
|
+
message: issue.message,
|
|
1459
|
+
code: issue.code
|
|
1460
|
+
}))
|
|
1461
|
+
);
|
|
828
1462
|
}
|
|
829
1463
|
var INDEX_SCOPE_VALUES = ["graphAndKind", "graph", "none"];
|
|
830
1464
|
var EDGE_INDEX_DIRECTION_VALUES = ["out", "in", "none"];
|
|
@@ -1072,6 +1706,15 @@ function validateGraphExtensionIndexWhere(raw, path, issues, strict) {
|
|
|
1072
1706
|
op: raw["op"]
|
|
1073
1707
|
});
|
|
1074
1708
|
}
|
|
1709
|
+
function refuseUnstorablePropertyName(propertyName, propertyPath, owner, issues) {
|
|
1710
|
+
if (!isUnstorablePropertyName(propertyName)) return false;
|
|
1711
|
+
issues.push({
|
|
1712
|
+
path: propertyPath,
|
|
1713
|
+
message: `Property name "${propertyName}" is not allowed for ${owner}: ${UNSTORABLE_PROPERTY_NAME_REASON}.`,
|
|
1714
|
+
code: "RESERVED_PROPERTY_NAME"
|
|
1715
|
+
});
|
|
1716
|
+
return true;
|
|
1717
|
+
}
|
|
1075
1718
|
function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict) {
|
|
1076
1719
|
if (!isPlainObject(raw)) {
|
|
1077
1720
|
issues.push({
|
|
@@ -1082,9 +1725,17 @@ function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict)
|
|
|
1082
1725
|
return void 0;
|
|
1083
1726
|
}
|
|
1084
1727
|
const reserved = ownerType === "node" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;
|
|
1085
|
-
const result =
|
|
1728
|
+
const result = createDataKeyedBag();
|
|
1086
1729
|
for (const [propertyName, propertyValue] of Object.entries(raw)) {
|
|
1087
1730
|
const propertyPath = `${path}/${encodeJsonPointerSegment(propertyName)}`;
|
|
1731
|
+
if (refuseUnstorablePropertyName(
|
|
1732
|
+
propertyName,
|
|
1733
|
+
propertyPath,
|
|
1734
|
+
`${ownerType} "${ownerName}"`,
|
|
1735
|
+
issues
|
|
1736
|
+
)) {
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1088
1739
|
if (reserved.has(propertyName)) {
|
|
1089
1740
|
issues.push({
|
|
1090
1741
|
path: propertyPath,
|
|
@@ -1111,7 +1762,7 @@ function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict)
|
|
|
1111
1762
|
if (validated === void 0) continue;
|
|
1112
1763
|
result[propertyName] = validated;
|
|
1113
1764
|
}
|
|
1114
|
-
return result;
|
|
1765
|
+
return { ...result };
|
|
1115
1766
|
}
|
|
1116
1767
|
function validateProperty(raw, path, depth, issues, strict) {
|
|
1117
1768
|
if (!isPlainObject(raw)) {
|
|
@@ -1407,9 +2058,12 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1407
2058
|
});
|
|
1408
2059
|
return void 0;
|
|
1409
2060
|
}
|
|
1410
|
-
const fields =
|
|
2061
|
+
const fields = createDataKeyedBag();
|
|
1411
2062
|
for (const [name, value] of propertiesEntries) {
|
|
1412
2063
|
const fieldPath = `${path}/properties/${encodeJsonPointerSegment(name)}`;
|
|
2064
|
+
if (refuseUnstorablePropertyName(name, fieldPath, "a nested object", issues)) {
|
|
2065
|
+
continue;
|
|
2066
|
+
}
|
|
1413
2067
|
if (!isPlainObject(value)) {
|
|
1414
2068
|
issues.push({
|
|
1415
2069
|
path: fieldPath,
|
|
@@ -1435,7 +2089,7 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1435
2089
|
if (modifiers === void 0) return void 0;
|
|
1436
2090
|
return finalizeProperty(
|
|
1437
2091
|
"object",
|
|
1438
|
-
{ properties: fields },
|
|
2092
|
+
{ properties: { ...fields } },
|
|
1439
2093
|
modifiers
|
|
1440
2094
|
);
|
|
1441
2095
|
}
|
|
@@ -1641,7 +2295,7 @@ function validateUniqueConstraints(raw, path, properties, issues, strict) {
|
|
|
1641
2295
|
fieldsValid = false;
|
|
1642
2296
|
break;
|
|
1643
2297
|
}
|
|
1644
|
-
if (!(field
|
|
2298
|
+
if (!hasOwnKey(properties, field)) {
|
|
1645
2299
|
issues.push({
|
|
1646
2300
|
path: `${constraintPath}/fields/${fieldIndex}`,
|
|
1647
2301
|
message: `Unique constraint field "${field}" is not declared on this kind.`,
|
|
@@ -1723,7 +2377,7 @@ function validateUniqueWhere(raw, path, properties, issues, strict) {
|
|
|
1723
2377
|
});
|
|
1724
2378
|
return void 0;
|
|
1725
2379
|
}
|
|
1726
|
-
if (!(field
|
|
2380
|
+
if (!hasOwnKey(properties, field)) {
|
|
1727
2381
|
issues.push({
|
|
1728
2382
|
path: `${path}/field`,
|
|
1729
2383
|
message: `Unique \`where.field\` "${field}" is not declared on this kind.`,
|
|
@@ -1841,6 +2495,6 @@ function freezeDocument(input) {
|
|
|
1841
2495
|
);
|
|
1842
2496
|
}
|
|
1843
2497
|
|
|
1844
|
-
export { CURRENT_GRAPH_EXTENSION_VERSION, GRAPH_EXTENSION_ISSUE_CODES, GRAPH_EXTENSION_TOP_LEVEL_KEYS, GraphExtensionError, GraphExtensionUnresolvedEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, INCOMPATIBLE_CHANGE_TYPES, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, LEGACY_GRAPH_EXTENSION_VERSION, RemoveCompileTimeKindError, computeTransitiveClosure, err, invertClosure, isErr, isOk, isReachable, ok, unwrap, validateGraphExtension };
|
|
1845
|
-
//# sourceMappingURL=chunk-
|
|
1846
|
-
//# sourceMappingURL=chunk-
|
|
2498
|
+
export { CURRENT_GRAPH_EXTENSION_VERSION, GRAPH_EXTENSION_ISSUE_CODES, GRAPH_EXTENSION_TOP_LEVEL_KEYS, GraphExtensionError, GraphExtensionUnresolvedEndpointError, GraphExtensionUnresolvedOntologyEndpointError, GraphExtensionValidationError, GraphExtensionVersionUnsupportedError, INCOMPATIBLE_CHANGE_TYPES, IncompatibleChangeError, KindCollisionError, KindHasReferentsError, KindRegistry, LEGACY_GRAPH_EXTENSION_VERSION, RemoveCompileTimeKindError, computeClosuresFromNamedOntology, computeClosuresFromOntology, computeTransitiveClosure, createEmptyClosures, err, invertClosure, isErr, isExternalIri, isOk, isReachable, ok, unwrap, validateGraphExtension, validateOntologyRelations };
|
|
2499
|
+
//# sourceMappingURL=chunk-T4XNKYXB.js.map
|
|
2500
|
+
//# sourceMappingURL=chunk-T4XNKYXB.js.map
|