Skip to content

Handling of SPARQL UNDEF in JSON responses #2694

@lu-pl

Description

@lu-pl

The SPARQL 1.2 Query Results JSON Format states in 3.2.1 "bindings":

The value of the "bindings" member is an array with zero or more elements, one element per query solution. Each query solution is a JSON object. 3.2.1 "select bindings"

Given a query like

select ?x where {values ?x {1 2 UNDEF}}

a Qlever SPARQL endpoint like e.g. https://qlever.dev/api/wikidata returns the following JSON content:

{
    "head": {
        "vars": [
            "x"
        ]
    },
    "results": {
        "bindings": [
            {
                "x": {
                    "datatype": "http://www.w3.org/2001/XMLSchema#int",
                    "type": "literal",
                    "value": "1"
                }
            },
            {
                "x": {
                    "datatype": "http://www.w3.org/2001/XMLSchema#int",
                    "type": "literal",
                    "value": "2"
                }
            },
            null
        ]
    },
    "meta": {
        "query-time-ms": 5,
        "result-size-total": 3
    }
}

I think that returning null for SPARQL UNDEF instead of {} can be considered a spec violation.

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