Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Denys Smirnov <dennwc@pm.me>
Derek Liang <fr.derekliang@gmail.com>
Gaurav Tiwari <gaurav@gauravtiwari.co.uk>
Iddan Aaronsohn <mail@aniddan.com>
JSup <hanjisang0914@gmail.com>
Jay Graves <jaywgraves@gmail.com>
Jeremy Jay <jeremy@pbnjay.com>
Jørgen Teunis <cayley@jorgenteunis.com>
Expand Down
30 changes: 30 additions & 0 deletions query/path/pathtest/pathtest.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,21 @@ func testSet(qs graph.QuadStore) []test {
path.StartPath(qs, vAlice).Out(vFollows)),
expect: []quad.Value{vBob, vGreg},
},
{
message: "Or of overlapping branches keeps a value reachable via either branch",
path: path.StartPath(qs, vAlice).Out(vFollows).Or(
path.StartPath(qs, vDani).Out(vFollows)),
// Or is a union without deduplication: bob is reachable via both
// alice->follows and dani->follows, so it appears from each branch.
expect: []quad.Value{vBob, vBob, vGreg},
},
{
message: "Or preserves the Save tag of whichever branch produced the value",
path: path.StartPath(qs, vBob).Save(vStatus, "statustag").Or(
path.StartPath(qs, vDani).Save(vStatus, "statustag")),
tag: "statustag",
expect: []quad.Value{vCool, vCool},
},
{
message: "implicit All",
path: path.StartPath(qs),
Expand Down Expand Up @@ -437,6 +452,21 @@ func testSet(qs graph.QuadStore) []test {
tag: "statustag",
expect: []quad.Value{vCool, vCool},
},
{
message: "SaveOptional keeps unmatched starts with an empty tag",
path: path.StartPath(qs, vAlice, vBob, vFred).SaveOptional(vStatus, "statustag"),
tag: "statustag",
empty: true,
// alice and fred have no status quad, bob has "cool_person".
expect: []quad.Value{vEmpty, vEmpty, vCool},
},
{
message: "optional branch that never matches still returns every top-level node",
path: path.StartPath(qs, vAlice, vFred).Optional(path.StartMorphism().Save(vStatus, "statustag")),
tag: "statustag",
empty: true,
expect: []quad.Value{vEmpty, vEmpty},
},
{
message: "composite paths (clone paths)",
path: func() *path.Path {
Expand Down