Skip to content

Commit 1bdc0a8

Browse files
committed
Rebuilt
1 parent e169bca commit 1bdc0a8

2 files changed

Lines changed: 16 additions & 13 deletions

File tree

build/levelgraph-jsonld.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ function levelgraphJSONLD(db, jsonldOpts) {
154154

155155
return ['subject', 'predicate', 'object'].reduce(function(acc, key) {
156156
var node = triple[key];
157-
// mark blank nodes to skip deletion as per https://www.w3.org/TR/ldpatch/#Delete-statement
157+
console.log(node)
158+
// mark non stored blank nodes to skip deletion as per https://www.w3.org/TR/ldpatch/#Delete-statement
158159
// uses type field set to 'blank node' by jsonld.js toRDF()
159160
if (node.type === 'blank node') {
160161
if (!blanks[node.value]) {
161-
blanks[node.value] = '_:';
162+
blanks[node.value] = '_:b';
162163
}
163164
node.value = blanks[node.value];
164165
}
@@ -182,7 +183,7 @@ function levelgraphJSONLD(db, jsonldOpts) {
182183
}, {});
183184
}).forEach(function(triple) {
184185
// Skip marked blank nodes.
185-
if (triple.subject.indexOf('_:') !== 0 && triple.object.indexOf('_:') !== 0) {
186+
if (triple.subject.indexOf('_:b') !== 0 && triple.object.indexOf('_:b') !== 0) {
186187
stream.write(triple);
187188
}
188189
});
@@ -235,6 +236,8 @@ function levelgraphJSONLD(db, jsonldOpts) {
235236

236237
(function delAllTriples(iri, done) {
237238
graphdb.get({ subject: iri }, function(err, triples) {
239+
console.log("delAllTriples triples")
240+
console.log(triples)
238241
async.each(triples, function(triple, cb) {
239242
stream.write(triple);
240243
if (triple.object.indexOf('_:') === 0) {
@@ -338,7 +341,7 @@ function levelgraphJSONLD(db, jsonldOpts) {
338341
}
339342
acc[triple.subject][triple.predicate].push(expanded[triple.object]);
340343
} else {
341-
if (acc[triple.subject][triple.predicate]){
344+
if (Array.isArray(acc[triple.subject][triple.predicate])){
342345
acc[triple.subject][triple.predicate].push(object);
343346
} else {
344347
acc[triple.subject][triple.predicate] = [object];
@@ -347,7 +350,7 @@ function levelgraphJSONLD(db, jsonldOpts) {
347350
cb(err, acc);
348351
});
349352
}
350-
else if (acc[triple.subject][triple.predicate]){
353+
else if (Array.isArray(acc[triple.subject][triple.predicate])){
351354
acc[triple.subject][triple.predicate].push(object);
352355
cb(err, acc);
353356
} else {
@@ -359,7 +362,7 @@ function levelgraphJSONLD(db, jsonldOpts) {
359362
if (expanded !== null && !acc[triple.subject][triple.predicate]) {
360363
acc[triple.subject][triple.predicate] = expanded[triple.object];
361364
} else if (expanded !== null) {
362-
if (!acc[triple.subject][triple.predicate].push) {
365+
if (!Array.isArray(acc[triple.subject][triple.predicate])) {
363366
acc[triple.subject][triple.predicate] = [acc[triple.subject][triple.predicate]];
364367
}
365368
acc[triple.subject][triple.predicate].push(expanded[triple.object]);

0 commit comments

Comments
 (0)