Skip to content

Commit

Permalink
Add test for aggregate over ipns
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharywhitley committed Mar 27, 2022
1 parent bc928e6 commit cfd9e9a
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,25 @@ public void testSum() {
}
}

@Test
public void testSumIpns() {

final String aQuery = WebFunctionVocabulary.sparqlPrefix("wf") +
" prefix f: <ipns://wf.semantalytics.com/stardog/aggregate/> " +
" select (wf:agg(f:sum, ?a) AS ?result) WHERE { VALUES ?a { 1 2 3 1 }} ";

try (final SelectQueryResult aResult = connection.select(aQuery).execute()) {

assertThat(aResult).hasNext();
final Optional<Value> aPossibleValue = aResult.next().value("result");
assertThat(aPossibleValue).isPresent();
final Value aValue = aPossibleValue.get();
assertThat(assertStringLiteral(aValue));
final Literal aLiteral = ((Literal)aValue);
assertThat(Literal.longValue(aLiteral)).isEqualTo(7);
assertThat(aResult).isExhausted();
}
}


}

0 comments on commit cfd9e9a

Please sign in to comment.