Skip to content

Commit

Permalink
Fixed issue ncbo#3
Browse files Browse the repository at this point in the history
  • Loading branch information
twktheainur committed Mar 7, 2017
1 parent 3165c9c commit 809d5f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions umls2rdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@

MRSAB_LAT = 19

UMLS_LANGCODE_MAP = {"eng" : "en", "fre" : "fr", "cze" : "cz", "fin" : "fi", "ger" : "de", "ita" : "it", "jpn" : "jp", "pol" : "pl", "por" : "pt", "rus" : "ru", "spa" : "es", "swe" : "sw", "scr" : "hr", "dut" : "nl", "lav" : "lv", "hun" : "hu", "kor" : "kr", "dan" : "da", "nor" : "no", "heb" : "he", "baq" : "eu"}

def get_umls_url(code):
return "%s%s/"%(conf.UMLS_BASE_URI,code)

Expand Down Expand Up @@ -307,7 +309,7 @@ def getURLTerm(self,code):
def properties(self):
return self.class_properties

def toRDF(self,fmt="Turtle",hierarchy=True,lang="eng",tree=None):
def toRDF(self,fmt="Turtle",hierarchy=True,lang="en",tree=None):
if not fmt == "Turtle":
raise AttributeError, "Only fmt='Turtle' is currently supported"
term_code = self.code()
Expand Down Expand Up @@ -648,7 +650,7 @@ def write_into(self,file_path,hierarchy=True):
fout.write(ONTOLOGY_HEADER.substitute(header_values))
for term in self.terms():
try:
rdf_text = term.toRDF(lang=self.lang,tree=self.tree)
rdf_text = term.toRDF(lang=UMLS_LANGCODE_MAP[self.lang],tree=self.tree)
fout.write(rdf_text)
except Exception, e:
print "ERROR dumping term ", e
Expand Down

0 comments on commit 809d5f3

Please sign in to comment.