TriplyDB / Yasgui

Yet Another Sparql GUI
https://yasgui.triply.cc
MIT License
185 stars 55 forks source link

YASR showing values in wrong order for table headers #178

Closed shawnhind closed 3 years ago

shawnhind commented 3 years ago
{
  "head": {
    "vars": [
      "a",
      "b"
    ]
  },
  "results": {
    "bindings": [
      {
        "b": {
          "type": "literal",
          "value": "B Value"
        },
        "a": {
          "type": "literal",
          "value": "A Value"
        }
      },
      ]
   }
}

This ends up displaying in a table with the values backwards because it seems to rely on the bindings coming back in the same order as the list of vars.

Like this:

a b
B value A Value
shawnhind commented 3 years ago

Not 100% sure but it seems like this bug was introduced in the getRow modifications in https://github.com/TriplyDB/Yasgui/commit/02bb19bd0b4bde4c7822cf8e1b8991bd51331bb6

Previously it seems to have matched up the binding with the variable from the vars list but now it just does them in order without matching them up.

LaurensRietveld commented 3 years ago

Thanks for reporting and investigating 👍 . We'll publish a fix soon

shawnhind commented 3 years ago

Just one more piece to help with replicating if needed:

This can be replicated on the demo site https://yasgui.triply.cc/

Using a simple query:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?obj ?sub ?pred WHERE {
  ?sub ?pred ?obj .
} LIMIT 10

Note that the columns end up in the order that I put what I'm selecting in (?obj ?sub ?pred). You'll see the value for obj shows up in the pred column, the value for sub shows up in the obj column and the value for pred shows up in the sub column.

Only ~works~ breaks with the wikidata endpoint. The dbpedia endpoint returns the bindings in sorted order.

LaurensRietveld commented 3 years ago

This is fixed in the latest release of Yasgui and Yasr