Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bnode rewriting does not work in VALUE blocks #7

Open
Aklakan opened this issue Aug 9, 2023 · 0 comments
Open

Bnode rewriting does not work in VALUE blocks #7

Aklakan opened this issue Aug 9, 2023 · 0 comments

Comments

@Aklakan
Copy link
Member

Aklakan commented Aug 9, 2023

ExprTransformVirtualBnodeUris correctly transforms

SELECT * { ?s ?p ?o FILTER(?s = <bnode://foo>) }

into

SELECT * { ?s ?p ?o FILTER(bnodeLabel(?s) = "foo") }

But when specifying a set of bnode IRIs as a VALUES block such as VALUES ?s { <bnode://foo> <bnode://bar> } then filter conditions are not updated and/or injected appropriately.

One solution using our custom bnode function would be to rename VALUE block variables which may be become bound to bnode IRIs and then add a subsequent BIND statement afterwards:

VALUES ?s { <bnode://foo> <bnode://bar> }

becomes

VALUES ?sRaw { <bnode://foo> <bnode://bar> }
BIND(if(strstarts(str(?s), 'bnode://'), norse:bnode.asGiven(extractLabel(?s), ?sRaw)  AS ?s)

The portable approach would be to still rename the variables of the VALUES blocks but then add appropriate FILTER statements to the graph patterns:

VALUES ?sRaw { ... }
?s ?p ?o
FILTER (toBnodeIri(?s) = ?sRaw)
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

No branches or pull requests

1 participant