Skip to content

Commit bc13fa1

Browse files
committed
Fix Blank Node handling
1 parent 0e0e9fe commit bc13fa1

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

meta_configurator/src/components/panels/rdf/rdf-authoring/RdfTripleDetailHelpDialog.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,21 @@
88
<div class="flex flex-col gap-3 text-sm">
99
<ul class="pl-4 list-disc leading-relaxed">
1010
<li>
11-
Choosing <code>Blank Node</code> for subject or object always creates a new internal blank
12-
node at root level on save.
11+
Choosing <code>Blank Node</code> for a new subject or object creates a new internal blank
12+
node on save.
13+
</li>
14+
<li>
15+
When you edit an existing triple that already references a blank node, the blank node id
16+
is preserved instead of creating a new one.
1317
</li>
1418
<li>
1519
Existing blank nodes are not listed in subject/object dropdowns. Those lists contain only
1620
named node IRIs.
1721
</li>
22+
<li>
23+
Tracking active selection between RDF View and Text View is currently not working for
24+
triples containing blank nodes.
25+
</li>
1826
<li>Blank nodes do not support IRI-based rename.</li>
1927
</ul>
2028
<Divider align="left" type="dashed">

meta_configurator/src/components/panels/rdf/tripleEditorService.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ function createNode(
9191
case RdfTermType.NamedNode:
9292
return $rdf.sym(value);
9393
case RdfTermType.BlankNode:
94-
return $rdf.blankNode();
94+
return $rdf.blankNode(normalizeBlankNodeId(value));
9595
case RdfTermType.Literal:
9696
return datatype
9797
? $rdf.literal(value, $rdf.sym(expandDatatype(datatype)))
@@ -100,3 +100,8 @@ function createNode(
100100
throw new Error(`Unknown term type: ${type}`);
101101
}
102102
}
103+
104+
function normalizeBlankNodeId(value: string): string | undefined {
105+
if (!value) return undefined;
106+
return value.startsWith('_:') ? value.slice(2) : value;
107+
}

0 commit comments

Comments
 (0)