1

I have a problem understanding simple SPARQL demo with GraphDB:

PREFIX rd: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX schem: <http://schema.org/ns#>
SELECT * 
WHERE {
        BIND(?mybind AS ?id)
        ?id rd:label ?label.
      { ?id a schem:TouristAttraction}
      }
ORDER BY ASC(?label) 

Do check it with GraphDB REST RDF4J API $<varname>

http://server01.local:7200/repositories/01?query=QUERY...&mybind=urn:uuid:0053083d-a9dc-45d4-9702-700633df563b

and

http://server01.local:7200/repositories/01?query=QUERY...

I get the same result. The bind didn't work.

What am I doing wrong?

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
mr_sol
  • 241
  • 1
  • 3
  • 7
  • the docs state that the binding prefix is a `$` symbol, I'd think you should consider this in your request, i.e. instead of `&mybind=` do `&$mybind=` . I mean, `$` is not `<$varname>` so the dollar symbol matters. At least that how I understand the syntax. I might be wrong though, Jeen Broekstra is likely to give the correct answer here soon – UninformedUser Apr 18 '20 at 03:19
  • Thanks for your support Unfortunately, it doesn't work Test URL with: ... & $ mybind = .. ... & mybind = .. in QUERY: BIND (? Mybind AS? Id) or BIND ($ mybind AS? Id) – mr_sol Apr 19 '20 at 08:15
  • Does your query return what you need in UI? I mean `BIND ( AS ?id)` etc. – Stanislav Kralin Apr 19 '20 at 19:59
  • yes with the BIND( AS ?id) does it work – mr_sol Apr 20 '20 at 09:12
  • The suggested method from UninformedUser works. Try `http://server01.local:7200/repositories/01?query=QUERY...&$mybind=urn:uuid:0053083d-a9dc-45d4-9702-700633df563b` – Sava Savov Apr 21 '20 at 12:11
  • Or your query should look like: `curl http://server01.local:7200/repositories/01 --data 'query=PREFIX rd: PREFIX schem: SELECT * WHERE { BIND(?mybind AS ?id) ?id rd:label ?label. { ?id a schem:TouristAttraction} } ORDER BY ASC(?label) &$mybind=urn:uuid:0053083d-a9dc-45d4-9702-700633df563b'` – Sava Savov Apr 21 '20 at 12:16
  • many many thanks for your support. I have the solution - the problem was <> http://server01.local:7200/repositories/01?query=PREFIX%20rd%3A%20%3Chttp%3A%2F%2Fwww.w3.org%2F2000%2F01%2Frdf-schema%23%3E%20PREFIX%20schem%3A%20%3Chttp%3A%2F%2Fschema.org%2Fns%23%3E%20SELECT%20*%20%20WHERE%20%7B%20%20%20%20%20%20%20%20%20BIND(%24mybind%20AS%20%3Fid)%20%20%20%20%20%20%20%20%20%3Fid%20rd%3Alabel%20%3Flabel.%20%20%20%20%20%20%20%7B%20%3Fid%20a%20schem%3ATouristAttraction%7D%20%20%20%20%20%20%20%7D%20ORDER%20BY%20ASC(%3Flabel)&%24mybind=%3Curn%3Auuid%3A6a8d8542-020f-478b-9413-783007c71fcc%3E – mr_sol Apr 27 '20 at 05:58

0 Answers0