@@ -174,46 +174,47 @@ def raster_object_to_node(graph, controlled_dict, n_raster_facets, file_informat
174174 NS_UCO_OBSERVABLE .pictureType ,
175175 rdflib .Literal (file_ext )
176176 ))
177+ # :TODO The below feels a bit hacky probably a better way to do it
177178 if 'EXIF ExifImageLength' in controlled_dict .keys ():
178179 graph .add ((
179180 n_raster_facets ,
180181 NS_UCO_OBSERVABLE .pictureHeight ,
181- rdflib .term .Literal (str (controlled_dict ['EXIF ExifImageLength' ]),
182+ rdflib .term .Literal (int ( float ( str (controlled_dict ['EXIF ExifImageLength' ])) ),
182183 datatype = NS_XSD .integer )
183184 ))
184185 elif 'ExifImageHeight' in controlled_dict .keys ():
185186 graph .add ((
186187 n_raster_facets ,
187188 NS_UCO_OBSERVABLE .pictureHeight ,
188- rdflib .term .Literal (str (controlled_dict ['ExifImageHeight' ]),
189+ rdflib .term .Literal (int ( float ( str (controlled_dict ['ExifImageHeight' ])) ),
189190 datatype = NS_XSD .integer )
190191 ))
191192 if 'EXIF ExifImageWidth' in controlled_dict .keys ():
192193 graph .add ((
193194 n_raster_facets ,
194195 NS_UCO_OBSERVABLE .pictureWidth ,
195- rdflib .term .Literal (str (controlled_dict ['EXIF ExifImageWidth' ]),
196+ rdflib .term .Literal (int ( float ( str (controlled_dict ['EXIF ExifImageWidth' ])) ),
196197 datatype = NS_XSD .integer )
197198 ))
198199 elif 'ExifImageWidth' in controlled_dict .keys ():
199200 graph .add ((
200201 n_raster_facets ,
201202 NS_UCO_OBSERVABLE .pictureWidth ,
202- rdflib .term .Literal (str (controlled_dict ['ExifImageWidth' ]),
203+ rdflib .term .Literal (int ( float ( str (controlled_dict ['ExifImageWidth' ])) ),
203204 datatype = NS_XSD .integer )
204205 ))
205206 if 'EXIF CompressedBitsPerPixel' in controlled_dict .keys ():
206207 graph .add ((
207208 n_raster_facets ,
208209 NS_UCO_OBSERVABLE .bitsPerPixel ,
209- rdflib .term .Literal (str (controlled_dict ['EXIF CompressedBitsPerPixel' ]),
210+ rdflib .term .Literal (int ( float ( str (controlled_dict ['EXIF CompressedBitsPerPixel' ])) ),
210211 datatype = NS_XSD .integer )
211212 ))
212213 elif 'CompressedBitsPerPixel' in controlled_dict .keys ():
213214 graph .add ((
214215 n_raster_facets ,
215216 NS_UCO_OBSERVABLE .bitsPerPixel ,
216- rdflib .term .Literal (str (controlled_dict ['CompressedBitsPerPixel' ]),
217+ rdflib .term .Literal (int ( float ( str (controlled_dict ['CompressedBitsPerPixel' ])) ),
217218 datatype = NS_XSD .integer )
218219 ))
219220 graph .add ((
@@ -249,7 +250,9 @@ def controlled_dictionary_object_to_node(graph, controlled_dict, n_exif_facet):
249250 NS_UCO_TYPES .ControlledDictionary
250251 ))
251252 for key in sorted (controlled_dict .keys ()):
252- v_value = controlled_dict [key ]
253+ # :TODO stringing all values to ensure they are strings, open to input
254+ # here as maybe assertion or a better way to do this
255+ v_value = str (controlled_dict [key ])
253256 v_value = rdflib .Literal (v_value )
254257 try :
255258 assert isinstance (v_value , rdflib .Literal )
0 commit comments