n3 1.22.2 → 1.22.3
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/browser/n3.min.js +1 -1
- package/lib/N3Store.js +21 -9
- package/package.json +1 -1
- package/src/N3Store.js +22 -9
package/lib/N3Store.js
CHANGED
|
@@ -1077,20 +1077,32 @@ class DatasetCoreAndReadableStream extends _readableStream.Readable {
|
|
|
1077
1077
|
factory: n3Store._factory,
|
|
1078
1078
|
entityIndex: this.options.entityIndex
|
|
1079
1079
|
});
|
|
1080
|
-
const graphs = n3Store._getGraphs(graph);
|
|
1081
1080
|
let subjectId, predicateId, objectId;
|
|
1082
1081
|
|
|
1083
1082
|
// Translate IRIs to internal index keys.
|
|
1084
1083
|
if (subject && !(subjectId = newStore._termToNumericId(subject)) || predicate && !(predicateId = newStore._termToNumericId(predicate)) || object && !(objectId = newStore._termToNumericId(object))) return newStore;
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
objects
|
|
1092
|
-
}
|
|
1084
|
+
const graphs = n3Store._getGraphs(graph);
|
|
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]);
|
|
1096
|
+
}
|
|
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]);
|
|
1093
1100
|
}
|
|
1101
|
+
if (subjects) newStore._graphs[graphKey] = {
|
|
1102
|
+
subjects,
|
|
1103
|
+
predicates,
|
|
1104
|
+
objects
|
|
1105
|
+
};
|
|
1094
1106
|
}
|
|
1095
1107
|
newStore._size = null;
|
|
1096
1108
|
}
|
package/package.json
CHANGED
package/src/N3Store.js
CHANGED
|
@@ -1123,7 +1123,6 @@ class DatasetCoreAndReadableStream extends Readable {
|
|
|
1123
1123
|
if (!this._filtered) {
|
|
1124
1124
|
const { n3Store, graph, object, predicate, subject } = this;
|
|
1125
1125
|
const newStore = this._filtered = new N3Store({ factory: n3Store._factory, entityIndex: this.options.entityIndex });
|
|
1126
|
-
const graphs = n3Store._getGraphs(graph);
|
|
1127
1126
|
|
|
1128
1127
|
let subjectId, predicateId, objectId;
|
|
1129
1128
|
|
|
@@ -1133,15 +1132,29 @@ class DatasetCoreAndReadableStream extends Readable {
|
|
|
1133
1132
|
object && !(objectId = newStore._termToNumericId(object)))
|
|
1134
1133
|
return newStore;
|
|
1135
1134
|
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1135
|
+
const graphs = n3Store._getGraphs(graph);
|
|
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]);
|
|
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]);
|
|
1149
|
+
}
|
|
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
|
+
|
|
1156
|
+
if (subjects)
|
|
1157
|
+
newStore._graphs[graphKey] = { subjects, predicates, objects };
|
|
1145
1158
|
}
|
|
1146
1159
|
newStore._size = null;
|
|
1147
1160
|
}
|