diff options
| author | Veyndan Stuart <veyndan@gmail.com> | 2022-08-21 17:58:49 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-08-21 17:58:49 +0200 |
| commit | a70a9c82649f9345c3691d69df6f1108e9e05871 (patch) | |
| tree | 197f2d338300f5d21b8468755c194250de8f2388 /test/test_sparql | |
| parent | a39d1436e00affc3cba9e903b22700029d8e8163 (diff) | |
| download | rdflib-a70a9c82649f9345c3691d69df6f1108e9e05871.tar.gz | |
fix: generate VALUES block for federated queries with variables only (#2084)
Fixed the generation of VALUES block for federated queries.
The values block was including non-variable values like BNodes which resulted
in invalid queries.
Closes #2079.
Diffstat (limited to 'test/test_sparql')
| -rw-r--r-- | test/test_sparql/test_service.py | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/test_sparql/test_service.py b/test/test_sparql/test_service.py index 8ed09cc8..53019771 100644 --- a/test/test_sparql/test_service.py +++ b/test/test_sparql/test_service.py @@ -70,6 +70,41 @@ def test_service_with_bind(): assert len(r) == 3 +def test_service_with_bound_solutions(): + g = Graph() + g.update( + """ + INSERT DATA { + [] + <http://www.w3.org/2002/07/owl#sameAs> <http://de.dbpedia.org/resource/John_Lilburne> ; + <http://purl.org/dc/terms/subject> <http://dbpedia.org/resource/Category:1614_births> . + } + """ + ) + q = """ + SELECT ?sameAs ?dbpComment ?subject WHERE { + [] + <http://www.w3.org/2002/07/owl#sameAs> ?sameAs ; + <http://purl.org/dc/terms/subject> ?subject . + + SERVICE <http://DBpedia.org/sparql> { + SELECT ?sameAs ?dbpComment ?subject WHERE { + <http://dbpedia.org/resource/John_Lilburne> + <http://www.w3.org/2002/07/owl#sameAs> ?sameAs ; + <http://www.w3.org/2000/01/rdf-schema#comment> ?dbpComment ; + <http://purl.org/dc/terms/subject> ?subject . + } + } + } + LIMIT 2 + """ + results = helper.query_with_retry(g, q) + assert len(results) == 2 + + for r in results: + assert len(r) == 3 + + def test_service_with_values(): g = Graph() q = """select ?sameAs ?dbpComment ?subject @@ -326,6 +361,7 @@ def test_with_mock( if __name__ == "__main__": test_service() test_service_with_bind() + test_service_with_bound_solutions() test_service_with_values() test_service_with_implicit_select() test_service_with_implicit_select_and_prefix() |
