本文整理汇总了Python中opencontext_py.apps.entities.entity.models.Entity.get_stable_ids方法的典型用法代码示例。如果您正苦于以下问题:Python Entity.get_stable_ids方法的具体用法?Python Entity.get_stable_ids怎么用?Python Entity.get_stable_ids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类opencontext_py.apps.entities.entity.models.Entity
的用法示例。
在下文中一共展示了Entity.get_stable_ids方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: id_summary
# 需要导入模块: from opencontext_py.apps.entities.entity.models import Entity [as 别名]
# 或者: from opencontext_py.apps.entities.entity.models.Entity import get_stable_ids [as 别名]
def id_summary(request, identifier):
""" Returns JSON data for entities
limited by certain criteria
"""
lequiv = LinkEquivalence()
id_list = lequiv.get_identifier_list_variants(identifier)
entity_obj = False
for test_id in id_list:
ent = Entity()
ent.get_stable_ids = True
found = ent.dereference(test_id)
if found:
entity_obj = LastUpdatedOrderedDict()
entity_obj['id'] = ent.uri
entity_obj['label'] = ent.label
entity_obj['uuid'] = ent.uuid
entity_obj['slug'] = ent.slug
entity_obj['item_type'] = ent.item_type
entity_obj['class_uri'] = ent.class_uri
entity_obj['data_type'] = ent.data_type
entity_obj['vocab_uri'] = ent.vocab_uri
entity_obj['project_uuid'] = ent.project_uuid
entity_obj['stable_id_uris'] = ent.stable_id_uris
break
if entity_obj is not False:
json_output = json.dumps(entity_obj,
indent=4,
ensure_ascii=False)
return HttpResponse(json_output,
content_type='application/json; charset=utf8')
else:
raise Http404