n3 1.22.1 → 1.22.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/N3Store.js CHANGED
@@ -813,6 +813,7 @@ class N3Store {
813
813
  * Blank Nodes will be normalized.
814
814
  */
815
815
  addAll(quads) {
816
+ if (quads instanceof DatasetCoreAndReadableStream) quads = quads.filtered;
816
817
  if (Array.isArray(quads)) this.addQuads(quads);else if (quads instanceof N3Store && quads._entityIndex === this._entityIndex) {
817
818
  if (quads._size !== 0) {
818
819
  this._graphs = merge(this._graphs, quads._graphs);
@@ -831,6 +832,7 @@ class N3Store {
831
832
  * Blank Nodes will be normalized.
832
833
  */
833
834
  contains(other) {
835
+ if (other instanceof DatasetCoreAndReadableStream) other = other.filtered;
834
836
  if (other === this) return true;
835
837
  if (!(other instanceof N3Store) || this._entityIndex !== other._entityIndex) return other.every(quad => this.has(quad));
836
838
  const g1 = this._graphs,
@@ -870,6 +872,7 @@ class N3Store {
870
872
  * Returns a new dataset that contains all quads from the current dataset that are not included in the given dataset.
871
873
  */
872
874
  difference(other) {
875
+ if (other && other instanceof DatasetCoreAndReadableStream) other = other.filtered;
873
876
  if (other === this) return new N3Store({
874
877
  entityIndex: this._entityIndex
875
878
  });
@@ -893,6 +896,7 @@ class N3Store {
893
896
  * Blank Nodes will be normalized.
894
897
  */
895
898
  equals(other) {
899
+ if (other instanceof DatasetCoreAndReadableStream) other = other.filtered;
896
900
  return other === this || this.size === other.size && this.contains(other);
897
901
  }
898
902
 
@@ -913,6 +917,7 @@ class N3Store {
913
917
  * Returns a new dataset containing all quads from the current dataset that are also included in the given dataset.
914
918
  */
915
919
  intersection(other) {
920
+ if (other instanceof DatasetCoreAndReadableStream) other = other.filtered;
916
921
  if (other === this) {
917
922
  const store = new N3Store({
918
923
  entityIndex: this._entityIndex
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n3",
3
- "version": "1.22.1",
3
+ "version": "1.22.2",
4
4
  "description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",
5
5
  "author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
6
6
  "keywords": [
@@ -40,6 +40,7 @@
40
40
  "docco": "^0.9.1",
41
41
  "eslint": "^8.57.0",
42
42
  "eslint-plugin-import": "^2.29.1",
43
+ "eslint-plugin-jest": "^28.8.3",
43
44
  "jest": "^29.7.0",
44
45
  "pre-commit": "^1.2.2",
45
46
  "rdf-isomorphic": "^1.3.1",
package/src/N3Store.js CHANGED
@@ -861,6 +861,9 @@ export default class N3Store {
861
861
  * Blank Nodes will be normalized.
862
862
  */
863
863
  addAll(quads) {
864
+ if (quads instanceof DatasetCoreAndReadableStream)
865
+ quads = quads.filtered;
866
+
864
867
  if (Array.isArray(quads))
865
868
  this.addQuads(quads);
866
869
  else if (quads instanceof N3Store && quads._entityIndex === this._entityIndex) {
@@ -883,6 +886,9 @@ export default class N3Store {
883
886
  * Blank Nodes will be normalized.
884
887
  */
885
888
  contains(other) {
889
+ if (other instanceof DatasetCoreAndReadableStream)
890
+ other = other.filtered;
891
+
886
892
  if (other === this)
887
893
  return true;
888
894
 
@@ -927,6 +933,9 @@ export default class N3Store {
927
933
  * Returns a new dataset that contains all quads from the current dataset that are not included in the given dataset.
928
934
  */
929
935
  difference(other) {
936
+ if (other && other instanceof DatasetCoreAndReadableStream)
937
+ other = other.filtered;
938
+
930
939
  if (other === this)
931
940
  return new N3Store({ entityIndex: this._entityIndex });
932
941
 
@@ -949,6 +958,9 @@ export default class N3Store {
949
958
  * Blank Nodes will be normalized.
950
959
  */
951
960
  equals(other) {
961
+ if (other instanceof DatasetCoreAndReadableStream)
962
+ other = other.filtered;
963
+
952
964
  return other === this || (this.size === other.size && this.contains(other));
953
965
  }
954
966
 
@@ -969,6 +981,9 @@ export default class N3Store {
969
981
  * Returns a new dataset containing all quads from the current dataset that are also included in the given dataset.
970
982
  */
971
983
  intersection(other) {
984
+ if (other instanceof DatasetCoreAndReadableStream)
985
+ other = other.filtered;
986
+
972
987
  if (other === this) {
973
988
  const store = new N3Store({ entityIndex: this._entityIndex });
974
989
  store._graphs = merge(Object.create(null), this._graphs);