本文整理匯總了Python中term.Term.id方法的典型用法代碼示例。如果您正苦於以下問題:Python Term.id方法的具體用法?Python Term.id怎麽用?Python Term.id使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類term.Term
的用法示例。
在下文中一共展示了Term.id方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: build_term
# 需要導入模塊: from term import Term [as 別名]
# 或者: from term.Term import id [as 別名]
def build_term(dict):
"""
Builds a Term object from the term metadata dictionary provided.
"""
# Add our metadata to our term piece-by-piece
term = Term()
try:
term.id = dict['id'][0]
term.name = dict['name'][0]
except KeyError as k:
raise TermMissingRequiredFieldException("Missing required field %s" % k)
termDef = dict.get('def', [""])
term.definition = termDef[0]
obsoleteBool = dict.get('is_obsolete', [False])
term.obsolete = obsoleteBool[0]
term.synonyms.extend( format_synonym_list(dict.get('synonym', [])) )
term.relationships.extend( dict.get('relationship', []) )
term.xrefs.extend( dict.get('xref', []) )
term.alternateIds.extend( dict.get('alt_id', []) )
term.subsets.extend( dict.get('subset', []) )
return term