Skip to content

Bnode rewriting does not work in VALUE blocks #7

@Aklakan

Description

@Aklakan

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions