Skip to content

Conversation

@hoijnet
Copy link
Collaborator

@hoijnet hoijnet commented Dec 13, 2025

Adds client-side support for the new WOQL set operations implemented in TerminusDB.

New WOQL Methods

  • set_difference(list_a, list_b, result) - Compute elements in A but not in B
  • set_intersection(list_a, list_b, result) - Compute common elements
  • set_union(list_a, list_b, result) - Compute combined elements (deduplicated)
  • set_member(element, set) - Check membership in a set
  • list_to_set(list, set) - Convert list to sorted set with duplicates removed

Files Changed

  • terminusdb_client/woqlquery/woql_query.py - Added 5 new WOQL builder methods
  • terminusdb_client/tests/integration_tests/test_woql_set_operations.py - Integration tests
  • terminusdb_client/tests/integration_tests/conftest.py - Fixed local server detection
  • CONTRIBUTING.md - Added venv setup instructions for contributors
  • .gitignore - Added .venv/ directory

Usage Example

query = WOQLQuery().woql_and(
    WOQLQuery().eq("v:ListA", [1, 2, 3, 4]),
    WOQLQuery().eq("v:ListB", [2, 4]),
    WOQLQuery().set_difference("v:ListA", "v:ListB", "v:Diff")
)
# Result: Diff = [1, 3]

Testing

All 11 integration tests pass against the TerminusDB server with the corresponding set operations implementation.

@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

❌ Patch coverage is 90.47619% with 12 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.08%. Comparing base (8c781b0) to head (93986a7).
⚠️ Report is 51 commits behind head on main.

Files with missing lines Patch % Lines
terminusdb_client/woqlquery/woql_query.py 79.16% 10 Missing ⚠️
...ests/integration_tests/test_woql_set_operations.py 97.43% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #455      +/-   ##
==========================================
+ Coverage   77.14%   87.08%   +9.93%     
==========================================
  Files          66       82      +16     
  Lines        5911     8144    +2233     
==========================================
+ Hits         4560     7092    +2532     
+ Misses       1351     1052     -299     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@hoijnet hoijnet merged commit 9b4b9c1 into terminusdb:main Dec 14, 2025
17 of 26 checks passed
@hoijnet hoijnet deleted the issue/2284-set-operators branch December 14, 2025 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants