Skip to content

JSON SPARQL Query results contain incorrect datatype entries #22

@bnouwt

Description

@bnouwt

Hi,

the SPARQL results (see below) are unfortunately not accepted by LodView due to the datatype: "null" in entries with type: "uri". According to the JSON SPARQL results this datatype field is only allowed with type: "typed-literal".

These rogue datatype entries are caused by pydantic and the data models that are being defined in app.py.

For testing purposes I've disabled the pydantic transformation by returning a dict instead of SPARQLEndpointResult and this indeed returns the correct JSON. So, the result from the handle_query(...) method is correct, but is malformed by pydantic 👍

Regards, Barry

{
  "head": {
    "vars": [
      "s",
      "p",
      "o"
    ]
  },
  "results": {
    "bindings": [
      {
        "p": {
          "type": "uri",
          "value": "http://example.org/mainPersonsInvolved",
          "datatype": null
        },
        "o": {
          "type": "uri",
          "value": "https://tno.nl/Neil_Armstrong",
          "datatype": null
        }
      },
      {
        "p": {
          "type": "uri",
          "value": "http://example.org/hasOccurredAt",
          "datatype": null
        },
        "o": {
          "type": "literal",
          "value": "1969-07-20T20:05:00+00:00",
          "datatype": "http://www.w3.org/2001/XMLSchema#dateTime"
        }
      },
      {
        "p": {
          "type": "uri",
          "value": "http://example.org/hasNumberOfPeople",
          "datatype": null
        },
        "o": {
          "type": "literal",
          "value": "500",
          "datatype": "http://www.w3.org/2001/XMLSchema#integer"
        }
      }
    ]
  }
}
 

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