Skip to content

Blank node replace fix#71

Merged
usebeforefree merged 4 commits intov8/developfrom
blank-node-replace-fix
May 19, 2025
Merged

Blank node replace fix#71
usebeforefree merged 4 commits intov8/developfrom
blank-node-replace-fix

Conversation

@usebeforefree
Copy link
Contributor

No description provided.

Comment on lines +160 to -179
# Create a single Dataset
g = Graph()
try:
g.parse(data=all_nquads, format="nt")
except RDFParserError:
raise UnsupportedJSON_LD(nquads_list)

# Get the triple and replace blank nodes
for s, p, o in g:
updated_quad = (
replace_blank_node(s),
replace_blank_node(p),
replace_blank_node(o),
)
# Format as N-Quad string
result.append(
f"{updated_quad[0].n3()} {updated_quad[1].n3()} {updated_quad[2].n3()} ."
)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember exactly why but there was a reason why we processed nquad by nquad and created a graph for each. This lib works differently than what we use in js. Did you thorougly test the new implementation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The implementation is not the same as in JavaScript. The last implementation had a bug in it, regarding the processing of the nquads one by one. It was tested with both error inducing JSON-LDs and valid ones.

@usebeforefree usebeforefree merged commit 051c03b into v8/develop May 19, 2025
1 check passed
@usebeforefree usebeforefree deleted the blank-node-replace-fix branch May 19, 2025 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants