Skip to content

Commit 6882c06

Browse files
committed
[tools/rdf_converter] Swap default seq handling
When saving odml values to an RDF file, use the rdflib version 6+ handling as the default handling.
1 parent be24988 commit 6882c06

1 file changed

Lines changed: 7 additions & 11 deletions

File tree

odml/tools/rdf_converter.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,18 @@ def save_odml_values(self, parent_node, rdf_predicate, values):
155155
#self.graph.add((parent_node, rdf_predicate, bag))
156156
#for curr_val in values:
157157
# self.graph.add((bag, RDF.li, Literal(curr_val)))
158-
159-
# support both >=6.0.0 and <6.0.0 versions of rdflib for now
160-
# this is very unsafe handling of the rdflib version but ok for
161-
# now; should be properly handled later on
162-
if rdflib_version_major() < 6:
158+
if rdflib_version_major() >= 6:
159+
seq_list = []
160+
for curr_val in values:
161+
seq_list.append(Literal(curr_val))
162+
_ = CollSeq(self.graph, seq, seq_list)
163+
else:
164+
# manually create and use the value blank nodes order
163165
counter = 1
164166
for curr_val in values:
165167
custom_predicate = "%s_%s" % (str(RDF), counter)
166168
self.graph.add((seq, URIRef(custom_predicate), Literal(curr_val)))
167169
counter = counter + 1
168-
else:
169-
seq_list = []
170-
for curr_val in values:
171-
seq_list.append(Literal(curr_val))
172-
s = CollSeq(self.graph, seq, seq_list)
173-
print(s)
174170

175171
def save_odml_list(self, parent_node, rdf_predicate, odml_list):
176172
"""

0 commit comments

Comments
 (0)