Skip to content

Commit ac8b0af

Browse files
committed
When saving a node, find existing matches by looking for correct node term type
1 parent c23c445 commit ac8b0af

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "shacl-tulip",
3-
"version": "0.0.5",
3+
"version": "0.0.6",
44
"type": "module",
55
"main": "./src/index.js",
66
"module": "./src/index.js",

src/classes/FormBase.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,11 +260,15 @@ export class FormBase {
260260
if (this.content[class_uri]) {
261261
// If we are in edit mode, the first step is to delete existing quads from graphData
262262
if (editMode) {
263-
RdfDS.data.graph.deleteMatches(namedNode(node_uri), null, null, null)
263+
var s = this._getRecordSubjectTerm(node_uri, this.content[class_uri][node_uri])
264+
if (s.termType === "NamedNode") {
265+
RdfDS.data.graph.deleteMatches(namedNode(node_uri), null, null, null)
266+
} else {
267+
RdfDS.data.graph.deleteMatches(blankNode(node_uri), null, null, null)
268+
}
264269
}
265270

266271
// Then we generate the quads
267-
268272
var quads = this.formNodeToQuads(class_uri, node_uri, shapesDS)
269273
// and add them to the dataset
270274
quads.forEach(quad => {

0 commit comments

Comments
 (0)