Skip to content

Commit

Permalink
[Fix] Fix projection of count variable from SOQL query.
Browse files Browse the repository at this point in the history
  • Loading branch information
ledsoft committed Jul 20, 2023
1 parent 9272045 commit b2a5df4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Expand Up @@ -168,7 +168,7 @@ public void enterCount(SoqlParser.CountContext ctx) {

@Override
public void exitCount(SoqlParser.CountContext ctx) {
this.projectedVariable = ctx.getChild(1).getText();
this.projectedVariable = ctx.getChild(2).getText();
}

@Override
Expand Down
Expand Up @@ -748,4 +748,11 @@ void parseQuerySupportsLangExtractionAndComparison() {
"FILTER (lang(?uSingularStringAtt) = ?language) }";
parseAndAssertEquality(soql, expectedSparql);
}

@Test
void parseQuerySupportsCountById() {
final String soql = "SELECT COUNT(a) FROM OWLClassA a WHERE a.uri = :id";
final String expectedSparql = "SELECT (COUNT(?id) AS ?count) WHERE { ?id a " + strUri(Vocabulary.c_OwlClassA) + " . }";
parseAndAssertEquality(soql, expectedSparql);
}
}

0 comments on commit b2a5df4

Please sign in to comment.