0
votes

Aggregation SPARQL queries with MarkLogic return errors for me. For example this one taken from latest MarkLogic docs:

SELECT DISTINCT ?object (COUNT(?subject) AS ?count)
WHERE {
  ?subject <w3.org/1999/02/22-rdf-syntax-ns#type/>; ?object
}
ORDER BY DESC (?count)
LIMIT 10

That returns

SEM-SYNTAXERROR (err:FOER0000): XDMP-UNEXPECTED err:XPST0003 1.0-ml Unexpected token XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, function name unknown: "COUNT"false syntax error, function name unknown: "COUNT"18sem:sparql("SELECT (COUNT( ?PCD_01_Message ) as ?cnt) WHERE { ?PCD_01_Messag...", ()

This is a fragment from a REST call response. The developer guides mention nothing needed to include or declare in order to use the aggregation. The simple select queries work.

Any idea what is missing?

1
You need to post the code that generates the error. - Artemis
"Unexpected token syntax error, function name unknown: "COUNT"" sounds like there might be a syntax error,. What's the actual query? - Joshua Taylor
I get this error from any count query - to simplify the case, just copied the query from the the MarkLogic docs SELECT DISTINCT ?object (COUNT(?subject) AS ?count) WHERE { ?subject <w3.org/1999/02/22-rdf-syntax-ns#type> ?object } ORDER BY DESC (?count) LIMIT 10 - Jürgen Kerstna
same error when running from Query Console: [1.0-ml] XDMP-UNEXPECTED: (err:XPST0003) Unexpected token syntax error, function name unknown: "COUNT" So - is some module not enabled/loaded/configured? - Jürgen Kerstna

1 Answers

3
votes

What version of MarkLogic are you running? SPARQL 1.1 aggregates were not introduced until MarkLogic 8.