I have a graphDB instance running on a VPS and i want to get the list of Organisations with hasUnit relation. The following query executes fine on the SPARQL execution page:
PREFIX org: <http://www.w3.org/ns/org#>
SELECT (?s AS ?Organization) (COUNT(?o) AS ?Count)
WHERE{
?s org:hasUnit ?o .
} GROUP BY ?s
but when i try to get the results using the REST interface i get an error "MALFORMED QUERY: org.eclipse.rdf4j.query.parser.sparql.ast.VisitorException: QName 'org:hasUnit' uses an undefined prefix"
here is my request uri:
http://23.101.230.37:7200/repositories/CSIRO?query= SELECT (?s AS ?Organization) (COUNT(?o) AS ?Count) WHERE{
?s org:hasUnit ?o . } GROUP BY ?s
The following query executes fine though:
http://23.101.230.37:7200/repositories/CSIRO?query= SELECT (?s AS ?Organization) (COUNT(?o) AS ?Count) WHERE{
?s ?p ?o . } GROUP BY ?s
"QName 'org:hasUnit' uses an undefined prefix"? I find it very clear and helpful. But you're by far not the first one with missing prefix declarations in a SPARQL query. From my point of view, I'd always try to add all used prefixes to make a SPARQL self-contained such that you can run it in any environment without the need for pre-defined prefixes.