test: add test for issue
Add an xfail test to reproduce issue confirmed with both pyoxigraph and Jena.
import logging
from test.utils import eq_
+from test.utils.result import assert_bindings_collections_equal
from typing import Any, Callable, Mapping, Sequence, Type
import pytest
@@ -90,6 +91,39 @@ def test_sparql_bnodelist():
prepareQuery("select * where { ?s ?p ( [] [ ?p2 ?o2 ] [] ) . }")
+@pytest.mark.xfail(
+ raises=AssertionError,
+ reason="Object lists combined with predicate-object lists does not seem to work.",
+)
+def test_sparql_polist():
+ """
+
+ syntax tests for equivalence object and predicate-object lists
+
+ """
+
+ g = Graph()
+ g.parse(
+ data="""
+ @prefix : <urn:ns1:> .
+ :s :p [ :v 1 ], [ :v 2].
+ """,
+ format="turtle",
+ )
+
+ qres1 = g.query("PREFIX : <urn:ns1:> select * where { ?s :p [ ], [ ] . }")
+ qres2 = g.query("PREFIX : <urn:ns1:> select * where { ?s :p [ ]; :p [ ] . }")
+ assert_bindings_collections_equal(qres1.bindings, qres2.bindings)
+
+ qres3 = g.query(
+ "PREFIX : <urn:ns1:> select ?v1 ?v2 where { ?s :p [ :v ?v1 ], [ :v ?v2] . }"
+ )
+ qres4 = g.query(
+ "PREFIX : <urn:ns1:> select ?v1 ?v2 where { ?s :p [ :v ?v1 ]; :p [ :v ?v2 ] . }"
+ )
+ assert_bindings_collections_equal(qres3.bindings, qres4.bindings)
+
+
def test_complex_sparql_construct():
g = Graph()
