@@ -73,7 +73,7 @@ def save_element(self, e, node=None):
73
73
fmt = e .format ()
74
74
75
75
if not node :
76
- curr_node = URIRef (odmlns + str (e .id ))
76
+ curr_node = URIRef (odmlns + unicode (e .id ))
77
77
else :
78
78
curr_node = node
79
79
@@ -101,7 +101,7 @@ def save_element(self, e, node=None):
101
101
self .g .add ((curr_node , fmt .rdf_map (k ), terminology_node ))
102
102
else :
103
103
# adding terminology to the hub and to link with the doc
104
- node = URIRef (odmlns + str (uuid .uuid4 ()))
104
+ node = URIRef (odmlns + unicode (uuid .uuid4 ()))
105
105
self .g .add ((node , RDF .type , URIRef (terminology_url )))
106
106
self .g .add ((self .hub_root , odmlns .hasTerminology , node ))
107
107
self .g .add ((curr_node , fmt .rdf_map (k ), node ))
@@ -111,20 +111,20 @@ def save_element(self, e, node=None):
111
111
k == 'sections' and len (getattr (e , k )) > 0 :
112
112
sections = getattr (e , k )
113
113
for s in sections :
114
- node = URIRef (odmlns + str (s .id ))
114
+ node = URIRef (odmlns + unicode (s .id ))
115
115
self .g .add ((curr_node , fmt .rdf_map (k ), node ))
116
116
self .save_element (s , node )
117
117
elif isinstance (fmt , Section .__class__ ) and \
118
118
k == 'properties' and len (getattr (e , k )) > 0 :
119
119
properties = getattr (e , k )
120
120
for p in properties :
121
- node = URIRef (odmlns + str (p .id ))
121
+ node = URIRef (odmlns + unicode (p .id ))
122
122
self .g .add ((curr_node , fmt .rdf_map (k ), node ))
123
123
self .save_element (p , node )
124
124
elif isinstance (fmt , Property .__class__ ) and \
125
125
k == 'value' and len (getattr (e , k )) > 0 :
126
126
values = getattr (e , k )
127
- seq = URIRef (odmlns + str (uuid .uuid4 ()))
127
+ seq = URIRef (odmlns + unicode (uuid .uuid4 ()))
128
128
self .g .add ((seq , RDF .type , RDF .Seq ))
129
129
self .g .add ((curr_node , fmt .rdf_map (k ), seq ))
130
130
# rdflib so far does not respect RDF:li item order
@@ -133,15 +133,15 @@ def save_element(self, e, node=None):
133
133
# this should be reversed to RDF:li again!
134
134
# see https://github.com/RDFLib/rdflib/issues/280
135
135
# -- keep until supported
136
- # bag = URIRef(odmlns + str (uuid.uuid4()))
136
+ # bag = URIRef(odmlns + unicode (uuid.uuid4()))
137
137
# self.g.add((bag, RDF.type, RDF.Bag))
138
138
# self.g.add((curr_node, fmt.rdf_map(k), bag))
139
139
# for v in values:
140
140
# self.g.add((bag, RDF.li, Literal(v)))
141
141
142
142
counter = 1
143
143
for v in values :
144
- pred = "%s_%s" % (str (RDF ), counter )
144
+ pred = "%s_%s" % (unicode (RDF ), counter )
145
145
self .g .add ((seq , URIRef (pred ), Literal (v )))
146
146
counter = counter + 1
147
147
@@ -242,7 +242,7 @@ def parse_document(self, doc_uri):
242
242
doc_attrs [attr [0 ]] = doc_uri .split ("#" , 1 )[1 ]
243
243
else :
244
244
if len (elems ) > 0 :
245
- doc_attrs [attr [0 ]] = str (elems [0 ].toPython ())
245
+ doc_attrs [attr [0 ]] = unicode (elems [0 ].toPython ())
246
246
247
247
return {'Document' : doc_attrs , 'odml-version' : FORMAT_VERSION }
248
248
@@ -264,7 +264,7 @@ def parse_section(self, sec_uri):
264
264
sec_attrs [attr [0 ]] = sec_uri .split ("#" , 1 )[1 ]
265
265
else :
266
266
if len (elems ) > 0 :
267
- sec_attrs [attr [0 ]] = str (elems [0 ].toPython ())
267
+ sec_attrs [attr [0 ]] = unicode (elems [0 ].toPython ())
268
268
self ._check_mandatory_attrs (sec_attrs )
269
269
return sec_attrs
270
270
@@ -293,7 +293,7 @@ def parse_property(self, prop_uri):
293
293
prop_attrs [attr [0 ]] = prop_uri .split ("#" , 1 )[1 ]
294
294
else :
295
295
if len (elems ) > 0 :
296
- prop_attrs [attr [0 ]] = str (elems [0 ].toPython ())
296
+ prop_attrs [attr [0 ]] = unicode (elems [0 ].toPython ())
297
297
self ._check_mandatory_attrs (prop_attrs )
298
298
return prop_attrs
299
299
0 commit comments