File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -56,6 +56,21 @@ def __init__(self, odml_documents):
5656 print (err )
5757 return
5858
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+
5974 def convert_to_rdf (self ):
6075 self .hub_root = URIRef (odmlns .Hub )
6176 if self .docs :
@@ -193,7 +208,10 @@ def get_rdf_str(self, rdf_format):
193208
194209 def write_file (self , filename , rdf_format ):
195210 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 :
197215 file .write (data )
198216
199217
You can’t perform that action at this time.
0 commit comments