n3 1.23.1 → 1.23.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
@@ -1083,26 +1083,28 @@ class DatasetCoreAndReadableStream extends _readableStream.Readable {
1083
1083
  if (subject && !(subjectId = newStore._termToNumericId(subject)) || predicate && !(predicateId = newStore._termToNumericId(predicate)) || object && !(objectId = newStore._termToNumericId(object))) return newStore;
1084
1084
  const graphs = n3Store._getGraphs(graph);
1085
1085
  for (const graphKey in graphs) {
1086
- let subjects, predicates, objects;
1087
- if (!subjectId && predicateId) {
1088
- if (predicates = indexMatch(graphs[graphKey].predicates, [predicateId, objectId, subjectId])) {
1089
- subjects = indexMatch(graphs[graphKey].subjects, [subjectId, predicateId, objectId]);
1090
- objects = indexMatch(graphs[graphKey].objects, [objectId, subjectId, predicateId]);
1091
- }
1092
- } else if (objectId) {
1093
- if (objects = indexMatch(graphs[graphKey].objects, [objectId, subjectId, predicateId])) {
1094
- subjects = indexMatch(graphs[graphKey].subjects, [subjectId, predicateId, objectId]);
1095
- predicates = indexMatch(graphs[graphKey].predicates, [predicateId, objectId, subjectId]);
1086
+ let subjects, predicates, objects, content;
1087
+ if (content = graphs[graphKey]) {
1088
+ if (!subjectId && predicateId) {
1089
+ if (predicates = indexMatch(content.predicates, [predicateId, objectId, subjectId])) {
1090
+ subjects = indexMatch(content.subjects, [subjectId, predicateId, objectId]);
1091
+ objects = indexMatch(content.objects, [objectId, subjectId, predicateId]);
1092
+ }
1093
+ } else if (objectId) {
1094
+ if (objects = indexMatch(content.objects, [objectId, subjectId, predicateId])) {
1095
+ subjects = indexMatch(content.subjects, [subjectId, predicateId, objectId]);
1096
+ predicates = indexMatch(content.predicates, [predicateId, objectId, subjectId]);
1097
+ }
1098
+ } else if (subjects = indexMatch(content.subjects, [subjectId, predicateId, objectId])) {
1099
+ predicates = indexMatch(content.predicates, [predicateId, objectId, subjectId]);
1100
+ objects = indexMatch(content.objects, [objectId, subjectId, predicateId]);
1096
1101
  }
1097
- } else if (subjects = indexMatch(graphs[graphKey].subjects, [subjectId, predicateId, objectId])) {
1098
- predicates = indexMatch(graphs[graphKey].predicates, [predicateId, objectId, subjectId]);
1099
- objects = indexMatch(graphs[graphKey].objects, [objectId, subjectId, predicateId]);
1102
+ if (subjects) newStore._graphs[graphKey] = {
1103
+ subjects,
1104
+ predicates,
1105
+ objects
1106
+ };
1100
1107
  }
1101
- if (subjects) newStore._graphs[graphKey] = {
1102
- subjects,
1103
- predicates,
1104
- objects
1105
- };
1106
1108
  }
1107
1109
  newStore._size = null;
1108
1110
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "n3",
3
- "version": "1.23.1",
3
+ "version": "1.23.2",
4
4
  "description": "Lightning fast, asynchronous, streaming Turtle / N3 / RDF library.",
5
5
  "author": "Ruben Verborgh <ruben.verborgh@gmail.com>",
6
6
  "keywords": [
@@ -43,7 +43,7 @@
43
43
  "eslint-plugin-jest": "^28.8.3",
44
44
  "jest": "^29.7.0",
45
45
  "pre-commit": "^1.2.2",
46
- "rdf-isomorphic": "^1.3.1",
46
+ "rdf-isomorphic": "^2.0.0",
47
47
  "rdf-test-suite": "^1.25.0",
48
48
  "streamify-string": "^1.0.1",
49
49
  "uglify-js": "^3.14.3"
package/src/N3Store.js CHANGED
@@ -1134,27 +1134,28 @@ class DatasetCoreAndReadableStream extends Readable {
1134
1134
 
1135
1135
  const graphs = n3Store._getGraphs(graph);
1136
1136
  for (const graphKey in graphs) {
1137
- let subjects, predicates, objects;
1138
-
1139
- if (!subjectId && predicateId) {
1140
- if (predicates = indexMatch(graphs[graphKey].predicates, [predicateId, objectId, subjectId])) {
1141
- subjects = indexMatch(graphs[graphKey].subjects, [subjectId, predicateId, objectId]);
1142
- objects = indexMatch(graphs[graphKey].objects, [objectId, subjectId, predicateId]);
1137
+ let subjects, predicates, objects, content;
1138
+ if (content = graphs[graphKey]) {
1139
+ if (!subjectId && predicateId) {
1140
+ if (predicates = indexMatch(content.predicates, [predicateId, objectId, subjectId])) {
1141
+ subjects = indexMatch(content.subjects, [subjectId, predicateId, objectId]);
1142
+ objects = indexMatch(content.objects, [objectId, subjectId, predicateId]);
1143
+ }
1143
1144
  }
1144
- }
1145
- else if (objectId) {
1146
- if (objects = indexMatch(graphs[graphKey].objects, [objectId, subjectId, predicateId])) {
1147
- subjects = indexMatch(graphs[graphKey].subjects, [subjectId, predicateId, objectId]);
1148
- predicates = indexMatch(graphs[graphKey].predicates, [predicateId, objectId, subjectId]);
1145
+ else if (objectId) {
1146
+ if (objects = indexMatch(content.objects, [objectId, subjectId, predicateId])) {
1147
+ subjects = indexMatch(content.subjects, [subjectId, predicateId, objectId]);
1148
+ predicates = indexMatch(content.predicates, [predicateId, objectId, subjectId]);
1149
+ }
1150
+ }
1151
+ else if (subjects = indexMatch(content.subjects, [subjectId, predicateId, objectId])) {
1152
+ predicates = indexMatch(content.predicates, [predicateId, objectId, subjectId]);
1153
+ objects = indexMatch(content.objects, [objectId, subjectId, predicateId]);
1149
1154
  }
1150
- }
1151
- else if (subjects = indexMatch(graphs[graphKey].subjects, [subjectId, predicateId, objectId])) {
1152
- predicates = indexMatch(graphs[graphKey].predicates, [predicateId, objectId, subjectId]);
1153
- objects = indexMatch(graphs[graphKey].objects, [objectId, subjectId, predicateId]);
1154
- }
1155
1155
 
1156
- if (subjects)
1157
- newStore._graphs[graphKey] = { subjects, predicates, objects };
1156
+ if (subjects)
1157
+ newStore._graphs[graphKey] = { subjects, predicates, objects };
1158
+ }
1158
1159
  }
1159
1160
  newStore._size = null;
1160
1161
  }