本文整理汇总了Python中dipper.utils.GraphUtils.GraphUtils.addTitle方法的典型用法代码示例。如果您正苦于以下问题:Python GraphUtils.addTitle方法的具体用法?Python GraphUtils.addTitle怎么用?Python GraphUtils.addTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dipper.utils.GraphUtils.GraphUtils
的用法示例。
在下文中一共展示了GraphUtils.addTitle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addRefToGraph
# 需要导入模块: from dipper.utils.GraphUtils import GraphUtils [as 别名]
# 或者: from dipper.utils.GraphUtils.GraphUtils import addTitle [as 别名]
def addRefToGraph(self, g):
gu = GraphUtils(curie_map.get())
n = self.short_citation
if n is None:
n = self.title
if self.ref_url is not None:
ref_uri = URIRef(self.ref_url)
g.add((ref_uri, DC['title'], Literal(self.title)))
g.add((ref_uri, RDF['type'], gu.getNode(self.ref_type)))
g.add((ref_uri, RDFS['label'], Literal(n)))
elif self.ref_id is not None:
gu.addIndividualToGraph(g, self.ref_id, n, self.ref_type)
if self.title is not None:
gu.addTitle(g, self.ref_id, self.title)
else:
# should never be true
logger.error("You are missing an identifier for a reference.")
# TODO what is the property here to add the date?
# if self.year is not None:
# gu.addTriple()
# if self.author_list is not None:
# for a in self.author_list:
# gu.addTriple(
# g, self.ref_id, self.props['has_author'], a, True)
return
示例2: addRefToGraph
# 需要导入模块: from dipper.utils.GraphUtils import GraphUtils [as 别名]
# 或者: from dipper.utils.GraphUtils.GraphUtils import addTitle [as 别名]
def addRefToGraph(self, g):
gu = GraphUtils(curie_map.get())
n = self.short_citation
if n is None:
n = self.title
gu.addIndividualToGraph(g, self.ref_id, n, self.ref_type)
if self.title is not None:
gu.addTitle(g, self.ref_id, self.title)
# todo what is the property here to add the date?
#if self.year is not None:
# gu.addTriple()
#if self.author_list is not None:
# for a in self.author_list:
# gu.addTriple(g, self.ref_id, self.props['has_author'], a, True)
return