You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "giacomoronconiobda (via GitHub)" <gi...@apache.org> on 2025/05/27 18:23:07 UTC
[I] Group By + Function support [jena]
giacomoronconiobda opened a new issue, #3227:
URL: https://github.com/apache/jena/issues/3227
### Version
3.13.1
### Question
Parsing the following query returns an exception. Is it a legal SPARQL query?
```sparql
PREFIX : <http://www.obdasystems.com/books/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT (year(?dateOfPublication) AS ?YEAR_dateOfPublication) (COUNT(DISTINCT ?Edition) AS ?count_Edition)
WHERE
{ ?Edition rdf:type :Edition ;
:dateOfPublication ?dateOfPublication
}
GROUP BY (year(?dateOfPublication) AS ?YEAR_dateOfPublication)
```
Here's the trace:
```
org.apache.jena.query.QueryParseException: Non-group key variable in SELECT: ?dateOfPublication in expression (year ?dateOfPublication)
at org.apache.jena.sparql.lang.SyntaxVarScope.checkExprVarUse(SyntaxVarScope.java:176)
at org.apache.jena.sparql.lang.SyntaxVarScope.check(SyntaxVarScope.java:121)
at org.apache.jena.sparql.lang.SyntaxVarScope.check(SyntaxVarScope.java:67)
at org.apache.jena.sparql.lang.SPARQLParser.validateParsedQuery(SPARQLParser.java:55)
at org.apache.jena.sparql.lang.SPARQLParser.parse(SPARQLParser.java:35)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Group By + Function support [jena]
Posted by "giacomoronconiobda (via GitHub)" <gi...@apache.org>.
giacomoronconiobda closed issue #3227: Group By + Function support
URL: https://github.com/apache/jena/issues/3227
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Group By + Function support [jena]
Posted by "giacomoronconiobda (via GitHub)" <gi...@apache.org>.
giacomoronconiobda commented on issue #3227:
URL: https://github.com/apache/jena/issues/3227#issuecomment-2915321555
Thank you very much!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org
Re: [I] Group By + Function support [jena]
Posted by "afs (via GitHub)" <gi...@apache.org>.
afs commented on issue #3227:
URL: https://github.com/apache/jena/issues/3227#issuecomment-2913917146
It is not legal. The query assigns to `?YEAR_dateOfPublication` in two different places.
All you need is
`SELECT ?YEAR_dateOfPublication COUNT(DISTINCT ?Edition) AS ?count_Edition)`
because the `GROUP BY ... AS ?YEAR_dateOfPublication` exposes the grouping variable.
> Version
> 3.13.1
That is quite old (2019-10). Upgrading would be a good idea.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org