diff --git a/test/test_sparql/test_service.py b/test/test_sparql/test_service.py index 83ac8388f..55be56f7a 100644 --- a/test/test_sparql/test_service.py +++ b/test/test_sparql/test_service.py @@ -18,17 +18,18 @@ @pytest.mark.webtest def test_service(): g = Graph() - q = """select ?sameAs ?dbpComment - where - { service - { select ?dbpHypernym ?dbpComment - where - { - - ?sameAs ; - ?dbpComment . - - } } } limit 2""" + q = """ + SELECT ?p ?o + WHERE { + SERVICE { + SELECT ?p ?o + WHERE { + ?p ?o + } + } + } + LIMIT 2 + """ try: results = helper.query_with_retry(g, q) except (RemoteDisconnected, IncompleteRead): @@ -44,19 +45,23 @@ def test_service(): @pytest.mark.webtest def test_service_with_bind(): g = Graph() - q = """select ?sameAs ?dbpComment ?subject - where - { bind ( as ?subject) - service - { select ?sameAs ?dbpComment ?subject - where - { - - ?sameAs ; - ?dbpComment ; - ?subject . - - } } } limit 2""" + q = """ + PREFIX dbp: + SELECT ?sameAs ?dbpComment ?subject + WHERE { + BIND( AS ?subject) + SERVICE { + SELECT ?sameAs ?dbpComment ?subject + WHERE { + + ?sameAs ; + dbp:caption ?dbpComment ; + ?subject . + } + } + } + LIMIT 2 + """ try: results = helper.query_with_retry(g, q) except (RemoteDisconnected, IncompleteRead): @@ -80,27 +85,30 @@ def test_service_with_bound_solutions(): """ ) q = """ - SELECT ?sameAs ?dbpComment ?subject WHERE { - [] - ?sameAs ; - ?subject . - - SERVICE { - SELECT ?sameAs ?dbpComment ?subject WHERE { - + PREFIX dbp: + SELECT ?sameAs ?dbpComment ?subject + WHERE { + [] ?sameAs ; - ?dbpComment ; ?subject . + + SERVICE { + SELECT ?sameAs ?dbpComment ?subject + WHERE { + + ?sameAs ; + dbp:caption ?dbpComment ; + ?subject . + } + } } - } - } - LIMIT 2 + LIMIT 2 """ try: results = helper.query_with_retry(g, q) except (RemoteDisconnected, IncompleteRead): pytest.skip("this test uses dbpedia which is down sometimes") - assert len(results) == 2 + assert len(results) == 1 for r in results: assert len(r) == 3 @@ -109,19 +117,25 @@ def test_service_with_bound_solutions(): @pytest.mark.webtest def test_service_with_values(): g = Graph() - q = """select ?sameAs ?dbpComment ?subject - where - { values (?sameAs ?subject) {( ) ( )} - service - { select ?sameAs ?dbpComment ?subject - where - { - - ?sameAs ; - ?dbpComment ; - ?subject . - - } } } limit 2""" + q = """ + PREFIX dbp: + SELECT ?sameAs ?dbpComment ?subject + WHERE { + VALUES (?sameAs ?subject) { + ( ) ( ) + } + SERVICE { + SELECT ?sameAs ?dbpComment ?subject + WHERE { + + ?sameAs ; + dbp:caption ?dbpComment ; + ?subject . + } + } + } + LIMIT 2 + """ try: results = helper.query_with_retry(g, q) except (RemoteDisconnected, IncompleteRead):