本文整理汇总了Python中rdflib.ConjunctiveGraph.isomorphic方法的典型用法代码示例。如果您正苦于以下问题:Python ConjunctiveGraph.isomorphic方法的具体用法?Python ConjunctiveGraph.isomorphic怎么用?Python ConjunctiveGraph.isomorphic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rdflib.ConjunctiveGraph
的用法示例。
在下文中一共展示了ConjunctiveGraph.isomorphic方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_collection_render
# 需要导入模块: from rdflib import ConjunctiveGraph [as 别名]
# 或者: from rdflib.ConjunctiveGraph import isomorphic [as 别名]
def test_collection_render(self):
foo = Namespace('http://www.example.org/foo/ns/')
ex = Namespace('http://www.example.org/example/foo/')
rdf = Namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#')
# Works: x a rdf:List, a foo:Other ;
# Fails: y a foo:Wrapper, foo:wraps x; x a rdf:List, a foo:Other ;
target1 = ConjunctiveGraph()
target1.parse(data=target1xml)
target2 = ConjunctiveGraph()
target2.parse(data=target2xml)
g = ConjunctiveGraph()
bits = [ex['a'], ex['b'], ex['c']]
l = Collection(g, ex['thing'], bits)
triple = (ex['thing'], rdf['type'], foo['Other'])
g.add(triple)
triple = (ex['thing'], foo['property'], Literal('Some Value'))
g.add(triple)
for b in bits:
triple = (b, rdf['type'], foo['Item'])
g.add(triple)
self.assertEqual(g.isomorphic(target1), True)