Repository: RDFLib/rdflib

Issue:
Separator in group_concat function with explicit empty string incorrectly defaults to 'space' character
Using the group_concat function with the separator indicating an _empty string_ ("") leads incorrectly to the default use of a space character as separator (" ").

**Example code:**



```
PREFIX : <http://example.org/>

SELECT ?subject (GROUP_CONCAT(?object; separator="") AS ?concatenatedObjects)
WHERE {
  VALUES (?subject ?object) {
    (:subject1 "a")
    (:subject1 "b")
    (:subject1 "c")
  }
}
GROUP BY ?subject
```

**Expected outcome for concatenatedObjects:**

`abc`

**Instead we get:**

`a b c`

Discussion:
coveralls: 
[![Coverage Status](https://coveralls.io/builds/61208808/badge)](https://coveralls.io/builds/61208808)

coverage: 90.904% (+0.001%) from 90.903% when pulling **cb78740c4803d83794aea50280b01c9cbdf66c15 on WhiteGobo:bug_groupconcat_uses_separator** into **0ea6ca579442219d67ffb1fc7313f05fd16d8d49 on RDFLib:main**.

aucampia: pre-commit.ci autofix

Patch:
diff --git a/rdflib/plugins/sparql/aggregates.py b/rdflib/plugins/sparql/aggregates.py
index d4a7d659..84ac8936 100644
--- a/rdflib/plugins/sparql/aggregates.py
+++ b/rdflib/plugins/sparql/aggregates.py
@@ -245,11 +245,16 @@ class Sample(Accumulator):
 
 
 class GroupConcat(Accumulator):
-    def __init__(self, aggregation):
+    value: List[Literal]
+
+    def __init__(self, aggregation: CompValue):
         super(GroupConcat, self).__init__(aggregation)
         # only GROUPCONCAT needs to have a list as accumulator
         self.value = []
-        self.separator = aggregation.separator or " "
+        if aggregation.separator is None:
+            self.separator = " "
+        else:
+            self.separator = aggregation.separator
 
     def update(self, row: FrozenBindings, aggregator: "Aggregator") -> None:
         try:


Test patch:
diff --git a/test/test_sparql/test_translate_algebra.py b/test/test_sparql/test_translate_algebra.py
index 20b23327..ca9e67bd 100644
--- a/test/test_sparql/test_translate_algebra.py
+++ b/test/test_sparql/test_translate_algebra.py
@@ -11,6 +11,7 @@ from _pytest.mark.structures import Mark, MarkDecorator, ParameterSet
 
 import rdflib.plugins.sparql.algebra as algebra
 import rdflib.plugins.sparql.parser as parser
+from rdflib import Graph, Literal, URIRef
 from rdflib.plugins.sparql.algebra import translateAlgebra
 
 
@@ -304,3 +305,25 @@ def test_roundtrip(test_spec: AlgebraTest, data_path: Path) -> None:
     # TODO: Execute the raw query (query_text) and the reconstituted query
     # (query_from_query_from_algebra) against a well defined graph and ensure
     # they yield the same result.
+
+
+def test_sparql_group_concat():
+    """Tests if GROUP_CONCAT correctly uses the separator keyword"""
+    query = """
+    PREFIX : <http://example.org/>
+
+    SELECT ?subject (GROUP_CONCAT(?object; separator="")
+                        AS ?concatenatedObjects)
+    WHERE {
+      VALUES (?subject ?object) {
+        (:pred "a")
+        (:pred "b")
+        (:pred "c")
+      }
+    }
+    GROUP BY ?subject
+    """
+
+    g = Graph()
+    q = dict(g.query(query))
+    assert q[URIRef("http://example.org/pred")] == Literal("abc")