当前位置: 首页>>代码示例>>Python>>正文


Python ConjunctiveGraph.isomorphic方法代码示例

本文整理汇总了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)
开发者ID:Dataliberate,项目名称:rdflib,代码行数:26,代码来源:test_issue160.py


注:本文中的rdflib.ConjunctiveGraph.isomorphic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。