SolidLabResearch / generic-data-viewer-react-admin

MIT License
0 stars 1 forks source link

indirect variable breaks working static SPARQL query (Edit: templated query doesn't work when multiple replacements of variable are needed) #164

Closed bjdmeest closed 1 month ago

bjdmeest commented 1 month ago

Following query, using source https://work.de-meester.org/oslo.ttl, works:

SELECT ?sfrom ?pfrom ?pto ?oto ?class ?pclass ?pclassprop ?oclassprop
WHERE {
  {
  ?sfrom ?pfrom <https://data.vlaanderen.be/ns/persoon#GeregistreerdPersoon> .
  } UNION {
  <https://data.vlaanderen.be/ns/persoon#GeregistreerdPersoon> ?pto ?oto .
  } UNION {
  <https://data.vlaanderen.be/ns/persoon#GeregistreerdPersoon> <http://www.w3.org/2000/01/rdf-schema#subClassOf> ?class .
  ?pclass <http://www.w3.org/2000/01/rdf-schema#domain> ?class .
  ?pclass ?pclassprop ?oclassprop .
  }
}

However, it doesn't when using an indirect var using following query (to replace https://data.vlaanderen.be/ns/persoon#GeregistreerdPersoon):

SELECT DISTINCT ?class
WHERE {
  ?class <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://www.w3.org/2002/07/owl#Class> .
}

But it does work when using following static variable:

{
     "class": [
          "<https://data.vlaanderen.be/ns/persoon#GeregistreerdPersoon>"
     ]
}
mvanbrab commented 1 month ago

Shared query (provided you're running the viewer at http://localhost:5173): http://localhost:5173/#/customQuery?name=Ben%27s+templated+query&description=Ben%27s+templated+query&queryString=SELECT+%3Fsfrom+%3Fpfrom+%3Fpto+%3Foto+%3Fclass+%3Fpclass+%3Fpclassprop+%3Foclassprop%0AWHERE+%7B%0A++%7B%0A++++%3Fsfrom+%3Fpfrom+%24class+.%0A++%7D+UNION+%7B%0A++++%24class+%3Fpto+%3Foto+.%0A++%7D+UNION+%7B%0A++++%24class+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23subClassOf%3E+%3Fclass+.%0A++++%3Fpclass+%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23domain%3E+%3Fclass+.%0A++++%3Fpclass+%3Fpclassprop+%3Foclassprop+.%0A++%7D%0A%7D&source=https%3A%2F%2Fwork.de-meester.org%2Foslo.ttl&indirectVariablesCheck=on&indirectQuery1=SELECT+DISTINCT+%3Fclass%0AWHERE+%7B%0A++%3Fclass+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E+%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23Class%3E+.%0A%7D&indirectQueries=%5B%22SELECT+DISTINCT+%3Fclass%5CnWHERE+%7B%5Cn++%3Fclass+%3Chttp%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23type%3E+%3Chttp%3A%2F%2Fwww.w3.org%2F2002%2F07%2Fowl%23Class%3E+.%5Cn%7D%22%5D