File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,21 @@ def __init__(self, odml_documents):
56
56
print (err )
57
57
return
58
58
59
+ _conversion_formats = {
60
+ # rdflib version "4.2.2" serialization formats
61
+ 'xml' : '.rdf' ,
62
+ 'pretty-xml' : '.rdf' ,
63
+ 'trix' : '.rdf' ,
64
+ 'n3' : '.n3' ,
65
+ 'turtle' : '.ttl' ,
66
+ 'ttl' : '.ttl' ,
67
+ 'ntriples' : '.nt' ,
68
+ 'nt' : '.nt' ,
69
+ 'nt11' : '.nt' ,
70
+ 'trig' : '.trig' ,
71
+ 'json-ld' : '.jsonld'
72
+ }
73
+
59
74
def convert_to_rdf (self ):
60
75
self .hub_root = URIRef (odmlns .Hub )
61
76
if self .docs :
@@ -193,7 +208,10 @@ def get_rdf_str(self, rdf_format):
193
208
194
209
def write_file (self , filename , rdf_format ):
195
210
data = self .get_rdf_str (rdf_format )
196
- with open (filename , "w" ) as file :
211
+ filename_ext = filename
212
+ if not filename .find ("." + rdf_format ):
213
+ filename_ext += "." + rdf_format
214
+ with open (filename_ext , "w" ) as file :
197
215
file .write (data )
198
216
199
217
You can’t perform that action at this time.
0 commit comments