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(listA, listB, result) - Compute elements in A but not in B
  • set_intersection(listA, listB, result) - Compute common elements
  • set_union(listA, listB, 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

  • lib/query/woqlQuery.js - Added 5 new WOQL builder methods
  • integration_tests/woql_set_operations.test.ts - Integration tests

Usage Example

const query = WOQL.and(
  WOQL.eq("v:ListA", [1, 2, 3, 4]),
  WOQL.eq("v:ListB", [2, 4]),
  WOQL.set_difference("v:ListA", "v:ListB", "v:Diff")
);
// Result: Diff = [1, 3]

Testing

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

@coveralls
Copy link

Coverage Status

coverage: 58.679% (-0.2%) from 58.84%
when pulling 62f59cd on hoijnet:issue/2284-set-operators
into 7608547 on terminusdb:main.

@hoijnet hoijnet merged commit 5cba47b into terminusdb:main Dec 14, 2025
2 checks passed
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.

3 participants