Visitar URL original
Added `IF NOT EXISTS` to CREATE EDGE SQL command to skip creating the edge if already exists by lvca · Pull Request #147 · ArcadeData/arcadedb · GitHub
Skip to content

Added IF NOT EXISTS to CREATE EDGE SQL command to skip creating the edge if already exists - #147

Merged
lvca merged 7 commits into
mainfrom
unique-index-edges
Oct 18, 2021
Merged

lvca merged 7 commits into
mainfrom
unique-index-edges

Conversation

@lvca

@lvca lvca commented Oct 18, 2021

Copy link
Copy Markdown
Member

The check is made by direction + edge type.

Related issues
#144

…lready exists

The check is made by direction + edge type.
@lvca
lvca requested a review from antarcticgiraffe October 18, 2021 18:55
@lvca lvca self-assigned this Oct 18, 2021
@lvca lvca added the enhancement New feature or request label Oct 18, 2021
@lvca lvca added this to the 21.10.2 milestone Oct 18, 2021
@lvca lvca changed the title Create Edge SQL: added IF NOT EXISTS to skip creating the edge if already exists Added IF NOT EXISTS to CREATE EDGE SQL command to skip creating the edge if already exists Oct 18, 2021
@lvca
lvca merged commit f14012d into main Oct 18, 2021
@lvca
lvca deleted the unique-index-edges branch October 18, 2021 22:48
@lvca lvca linked an issue Oct 18, 2021 that may be closed by this pull request
mergify Bot added a commit that referenced this pull request Oct 12, 2025
…n /studio [skip ci]

Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.0.6 to 3.1.0.
Release notes

*Sourced from [fast-uri's releases](https://github.com/fastify/fast-uri/releases).*

> v3.1.0
> ------
>
> What's Changed
> --------------
>
> * ci: remove master branch support by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#126](https://redirect.github.com/fastify/fast-uri/pull/126)
> * chore(test) remove .gitkeep by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#128](https://redirect.github.com/fastify/fast-uri/pull/128)
> * ci(ci): set job permissions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#129](https://redirect.github.com/fastify/fast-uri/pull/129)
> * ci: set permissions at workflow level by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#131](https://redirect.github.com/fastify/fast-uri/pull/131)
> * ci: set workflow permissions to read-only by default by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#132](https://redirect.github.com/fastify/fast-uri/pull/132)
> * ci(ci): restore job level permissions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#133](https://redirect.github.com/fastify/fast-uri/pull/133)
> * build(deps-dev): bump tsd from 0.31.2 to 0.32.0 by [`@​dependabot`](https://github.com/dependabot)[bot] in [fastify/fast-uri#134](https://redirect.github.com/fastify/fast-uri/pull/134)
> * ci(ci): pin actions to commit-hash by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#135](https://redirect.github.com/fastify/fast-uri/pull/135)
> * ci: add node 24 to test matrix by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#136](https://redirect.github.com/fastify/fast-uri/pull/136)
> * ci: use tags for immutable github actions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#137](https://redirect.github.com/fastify/fast-uri/pull/137)
> * chore(license): update date ranges; standardise style by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#138](https://redirect.github.com/fastify/fast-uri/pull/138)
> * fix(lib/utils): simpler algorithm for removeDotSegments by [`@​wooffie`](https://github.com/wooffie) in [fastify/fast-uri#140](https://redirect.github.com/fastify/fast-uri/pull/140)
> * chore: remove uri-js by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#142](https://redirect.github.com/fastify/fast-uri/pull/142)
> * chore: replace benchmark with tinybench by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#143](https://redirect.github.com/fastify/fast-uri/pull/143)
> * fix: ipv4 is never normalized by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#144](https://redirect.github.com/fastify/fast-uri/pull/144)
> * feat: add browser testing by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#146](https://redirect.github.com/fastify/fast-uri/pull/146)
> * Update README.md by [`@​zekth`](https://github.com/zekth) in [fastify/fast-uri#145](https://redirect.github.com/fastify/fast-uri/pull/145)
> * chore: use jsdoc for static code analysis by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#147](https://redirect.github.com/fastify/fast-uri/pull/147)
> * fix(lib/schemes/urn): check nid for undefined by [`@​wooffie`](https://github.com/wooffie) in [fastify/fast-uri#141](https://redirect.github.com/fastify/fast-uri/pull/141)
>
> New Contributors
> ----------------
>
> * [`@​wooffie`](https://github.com/wooffie) made their first contribution in [fastify/fast-uri#140](https://redirect.github.com/fastify/fast-uri/pull/140)
>
> **Full Changelog**: <fastify/fast-uri@v3.0.6...v3.1.0>


Commits

* [`2d08e68`](fastify/fast-uri@2d08e68) v3.1.0
* [`4f8cdd1`](fastify/fast-uri@4f8cdd1) fix(lib/schemes/urn): check nid for undefined ([#141](https://redirect.github.com/fastify/fast-uri/issues/141))
* [`eedf840`](fastify/fast-uri@eedf840) chore: use jsdoc for static code analysis ([#147](https://redirect.github.com/fastify/fast-uri/issues/147))
* [`fbf4545`](fastify/fast-uri@fbf4545) Update README.md ([#145](https://redirect.github.com/fastify/fast-uri/issues/145))
* [`56b0c74`](fastify/fast-uri@56b0c74) feat: add browser testing ([#146](https://redirect.github.com/fastify/fast-uri/issues/146))
* [`ee22a06`](fastify/fast-uri@ee22a06) fix: ipv4 is never normalized ([#144](https://redirect.github.com/fastify/fast-uri/issues/144))
* [`509dd94`](fastify/fast-uri@509dd94) chore: replace benchmark with tinybench ([#143](https://redirect.github.com/fastify/fast-uri/issues/143))
* [`7a16582`](fastify/fast-uri@7a16582) chore: remove uri-js ([#142](https://redirect.github.com/fastify/fast-uri/issues/142))
* [`f0160b0`](fastify/fast-uri@f0160b0) fix(lib/utils): simpler algorithm for removeDotSegments ([#140](https://redirect.github.com/fastify/fast-uri/issues/140))
* [`14d12da`](fastify/fast-uri@14d12da) chore(license): update date ranges; standardise style ([#138](https://redirect.github.com/fastify/fast-uri/issues/138))
* Additional commits viewable in [compare view](fastify/fast-uri@v3.0.6...v3.1.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=fast-uri&package-manager=npm\_and\_yarn&previous-version=3.0.6&new-version=3.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
You can trigger a rebase of this PR by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
> \*\*Note\*\*
> Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
tae898 referenced this pull request in humemai/arcadedb-embedded-python Jun 28, 2026
… edge if already exists (#147)

* Create Edge SQL: added `IF NOT EXISTS` to skip creating the edge if already exists

The check is made by direction + edge type.

* Minor: updated test case to use SQL to create type and unique index on edge

* Fixed NPE

* New RemoteDatabase.transaction()

* Fixed tests failing randomly with remote transaction

* Fixed failing test case
tae898 referenced this pull request in humemai/arcadedb-embedded-python Jun 28, 2026
…n /studio [skip ci]

Bumps [fast-uri](https://github.com/fastify/fast-uri) from 3.0.6 to 3.1.0.
Release notes

*Sourced from [fast-uri's releases](https://github.com/fastify/fast-uri/releases).*

> v3.1.0
> ------
>
> What's Changed
> --------------
>
> * ci: remove master branch support by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#126](https://redirect.github.com/fastify/fast-uri/pull/126)
> * chore(test) remove .gitkeep by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#128](https://redirect.github.com/fastify/fast-uri/pull/128)
> * ci(ci): set job permissions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#129](https://redirect.github.com/fastify/fast-uri/pull/129)
> * ci: set permissions at workflow level by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#131](https://redirect.github.com/fastify/fast-uri/pull/131)
> * ci: set workflow permissions to read-only by default by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#132](https://redirect.github.com/fastify/fast-uri/pull/132)
> * ci(ci): restore job level permissions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#133](https://redirect.github.com/fastify/fast-uri/pull/133)
> * build(deps-dev): bump tsd from 0.31.2 to 0.32.0 by [`@​dependabot`](https://github.com/dependabot)[bot] in [fastify/fast-uri#134](https://redirect.github.com/fastify/fast-uri/pull/134)
> * ci(ci): pin actions to commit-hash by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#135](https://redirect.github.com/fastify/fast-uri/pull/135)
> * ci: add node 24 to test matrix by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#136](https://redirect.github.com/fastify/fast-uri/pull/136)
> * ci: use tags for immutable github actions by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#137](https://redirect.github.com/fastify/fast-uri/pull/137)
> * chore(license): update date ranges; standardise style by [`@​Fdawgs`](https://github.com/Fdawgs) in [fastify/fast-uri#138](https://redirect.github.com/fastify/fast-uri/pull/138)
> * fix(lib/utils): simpler algorithm for removeDotSegments by [`@​wooffie`](https://github.com/wooffie) in [fastify/fast-uri#140](https://redirect.github.com/fastify/fast-uri/pull/140)
> * chore: remove uri-js by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#142](https://redirect.github.com/fastify/fast-uri/pull/142)
> * chore: replace benchmark with tinybench by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#143](https://redirect.github.com/fastify/fast-uri/pull/143)
> * fix: ipv4 is never normalized by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#144](https://redirect.github.com/fastify/fast-uri/pull/144)
> * feat: add browser testing by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#146](https://redirect.github.com/fastify/fast-uri/pull/146)
> * Update README.md by [`@​zekth`](https://github.com/zekth) in [fastify/fast-uri#145](https://redirect.github.com/fastify/fast-uri/pull/145)
> * chore: use jsdoc for static code analysis by [`@​Uzlopak`](https://github.com/Uzlopak) in [fastify/fast-uri#147](https://redirect.github.com/fastify/fast-uri/pull/147)
> * fix(lib/schemes/urn): check nid for undefined by [`@​wooffie`](https://github.com/wooffie) in [fastify/fast-uri#141](https://redirect.github.com/fastify/fast-uri/pull/141)
>
> New Contributors
> ----------------
>
> * [`@​wooffie`](https://github.com/wooffie) made their first contribution in [fastify/fast-uri#140](https://redirect.github.com/fastify/fast-uri/pull/140)
>
> **Full Changelog**: <fastify/fast-uri@v3.0.6...v3.1.0>


Commits

* [`2d08e68`](fastify/fast-uri@2d08e68) v3.1.0
* [`4f8cdd1`](fastify/fast-uri@4f8cdd1) fix(lib/schemes/urn): check nid for undefined ([#141](https://redirect.github.com/fastify/fast-uri/issues/141))
* [`eedf840`](fastify/fast-uri@eedf840) chore: use jsdoc for static code analysis ([#147](https://redirect.github.com/fastify/fast-uri/issues/147))
* [`fbf4545`](fastify/fast-uri@fbf4545) Update README.md ([#145](https://redirect.github.com/fastify/fast-uri/issues/145))
* [`56b0c74`](fastify/fast-uri@56b0c74) feat: add browser testing ([#146](https://redirect.github.com/fastify/fast-uri/issues/146))
* [`ee22a06`](fastify/fast-uri@ee22a06) fix: ipv4 is never normalized ([#144](https://redirect.github.com/fastify/fast-uri/issues/144))
* [`509dd94`](fastify/fast-uri@509dd94) chore: replace benchmark with tinybench ([#143](https://redirect.github.com/fastify/fast-uri/issues/143))
* [`7a16582`](fastify/fast-uri@7a16582) chore: remove uri-js ([#142](https://redirect.github.com/fastify/fast-uri/issues/142))
* [`f0160b0`](fastify/fast-uri@f0160b0) fix(lib/utils): simpler algorithm for removeDotSegments ([#140](https://redirect.github.com/fastify/fast-uri/issues/140))
* [`14d12da`](fastify/fast-uri@14d12da) chore(license): update date ranges; standardise style ([#138](https://redirect.github.com/fastify/fast-uri/issues/138))
* Additional commits viewable in [compare view](fastify/fast-uri@v3.0.6...v3.1.0)
  
[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility\_score?dependency-name=fast-uri&package-manager=npm\_and\_yarn&previous-version=3.0.6&new-version=3.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
You can trigger a rebase of this PR by commenting `@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
Dependabot commands and options
  
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot show  ignore conditions` will show all of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
> \*\*Note\*\*
> Automatic rebases have been disabled on this pull request as it has been open for over 30 days.
tae898 referenced this pull request in humemai/arcadedb-embedded-python Aug 14, 2026
Three stacked defects meant the E2 lane's headline output was a restatement
of which backend was running, not a measurement.

1. torn_state was a tautology. It branched on isinstance(state, dict) --
   the PYTHON TYPE of the result -- so every single-engine backend was
   stamped atomic by construction and the composed stack torn by
   construction. Nothing was ever compared.

2. SurrealDB's writes never landed. build() passed {"id": f"product:{i}"}
   to insert("product", ...), but that string is the RECORD-ID PART, so the
   stored id was product:product:i. Every later `UPDATE product:{p}` and
   `RELATE product:{a}->related->product:{b}` addressed a record that does
   not exist. Silently: this client returns per-statement errors inside the
   result payload rather than raising, and no q() result was checked.
   Verified: `SELECT id FROM product:1` -> NOT FOUND; integer ids work.

3. The composed stack's evidence was two incommensurable metrics.
   neo4j_view_sum is a SUM of counters; qdrant_bumped_points was a COUNT of
   points carrying a boolean flag. A product touched by two ops adds 2 to
   the sum and 1 to the count, so the two sides diverged with no crash and
   no tearing at all. The published 306 vs 299 could never have evidenced
   tornness.

Together these turned "we wrote nothing and checked nothing" into a green
bar. The artifact showed arcadedb=300 and surrealdb=0 for an identical
deterministic workload, which should itself have been the alarm.

FIXES
 - integer record ids, so SurrealDB writes address real records
 - total_views() raises on an empty read instead of returning 0; a broken
   read must not be indistinguishable from an empty database
 - qdrant mirrors the actual counter, so both stores hold the SAME quantity
   and "disagreeing_products" is a real comparison with a zero baseline
 - torn_state is computed: post != pre for unified engines, new divergence
   for the composed stack
 - a validity guard aborts the arm when the clean ops moved nothing, which
   is what would have caught this on day one
 - trials raised from 1/rep to 40/rep (E2_TRIALS). Rule of three: 5 trials
   with 0 failures only bounds the failure rate below ~45%, far too weak to
   carry an atomicity claim

FAIRNESS: the counter mirror costs an extra neo4j read, so it is enabled
only for the atomicity trial. The timed latency path keeps the cheap batched
write it always had -- adding a round-trip to the rival's operation would
flatter us.

VERIFIED locally (2000 products, 5 trials, functional check only; all
reported numbers still come from mini):
  arcadedb_e2   torn 0/5, post_crash_state 449
  surrealdb_e2  torn 0/5, post_crash_state 449   (was 0 -- writes now land)
  composed      torn 5/5, disagreement 0 before the first injection then
                +6 per injection, neo4j advancing while qdrant stays flat

Both unified engines converging on exactly 449 under the same seeded
workload is the cross-check the old harness could not perform.

Paper claims affected, all re-measured on mini before they are restated:
the abstract's "3.8x faster than SurrealDB" (measured against an engine that
was not doing the writes), "rolled back cleanly in 5 of 5", and F7's
"5/5 crashes" label, which reads as a failure count on the bars where it
means a pass. Refs #147.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01E2Ytwsz6uQvs1dBoqGBSrV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Need some way preventing duplicate edges on the same pair of vertex.

1 participant