Skip to content

Commit

Permalink
fix: dont set _graphs = false
Browse files Browse the repository at this point in the history
  • Loading branch information
jeswr committed Sep 8, 2024
1 parent 78932b4 commit 37c7380
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/N3Store.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,8 +921,11 @@ export default class N3Store {
}
else if ((other instanceof N3Store) && this._entityIndex === other._entityIndex) {
const store = new N3Store({ entityIndex: this._entityIndex });
store._graphs = intersect(other._graphs, this._graphs);
store._size = null;
const graphs = intersect(other._graphs, this._graphs);
if (graphs) {
store._graphs = graphs;
store._size = null;
}
return store;
}

Expand Down
7 changes: 7 additions & 0 deletions test/N3Store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2145,6 +2145,13 @@ describe('Store', () => {
expect(s1.intersection(s2).equals(s2.intersection(s1)));
expect(s1.union(s2).intersection(s1).equals(s1));
expect(s1.intersection(s2).union(s1).equals(s1));
expect(new Store([...s1.union(s2).intersection(s1)]).equals(new Store([...s1])));
expect(new Store([...s1.intersection(s2).union(s1)]).equals(new Store([...s2])));

const newStore = s1.intersection(s2);
const size = newStore.size;
newStore.add(new Quad(new NamedNode('mys1'), new NamedNode('myp1'), new NamedNode('myo1')));
expect(newStore.size).toBe(size + 1);
}
}

Expand Down

0 comments on commit 37c7380

Please sign in to comment.