Skip to content

Commit be24988

Browse files
committed
[tools/rdf_converter] Fix Seq values import
1 parent 61a0442 commit be24988

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

odml/tools/rdf_converter.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import warnings
1010

1111
from io import StringIO
12+
13+
import rdflib
1214
from rdflib import __version__ as rdflib_version
1315
from rdflib import Graph, Literal, URIRef
1416
from rdflib.graph import Seq
@@ -550,10 +552,11 @@ def parse_property(self, prop_uri):
550552

551553
if rdflib_version_major() >= 6:
552554
# rdflib version 6.x.x+ should support rdf:_nnn only, RDF.li
553-
# is not supported
554-
print(elems)
555-
for curr_val in elems[0].items():
556-
prop_attrs[attr[0]].append(curr_val.toPython())
555+
# are not supported; reverse import the blank node values;
556+
# hopefully in the correct order.
557+
val_seq = Seq(graph=self.graph, subject=elems[0])
558+
for seq_item in val_seq:
559+
prop_attrs[attr[0]].append(seq_item.toPython())
557560
else:
558561
# rdflib does not respect order with RDF.li items yet, see comment above
559562
# support both RDF.li and rdf:_nnn for now.

0 commit comments

Comments
 (0)