@nicia-ai/typegraph 0.44.0 → 0.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 -43
- 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 -39
- 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 -44
- 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 -40
- 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-XMYJY7NI.js → chunk-2LG2XB2M.js} +3 -3
- package/dist/{chunk-XMYJY7NI.js.map → chunk-2LG2XB2M.js.map} +1 -1
- package/dist/{chunk-QGKILWGZ.cjs → chunk-2NA5DYLO.cjs} +4 -4
- package/dist/{chunk-QGKILWGZ.cjs.map → chunk-2NA5DYLO.cjs.map} +1 -1
- package/dist/{chunk-5MUSU4ZP.cjs → chunk-3DHZCOT7.cjs} +20 -20
- package/dist/chunk-3DHZCOT7.cjs.map +1 -0
- package/dist/{chunk-OVUUTCPJ.cjs → chunk-4UGOKMI5.cjs} +268 -150
- package/dist/chunk-4UGOKMI5.cjs.map +1 -0
- package/dist/{chunk-FRHHDHKH.js → chunk-5262ZMTR.js} +26 -5
- package/dist/chunk-5262ZMTR.js.map +1 -0
- package/dist/{chunk-HOIFFY4M.js → chunk-5763DULU.js} +248 -76
- package/dist/chunk-5763DULU.js.map +1 -0
- package/dist/{chunk-7G32LIQM.js → chunk-5UVRGXD3.js} +277 -7
- package/dist/chunk-5UVRGXD3.js.map +1 -0
- package/dist/{chunk-IIT5K7SK.cjs → chunk-62ZP23AW.cjs} +15 -15
- package/dist/{chunk-IIT5K7SK.cjs.map → chunk-62ZP23AW.cjs.map} +1 -1
- package/dist/{chunk-S4KQ5LV4.js → chunk-775A4ZMN.js} +40 -6
- package/dist/chunk-775A4ZMN.js.map +1 -0
- package/dist/{chunk-QYWINYEA.cjs → chunk-7BQXPCGN.cjs} +830 -170
- 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-7GT72YHH.cjs +1979 -0
- package/dist/chunk-7GT72YHH.cjs.map +1 -0
- package/dist/{chunk-SQRD2CYF.js → chunk-7VQXLT5O.js} +717 -76
- package/dist/chunk-7VQXLT5O.js.map +1 -0
- package/dist/{chunk-BCP7LLOY.js → chunk-7Z5OR7KO.js} +2706 -625
- package/dist/chunk-7Z5OR7KO.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-FMMIX6N4.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-PAW2XUZN.js → chunk-ASTI57H3.js} +3 -3
- package/dist/{chunk-PAW2XUZN.js.map → chunk-ASTI57H3.js.map} +1 -1
- package/dist/{chunk-FMGEZBAQ.js → chunk-BKCUOV7A.js} +27 -5
- package/dist/chunk-BKCUOV7A.js.map +1 -0
- package/dist/chunk-BSFJMMV3.cjs +268 -0
- package/dist/chunk-BSFJMMV3.cjs.map +1 -0
- package/dist/{chunk-63KCKSSH.js → chunk-C23WSN5E.js} +209 -24
- package/dist/chunk-C23WSN5E.js.map +1 -0
- package/dist/{chunk-JRP3VGHS.js → chunk-CBTIUB76.js} +3 -3
- package/dist/{chunk-JRP3VGHS.js.map → chunk-CBTIUB76.js.map} +1 -1
- package/dist/chunk-CNV4TXJG.js +58 -0
- package/dist/chunk-CNV4TXJG.js.map +1 -0
- package/dist/{chunk-QB6VMOJ2.cjs → chunk-CXBHOOIQ.cjs} +45 -10
- package/dist/chunk-CXBHOOIQ.cjs.map +1 -0
- package/dist/{chunk-46GDII45.js → chunk-DCQVHAYQ.js} +5 -5
- package/dist/{chunk-46GDII45.js.map → chunk-DCQVHAYQ.js.map} +1 -1
- package/dist/chunk-DLNROMQ7.js +306 -0
- package/dist/chunk-DLNROMQ7.js.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-BNUFUFAU.js → chunk-HFHTMECK.js} +7 -7
- package/dist/chunk-HFHTMECK.js.map +1 -0
- package/dist/{chunk-TFMVL4QH.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-JIVMTW7W.js +3393 -0
- package/dist/chunk-JIVMTW7W.js.map +1 -0
- package/dist/{chunk-2Y4IFKW7.js → chunk-JXA2ZP2Q.js} +6 -17
- 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-K5ELX2GT.js +248 -0
- package/dist/chunk-K5ELX2GT.js.map +1 -0
- package/dist/chunk-LBJKZXDE.cjs +257 -0
- package/dist/chunk-LBJKZXDE.cjs.map +1 -0
- package/dist/{chunk-FGO5JFVJ.cjs → chunk-M4BDU5RX.cjs} +12 -12
- package/dist/{chunk-FGO5JFVJ.cjs.map → chunk-M4BDU5RX.cjs.map} +1 -1
- package/dist/{chunk-MIJKEVV7.js → chunk-MSY7FSX4.js} +37 -4
- package/dist/chunk-MSY7FSX4.js.map +1 -0
- package/dist/{chunk-ST3LPB2V.cjs → chunk-MUK4BU7K.cjs} +788 -146
- package/dist/chunk-MUK4BU7K.cjs.map +1 -0
- package/dist/{chunk-MCHP7RHZ.cjs → chunk-MXJDTH5B.cjs} +64 -41
- package/dist/chunk-MXJDTH5B.cjs.map +1 -0
- package/dist/{chunk-2VLBGQBY.cjs → chunk-N3257XE6.cjs} +724 -577
- package/dist/chunk-N3257XE6.cjs.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-EE7N5XXQ.cjs → chunk-NK5Q7UNE.cjs} +10 -21
- package/dist/chunk-NK5Q7UNE.cjs.map +1 -0
- package/dist/{chunk-PHXITZE4.js → chunk-NMWDXFPH.js} +4 -4
- package/dist/{chunk-PHXITZE4.js.map → chunk-NMWDXFPH.js.map} +1 -1
- package/dist/{chunk-FSXTPBRN.js → chunk-NQ6BRJBE.js} +416 -850
- package/dist/chunk-NQ6BRJBE.js.map +1 -0
- package/dist/chunk-OH5E5KIO.js +2057 -0
- package/dist/chunk-OH5E5KIO.js.map +1 -0
- package/dist/chunk-ONU3HIED.cjs +2082 -0
- package/dist/chunk-ONU3HIED.cjs.map +1 -0
- package/dist/{chunk-STQ3BSED.cjs → chunk-PNN7RHVR.cjs} +66 -44
- package/dist/chunk-PNN7RHVR.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-ACSVZPK7.cjs → chunk-PWLJ77UV.cjs} +5 -3
- package/dist/chunk-PWLJ77UV.cjs.map +1 -0
- package/dist/chunk-Q7Q4WSLJ.cjs +328 -0
- package/dist/chunk-Q7Q4WSLJ.cjs.map +1 -0
- package/dist/{chunk-BEFM74L2.js → chunk-QLRESYPU.js} +637 -493
- package/dist/chunk-QLRESYPU.js.map +1 -0
- package/dist/{chunk-SBPC5IP3.js → chunk-QWX5YA3K.js} +784 -202
- package/dist/chunk-QWX5YA3K.js.map +1 -0
- package/dist/{chunk-TCRIQMBU.js → chunk-RJS7DECT.js} +8 -9
- package/dist/chunk-RJS7DECT.js.map +1 -0
- package/dist/{chunk-6JZUSDY2.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-IJTLXNGJ.js → chunk-T4XNKYXB.js} +780 -127
- package/dist/chunk-T4XNKYXB.js.map +1 -0
- package/dist/{chunk-PDGEXGS6.cjs → chunk-TQR4KBY2.cjs} +354 -182
- package/dist/chunk-TQR4KBY2.cjs.map +1 -0
- package/dist/chunk-TTAITEPJ.cjs +755 -0
- package/dist/chunk-TTAITEPJ.cjs.map +1 -0
- package/dist/{chunk-NN3QSOVS.cjs → chunk-U5SON7R2.cjs} +27 -27
- package/dist/{chunk-NN3QSOVS.cjs.map → chunk-U5SON7R2.cjs.map} +1 -1
- package/dist/{chunk-A2I2XO52.cjs → chunk-U63GDNRC.cjs} +32 -26
- package/dist/chunk-U63GDNRC.cjs.map +1 -0
- package/dist/{chunk-YNULOIR5.cjs → chunk-UDISNXDL.cjs} +64 -43
- package/dist/chunk-UDISNXDL.cjs.map +1 -0
- package/dist/{chunk-GWEDD3DH.js → chunk-UV3SN74I.js} +5 -5
- package/dist/{chunk-GWEDD3DH.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-EFELJVLA.js → chunk-VGTJPTIC.js} +28 -5
- package/dist/chunk-VGTJPTIC.js.map +1 -0
- package/dist/chunk-VQH4VAWD.cjs +12 -0
- package/dist/{chunk-EPTSMFH7.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-WEVQJ5LH.js +736 -0
- package/dist/chunk-WEVQJ5LH.js.map +1 -0
- package/dist/{chunk-3PRKZW6D.cjs → chunk-XBYVV3MP.cjs} +60 -5
- package/dist/chunk-XBYVV3MP.cjs.map +1 -0
- package/dist/{chunk-GFRGG2US.cjs → chunk-XCAGZAKP.cjs} +7 -7
- package/dist/{chunk-GFRGG2US.cjs.map → chunk-XCAGZAKP.cjs.map} +1 -1
- package/dist/{chunk-XR4YZFKW.cjs → chunk-XDF2UPEQ.cjs} +3864 -1783
- package/dist/chunk-XDF2UPEQ.cjs.map +1 -0
- package/dist/{chunk-7V2FGGI2.cjs → chunk-XMQSEJCF.cjs} +632 -1080
- package/dist/chunk-XMQSEJCF.cjs.map +1 -0
- package/dist/chunk-XNLIZYRZ.cjs +3432 -0
- package/dist/chunk-XNLIZYRZ.cjs.map +1 -0
- package/dist/{chunk-66UVLHQA.cjs → chunk-XNSI2FJO.cjs} +99 -100
- package/dist/chunk-XNSI2FJO.cjs.map +1 -0
- package/dist/chunk-XQSCL77R.cjs +60 -0
- package/dist/chunk-XQSCL77R.cjs.map +1 -0
- package/dist/{chunk-SVJ5GEXW.cjs → chunk-XUO3KQFO.cjs} +2 -2
- package/dist/chunk-XUO3KQFO.cjs.map +1 -0
- package/dist/{chunk-HJH3RMXG.cjs → chunk-YAAM3M2S.cjs} +10 -10
- package/dist/{chunk-HJH3RMXG.cjs.map → chunk-YAAM3M2S.cjs.map} +1 -1
- package/dist/{chunk-ATLN63JA.js → chunk-YBFHZUXX.js} +6 -6
- package/dist/{chunk-ATLN63JA.js.map → chunk-YBFHZUXX.js.map} +1 -1
- package/dist/{chunk-K3BUWSFR.js → chunk-YDFDBE6D.js} +119 -6
- package/dist/chunk-YDFDBE6D.js.map +1 -0
- package/dist/{chunk-OSZPLZIV.cjs → chunk-YVWGEQJE.cjs} +318 -132
- 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 -41
- package/dist/core/index.d.cts +4 -5
- package/dist/core/index.d.ts +4 -5
- package/dist/core/index.js +8 -9
- package/dist/{ddl-eWg7hx6R.d.cts → ddl-BJcOp4WZ.d.cts} +3 -3
- package/dist/{ddl-D5369kOY.d.ts → ddl-BXfGHbPN.d.ts} +3 -3
- package/dist/graph-extension/index.cjs +26 -23
- 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 -8
- package/dist/graph-merge/index.cjs +2459 -655
- 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 -468
- package/dist/graph-merge/index.js.map +1 -1
- package/dist/{index-By89Sezh.d.ts → index-BSHvKfok.d.ts} +221 -10
- package/dist/{index-DcQ3Sxs-.d.cts → index-DxaYCv8Y.d.cts} +221 -10
- package/dist/index.cjs +330 -269
- 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 -50
- 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 -50
- 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 -24
- package/dist/interchange/index.js.map +1 -1
- package/dist/{manager-B0KjKE93.d.ts → manager-CfZAimti.d.ts} +36 -5
- package/dist/{manager-Cn0NFIhN.d.cts → manager-HGk6E_HW.d.cts} +36 -5
- package/dist/{materialize-indexes-BD4V3svD.d.ts → materialize-indexes-6A7dWGtb.d.cts} +10 -2
- package/dist/{materialize-indexes-DVRhd5h4.d.cts → materialize-indexes-BMJP6Tms.d.ts} +10 -2
- package/dist/{postgres-DaEWvN4x.d.cts → postgres-DFYWENdR.d.cts} +1961 -439
- package/dist/{postgres-u0a0HN2D.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 -49
- package/dist/schema/index.d.cts +9 -16
- package/dist/schema/index.d.ts +9 -16
- package/dist/schema/index.js +23 -22
- package/dist/{searchable-CnYEancP.d.ts → searchable-9OQoPuRs.d.ts} +1 -2
- package/dist/{searchable-BT7j9_IK.d.cts → searchable-CIje5XYD.d.cts} +1 -2
- package/dist/{sqlite-BrMoSsI7.d.cts → sqlite-DerU5tc7.d.ts} +2029 -347
- package/dist/{sqlite-CHhZUyO5.d.ts → sqlite-DitnISa9.d.cts} +2029 -347
- package/dist/{store-view-Bvdku0Ht.d.ts → store-DawaWWjJ.d.ts} +3145 -2556
- package/dist/{store-view-w-md0nQ4.d.cts → store-RwTJx8LX.d.cts} +3145 -2556
- package/dist/{temporal-BCORwUau.d.cts → temporal-Bn-Fi8FJ.d.cts} +1 -1
- package/dist/{temporal--x9T8K4S.d.ts → temporal-BtM4UALv.d.ts} +1 -1
- package/dist/{types-6-WJmSD4.d.cts → types-CoIx8HX5.d.cts} +1 -1
- package/dist/{types-Cjvkj0jA.d.ts → types-HkveCCx0.d.cts} +866 -21
- package/dist/{types-Cjvkj0jA.d.cts → types-HkveCCx0.d.ts} +866 -21
- package/dist/{types-COODtTJU.d.ts → types-KFfk-8Ah.d.ts} +1 -1
- package/dist/{where-CUQmCR6d.d.cts → where--fk7_0kv.d.cts} +1 -1
- package/dist/{where-5xVawAwL.d.ts → where-ws5hf-Ov.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/chunk-2BIG7U6E.cjs +0 -83
- package/dist/chunk-2BIG7U6E.cjs.map +0 -1
- package/dist/chunk-2L54C2C2.js +0 -144
- package/dist/chunk-2L54C2C2.js.map +0 -1
- package/dist/chunk-2VLBGQBY.cjs.map +0 -1
- package/dist/chunk-2WDD2NO3.js +0 -59
- package/dist/chunk-2WDD2NO3.js.map +0 -1
- package/dist/chunk-2Y4IFKW7.js.map +0 -1
- package/dist/chunk-35S6P5ZU.js +0 -27
- package/dist/chunk-35S6P5ZU.js.map +0 -1
- package/dist/chunk-3PRKZW6D.cjs.map +0 -1
- package/dist/chunk-4MB3AQAQ.js.map +0 -1
- package/dist/chunk-4SZ6XPTG.cjs +0 -12
- package/dist/chunk-5MUSU4ZP.cjs.map +0 -1
- package/dist/chunk-63KCKSSH.js.map +0 -1
- package/dist/chunk-66UVLHQA.cjs.map +0 -1
- package/dist/chunk-6JZUSDY2.cjs.map +0 -1
- package/dist/chunk-764JHTLT.cjs +0 -15
- package/dist/chunk-764JHTLT.cjs.map +0 -1
- package/dist/chunk-7G32LIQM.js.map +0 -1
- package/dist/chunk-7V2FGGI2.cjs.map +0 -1
- package/dist/chunk-A2I2XO52.cjs.map +0 -1
- package/dist/chunk-A4PBRX4C.cjs +0 -100
- package/dist/chunk-A4PBRX4C.cjs.map +0 -1
- package/dist/chunk-ACSVZPK7.cjs.map +0 -1
- package/dist/chunk-ALFUGRYB.cjs +0 -1282
- package/dist/chunk-ALFUGRYB.cjs.map +0 -1
- package/dist/chunk-B75XRV3O.js +0 -125
- package/dist/chunk-B75XRV3O.js.map +0 -1
- package/dist/chunk-BCP7LLOY.js.map +0 -1
- package/dist/chunk-BEFM74L2.js.map +0 -1
- package/dist/chunk-BNUFUFAU.js.map +0 -1
- package/dist/chunk-C4F7VJ5D.cjs.map +0 -1
- package/dist/chunk-CPEL3YIR.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-EE7N5XXQ.cjs.map +0 -1
- package/dist/chunk-EFELJVLA.js.map +0 -1
- package/dist/chunk-EPTSMFH7.cjs +0 -12
- 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-FMGEZBAQ.js.map +0 -1
- package/dist/chunk-FMMIX6N4.js.map +0 -1
- package/dist/chunk-FRHHDHKH.js.map +0 -1
- package/dist/chunk-FSXTPBRN.js.map +0 -1
- package/dist/chunk-G6Q5UM7U.js.map +0 -1
- package/dist/chunk-GYA4JRP5.js.map +0 -1
- package/dist/chunk-HOHAJ2NR.cjs +0 -61
- package/dist/chunk-HOHAJ2NR.cjs.map +0 -1
- package/dist/chunk-HOIFFY4M.js.map +0 -1
- package/dist/chunk-IIMQJYAM.js +0 -81
- package/dist/chunk-IIMQJYAM.js.map +0 -1
- package/dist/chunk-IJTLXNGJ.js.map +0 -1
- package/dist/chunk-ITE4IXAK.js +0 -25
- package/dist/chunk-ITE4IXAK.js.map +0 -1
- package/dist/chunk-K3BUWSFR.js.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-MCHP7RHZ.cjs.map +0 -1
- package/dist/chunk-MIJKEVV7.js.map +0 -1
- package/dist/chunk-NCX65HBY.cjs +0 -1396
- package/dist/chunk-NCX65HBY.cjs.map +0 -1
- package/dist/chunk-OSZPLZIV.cjs.map +0 -1
- package/dist/chunk-OVUUTCPJ.cjs.map +0 -1
- package/dist/chunk-PDGEXGS6.cjs.map +0 -1
- package/dist/chunk-QB6VMOJ2.cjs.map +0 -1
- package/dist/chunk-QMQLUA66.js +0 -12
- package/dist/chunk-QMQLUA66.js.map +0 -1
- package/dist/chunk-QYWINYEA.cjs.map +0 -1
- package/dist/chunk-S4KQ5LV4.js.map +0 -1
- package/dist/chunk-SBPC5IP3.js.map +0 -1
- package/dist/chunk-SJDMVITW.cjs.map +0 -1
- package/dist/chunk-SNXVDZAJ.js.map +0 -1
- package/dist/chunk-SQRD2CYF.js.map +0 -1
- package/dist/chunk-ST3LPB2V.cjs.map +0 -1
- package/dist/chunk-STQ3BSED.cjs.map +0 -1
- package/dist/chunk-SVJ5GEXW.cjs.map +0 -1
- package/dist/chunk-TCRIQMBU.js.map +0 -1
- package/dist/chunk-TDXIBCGY.cjs.map +0 -1
- package/dist/chunk-TFMVL4QH.js.map +0 -1
- package/dist/chunk-TRF4EBJT.cjs +0 -30
- package/dist/chunk-TRF4EBJT.cjs.map +0 -1
- package/dist/chunk-TVLKA4AY.js +0 -94
- package/dist/chunk-TVLKA4AY.js.map +0 -1
- package/dist/chunk-UR7W5YQK.js.map +0 -1
- package/dist/chunk-VITTKBWF.js +0 -1263
- package/dist/chunk-VITTKBWF.js.map +0 -1
- package/dist/chunk-WBUFJ7BS.cjs +0 -131
- package/dist/chunk-WBUFJ7BS.cjs.map +0 -1
- package/dist/chunk-XR4YZFKW.cjs.map +0 -1
- package/dist/chunk-YNULOIR5.cjs.map +0 -1
- package/dist/chunk-ZDH3DX3C.cjs +0 -30
- package/dist/chunk-ZDH3DX3C.cjs.map +0 -1
- package/dist/chunk-ZTAJL4DT.cjs +0 -85
- package/dist/chunk-ZTAJL4DT.cjs.map +0 -1
- package/dist/define-graph-DVF-oN1i.d.cts +0 -173
- package/dist/define-graph-SvYXOl78.d.ts +0 -173
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { ALL_META_EDGE_NAMES } from './chunk-
|
|
2
|
-
import { assertJsonValue } from './chunk-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { encodeJsonPointerSegment } from './chunk-G6Q5UM7U.js';
|
|
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';
|
|
7
6
|
|
|
8
7
|
// src/ontology/closures.ts
|
|
9
8
|
function computeTransitiveClosure(relations) {
|
|
@@ -76,6 +75,7 @@ var GRAPH_EXTENSION_ISSUE_CODES = [
|
|
|
76
75
|
"ONTOLOGY_CYCLE",
|
|
77
76
|
"ONTOLOGY_SELF_LOOP",
|
|
78
77
|
"ONTOLOGY_DISJOINT_CONFLICT",
|
|
78
|
+
"ONTOLOGY_INVERSE_MULTIPLE_PARTNERS",
|
|
79
79
|
"DUPLICATE_ONTOLOGY_RELATION",
|
|
80
80
|
"INVALID_DOCUMENT_SHAPE",
|
|
81
81
|
"UNKNOWN_DOCUMENT_KEY",
|
|
@@ -196,6 +196,21 @@ var GraphExtensionUnresolvedEndpointError = class extends GraphExtensionError {
|
|
|
196
196
|
this.endpoint = endpoint;
|
|
197
197
|
}
|
|
198
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
|
+
};
|
|
199
214
|
var RemoveCompileTimeKindError = class extends GraphExtensionError {
|
|
200
215
|
code = "REMOVE_COMPILE_TIME_KIND";
|
|
201
216
|
kindName;
|
|
@@ -276,6 +291,723 @@ var GRAPH_EXTENSION_TOP_LEVEL_KEYS = [
|
|
|
276
291
|
"indexes"
|
|
277
292
|
];
|
|
278
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
|
+
|
|
279
1011
|
// src/graph-extension/validation.ts
|
|
280
1012
|
var META_EDGE_NAME_SET = new Set(ALL_META_EDGE_NAMES);
|
|
281
1013
|
var SUPPORTED_PROPERTY_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -412,7 +1144,7 @@ function validateGraphExtension(input, options = {}) {
|
|
|
412
1144
|
strict
|
|
413
1145
|
);
|
|
414
1146
|
if (ontology !== void 0) {
|
|
415
|
-
validateOntology(ontology,
|
|
1147
|
+
validateOntology(ontology, issues);
|
|
416
1148
|
}
|
|
417
1149
|
const indexes = validateIndexesSection(
|
|
418
1150
|
documentRecord["indexes"],
|
|
@@ -452,7 +1184,7 @@ function validateNodesSection(rawNodes, issues, strict) {
|
|
|
452
1184
|
});
|
|
453
1185
|
return void 0;
|
|
454
1186
|
}
|
|
455
|
-
const result =
|
|
1187
|
+
const result = createDataKeyedBag();
|
|
456
1188
|
const recorded = /* @__PURE__ */ new Set();
|
|
457
1189
|
for (const [kindName, rawNode] of Object.entries(rawNodes)) {
|
|
458
1190
|
const path = `/nodes/${encodeJsonPointerSegment(kindName)}`;
|
|
@@ -477,7 +1209,7 @@ function validateNodesSection(rawNodes, issues, strict) {
|
|
|
477
1209
|
result[kindName] = node;
|
|
478
1210
|
recorded.add(kindName);
|
|
479
1211
|
}
|
|
480
|
-
return result;
|
|
1212
|
+
return { ...result };
|
|
481
1213
|
}
|
|
482
1214
|
function validateNodeDocument(kindName, raw, path, issues, strict) {
|
|
483
1215
|
if (!isPlainObject(raw)) {
|
|
@@ -546,7 +1278,7 @@ function validateEdgesSection(rawEdges, issues, strict) {
|
|
|
546
1278
|
});
|
|
547
1279
|
return void 0;
|
|
548
1280
|
}
|
|
549
|
-
const result =
|
|
1281
|
+
const result = createDataKeyedBag();
|
|
550
1282
|
const recorded = /* @__PURE__ */ new Set();
|
|
551
1283
|
for (const [kindName, rawEdge] of Object.entries(rawEdges)) {
|
|
552
1284
|
const path = `/edges/${encodeJsonPointerSegment(kindName)}`;
|
|
@@ -571,7 +1303,7 @@ function validateEdgesSection(rawEdges, issues, strict) {
|
|
|
571
1303
|
result[kindName] = edge;
|
|
572
1304
|
recorded.add(kindName);
|
|
573
1305
|
}
|
|
574
|
-
return result;
|
|
1306
|
+
return { ...result };
|
|
575
1307
|
}
|
|
576
1308
|
function validateEdgeDocument(kindName, raw, path, issues, strict) {
|
|
577
1309
|
if (!isPlainObject(raw)) {
|
|
@@ -719,113 +1451,14 @@ function validateOntologySection(raw, issues, strict) {
|
|
|
719
1451
|
}
|
|
720
1452
|
return result;
|
|
721
1453
|
}
|
|
722
|
-
function validateOntology(ontology,
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
code: "ONTOLOGY_SELF_LOOP"
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
|
-
const key = `${relation.metaEdge}::${relation.from}->${relation.to}`;
|
|
734
|
-
if (seenKey.has(key)) {
|
|
735
|
-
issues.push({
|
|
736
|
-
path,
|
|
737
|
-
message: `Duplicate ontology relation "${relation.metaEdge}" (${relation.from} \u2192 ${relation.to}).`,
|
|
738
|
-
code: "DUPLICATE_ONTOLOGY_RELATION"
|
|
739
|
-
});
|
|
740
|
-
continue;
|
|
741
|
-
}
|
|
742
|
-
seenKey.add(key);
|
|
743
|
-
}
|
|
744
|
-
detectHierarchicalCycles(ontology, issues);
|
|
745
|
-
detectDisjointHierarchyContradictions(ontology, issues);
|
|
746
|
-
}
|
|
747
|
-
var STRICTLY_HIERARCHICAL = /* @__PURE__ */ new Set([
|
|
748
|
-
"subClassOf",
|
|
749
|
-
"broader",
|
|
750
|
-
"narrower",
|
|
751
|
-
"partOf",
|
|
752
|
-
"hasPart"
|
|
753
|
-
]);
|
|
754
|
-
function isStrictlyHierarchicalMetaEdge(name) {
|
|
755
|
-
return STRICTLY_HIERARCHICAL.has(name);
|
|
756
|
-
}
|
|
757
|
-
var HIERARCHICAL_NORMALIZATION = /* @__PURE__ */ new Map([
|
|
758
|
-
["subClassOf", { canonical: "subClassOf", flip: false }],
|
|
759
|
-
["broader", { canonical: "broader", flip: false }],
|
|
760
|
-
["narrower", { canonical: "broader", flip: true }],
|
|
761
|
-
["partOf", { canonical: "partOf", flip: false }],
|
|
762
|
-
["hasPart", { canonical: "partOf", flip: true }]
|
|
763
|
-
]);
|
|
764
|
-
function buildHierarchicalGroups(ontology, options) {
|
|
765
|
-
const groups = /* @__PURE__ */ new Map();
|
|
766
|
-
for (const [index, relation] of ontology.entries()) {
|
|
767
|
-
const normalization = HIERARCHICAL_NORMALIZATION.get(relation.metaEdge);
|
|
768
|
-
if (normalization === void 0) continue;
|
|
769
|
-
if (options.skipSelfLoops && relation.from === relation.to) continue;
|
|
770
|
-
const from = normalization.flip ? relation.to : relation.from;
|
|
771
|
-
const to = normalization.flip ? relation.from : relation.to;
|
|
772
|
-
const list = groups.get(normalization.canonical) ?? [];
|
|
773
|
-
list.push({ from, to, originalIndex: index });
|
|
774
|
-
groups.set(normalization.canonical, list);
|
|
775
|
-
}
|
|
776
|
-
return groups;
|
|
777
|
-
}
|
|
778
|
-
function detectHierarchicalCycles(ontology, issues) {
|
|
779
|
-
const groups = buildHierarchicalGroups(ontology, { skipSelfLoops: true });
|
|
780
|
-
for (const [name, edges] of groups) {
|
|
781
|
-
const closure = computeTransitiveClosure(
|
|
782
|
-
edges.map((edge) => [edge.from, edge.to])
|
|
783
|
-
);
|
|
784
|
-
const reportedNodes = /* @__PURE__ */ new Set();
|
|
785
|
-
for (const [from, reachable] of closure) {
|
|
786
|
-
if (!reachable.has(from) || reportedNodes.has(from)) continue;
|
|
787
|
-
reportedNodes.add(from);
|
|
788
|
-
const offendingEdge = edges.find((edge) => edge.from === from);
|
|
789
|
-
const path = offendingEdge === void 0 ? "/ontology" : `/ontology/${offendingEdge.originalIndex}`;
|
|
790
|
-
issues.push({
|
|
791
|
-
path,
|
|
792
|
-
message: `Cycle detected in "${name}" relations involving "${from}".`,
|
|
793
|
-
code: "ONTOLOGY_CYCLE"
|
|
794
|
-
});
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
}
|
|
798
|
-
function detectDisjointHierarchyContradictions(ontology, issues) {
|
|
799
|
-
const disjointPairs = /* @__PURE__ */ new Set();
|
|
800
|
-
const disjointPath = /* @__PURE__ */ new Map();
|
|
801
|
-
for (const [index, relation] of ontology.entries()) {
|
|
802
|
-
if (relation.metaEdge !== "disjointWith") continue;
|
|
803
|
-
disjointPairs.add(`${relation.from}|${relation.to}`);
|
|
804
|
-
disjointPairs.add(`${relation.to}|${relation.from}`);
|
|
805
|
-
disjointPath.set(`${relation.from}|${relation.to}`, `/ontology/${index}`);
|
|
806
|
-
disjointPath.set(`${relation.to}|${relation.from}`, `/ontology/${index}`);
|
|
807
|
-
}
|
|
808
|
-
if (disjointPairs.size === 0) return;
|
|
809
|
-
const groups = buildHierarchicalGroups(ontology, { skipSelfLoops: false });
|
|
810
|
-
const reported = /* @__PURE__ */ new Set();
|
|
811
|
-
for (const [name, edges] of groups) {
|
|
812
|
-
const closure = computeTransitiveClosure(
|
|
813
|
-
edges.map((edge) => [edge.from, edge.to])
|
|
814
|
-
);
|
|
815
|
-
for (const [from, reachable] of closure) {
|
|
816
|
-
for (const to of reachable) {
|
|
817
|
-
const pairKey = `${from}|${to}`;
|
|
818
|
-
if (!disjointPairs.has(pairKey)) continue;
|
|
819
|
-
if (reported.has(pairKey)) continue;
|
|
820
|
-
reported.add(pairKey);
|
|
821
|
-
issues.push({
|
|
822
|
-
path: disjointPath.get(pairKey) ?? "/ontology",
|
|
823
|
-
message: `Contradiction: "${from}" and "${to}" are declared disjointWith but also related by "${name}" (directly or transitively).`,
|
|
824
|
-
code: "ONTOLOGY_DISJOINT_CONFLICT"
|
|
825
|
-
});
|
|
826
|
-
}
|
|
827
|
-
}
|
|
828
|
-
}
|
|
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
|
+
);
|
|
829
1462
|
}
|
|
830
1463
|
var INDEX_SCOPE_VALUES = ["graphAndKind", "graph", "none"];
|
|
831
1464
|
var EDGE_INDEX_DIRECTION_VALUES = ["out", "in", "none"];
|
|
@@ -1073,6 +1706,15 @@ function validateGraphExtensionIndexWhere(raw, path, issues, strict) {
|
|
|
1073
1706
|
op: raw["op"]
|
|
1074
1707
|
});
|
|
1075
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
|
+
}
|
|
1076
1718
|
function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict) {
|
|
1077
1719
|
if (!isPlainObject(raw)) {
|
|
1078
1720
|
issues.push({
|
|
@@ -1083,9 +1725,17 @@ function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict)
|
|
|
1083
1725
|
return void 0;
|
|
1084
1726
|
}
|
|
1085
1727
|
const reserved = ownerType === "node" ? RESERVED_NODE_KEYS : RESERVED_EDGE_KEYS;
|
|
1086
|
-
const result =
|
|
1728
|
+
const result = createDataKeyedBag();
|
|
1087
1729
|
for (const [propertyName, propertyValue] of Object.entries(raw)) {
|
|
1088
1730
|
const propertyPath = `${path}/${encodeJsonPointerSegment(propertyName)}`;
|
|
1731
|
+
if (refuseUnstorablePropertyName(
|
|
1732
|
+
propertyName,
|
|
1733
|
+
propertyPath,
|
|
1734
|
+
`${ownerType} "${ownerName}"`,
|
|
1735
|
+
issues
|
|
1736
|
+
)) {
|
|
1737
|
+
continue;
|
|
1738
|
+
}
|
|
1089
1739
|
if (reserved.has(propertyName)) {
|
|
1090
1740
|
issues.push({
|
|
1091
1741
|
path: propertyPath,
|
|
@@ -1112,7 +1762,7 @@ function validatePropertiesMap(raw, path, ownerType, ownerName, issues, strict)
|
|
|
1112
1762
|
if (validated === void 0) continue;
|
|
1113
1763
|
result[propertyName] = validated;
|
|
1114
1764
|
}
|
|
1115
|
-
return result;
|
|
1765
|
+
return { ...result };
|
|
1116
1766
|
}
|
|
1117
1767
|
function validateProperty(raw, path, depth, issues, strict) {
|
|
1118
1768
|
if (!isPlainObject(raw)) {
|
|
@@ -1408,9 +2058,12 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1408
2058
|
});
|
|
1409
2059
|
return void 0;
|
|
1410
2060
|
}
|
|
1411
|
-
const fields =
|
|
2061
|
+
const fields = createDataKeyedBag();
|
|
1412
2062
|
for (const [name, value] of propertiesEntries) {
|
|
1413
2063
|
const fieldPath = `${path}/properties/${encodeJsonPointerSegment(name)}`;
|
|
2064
|
+
if (refuseUnstorablePropertyName(name, fieldPath, "a nested object", issues)) {
|
|
2065
|
+
continue;
|
|
2066
|
+
}
|
|
1414
2067
|
if (!isPlainObject(value)) {
|
|
1415
2068
|
issues.push({
|
|
1416
2069
|
path: fieldPath,
|
|
@@ -1436,7 +2089,7 @@ function validateObjectProperty(raw, path, depth, issues, strict) {
|
|
|
1436
2089
|
if (modifiers === void 0) return void 0;
|
|
1437
2090
|
return finalizeProperty(
|
|
1438
2091
|
"object",
|
|
1439
|
-
{ properties: fields },
|
|
2092
|
+
{ properties: { ...fields } },
|
|
1440
2093
|
modifiers
|
|
1441
2094
|
);
|
|
1442
2095
|
}
|
|
@@ -1642,7 +2295,7 @@ function validateUniqueConstraints(raw, path, properties, issues, strict) {
|
|
|
1642
2295
|
fieldsValid = false;
|
|
1643
2296
|
break;
|
|
1644
2297
|
}
|
|
1645
|
-
if (!(field
|
|
2298
|
+
if (!hasOwnKey(properties, field)) {
|
|
1646
2299
|
issues.push({
|
|
1647
2300
|
path: `${constraintPath}/fields/${fieldIndex}`,
|
|
1648
2301
|
message: `Unique constraint field "${field}" is not declared on this kind.`,
|
|
@@ -1724,7 +2377,7 @@ function validateUniqueWhere(raw, path, properties, issues, strict) {
|
|
|
1724
2377
|
});
|
|
1725
2378
|
return void 0;
|
|
1726
2379
|
}
|
|
1727
|
-
if (!(field
|
|
2380
|
+
if (!hasOwnKey(properties, field)) {
|
|
1728
2381
|
issues.push({
|
|
1729
2382
|
path: `${path}/field`,
|
|
1730
2383
|
message: `Unique \`where.field\` "${field}" is not declared on this kind.`,
|
|
@@ -1842,6 +2495,6 @@ function freezeDocument(input) {
|
|
|
1842
2495
|
);
|
|
1843
2496
|
}
|
|
1844
2497
|
|
|
1845
|
-
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 };
|
|
1846
|
-
//# sourceMappingURL=chunk-
|
|
1847
|
-
//# 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
|