blob: 8075b63e017a27c83b2e07057b9fed3c641c19e1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
from rdflib import Graph, RDF
def test_recursive_list_detection():
g = Graph().parse(data="""
@prefix : <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<> :value _:a .
_:a :first "turtles"; :rest _:a .
<> :value [ :first "turtles"; :rest _:b ] .
_:b :first "all the way down"; :rest _:b .
<> :value [ :first "turtles"; :rest _:c ] .
_:c :first "all the way down"; :rest _:a .
""", format="turtle")
for v in g.objects(None, RDF.value):
try:
list(g.items(v))
except ValueError, e:
pass
else:
assert False, "Expected detection of recursive rdf:rest reference"
|