Skip to content

Commit

Permalink
Merge pull request #1236 from lblod/fix/blank-node-no-subject
Browse files Browse the repository at this point in the history
Ignore instead of fail when rendering BlankNode with no subject
  • Loading branch information
abeforgit authored Dec 18, 2024
2 parents 70202f7 + 7895a2c commit e4772c6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/witty-moose-mate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lblod/ember-rdfa-editor': patch
---

If trying to render a BlankNode with no subject, ignore it instead of crashing
7 changes: 7 additions & 0 deletions addon/core/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,13 @@ export function renderInvisibleRdfa(
case 'BlankNode': {
// the triple refers to a URI which does not have a corresponding
// resource node
if (!isSome(nodeOrMark.attrs['subject'])) {
console.warn(
'Trying to render a BlankNode with no subject, ignoring',
nodeOrMark.attrs,
);
break;
}
const subject: string = unwrap(nodeOrMark.attrs['subject'] as string);
propElements.push(namedNodeSpan(subject, predicate, object.value));
break;
Expand Down

0 comments on commit e4772c6

Please sign in to comment.