From cfd9e9ab90b249a48afb5aed3d81535776dc9f72 Mon Sep 17 00:00:00 2001 From: Zachary Whitley Date: Sun, 27 Mar 2022 18:07:56 -0400 Subject: [PATCH] Add test for aggregate over ipns --- .../stardog/kibble/webfunctions/TestSum.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/test/java/com/semantalytics/stardog/kibble/webfunctions/TestSum.java b/src/test/java/com/semantalytics/stardog/kibble/webfunctions/TestSum.java index d7c9f72..fa18b24 100644 --- a/src/test/java/com/semantalytics/stardog/kibble/webfunctions/TestSum.java +++ b/src/test/java/com/semantalytics/stardog/kibble/webfunctions/TestSum.java @@ -32,4 +32,25 @@ public void testSum() { } } + @Test + public void testSumIpns() { + + final String aQuery = WebFunctionVocabulary.sparqlPrefix("wf") + + " prefix f: " + + " 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 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(); + } +} + + }