models.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pyfc4 作者: ghukill 项目源码 文件源码
def _diff_graph(self):

        '''
        Uses rdflib.compare diff, https://github.com/RDFLib/rdflib/blob/master/rdflib/compare.py
        When a resource is retrieved, the graph retrieved and parsed at that time is saved to self.rdf._orig_graph,
        and all local modifications are made to self.rdf.graph.  This method compares the two graphs and returns the diff
        in the format of three graphs:

            overlap - triples shared by both
            removed - triples that exist ONLY in the original graph, self.rdf._orig_graph
            added - triples that exist ONLY in the modified graph, self.rdf.graph

        These are used for building a sparql update query for self.update.

        Args:
            None

        Returns:
            None: sets self.rdf.diffs and adds the three graphs mentioned, 'overlap', 'removed', and 'added'
        '''

        overlap, removed, added = graph_diff(
            to_isomorphic(self.rdf._orig_graph),
            to_isomorphic(self.rdf.graph))
        diffs = SimpleNamespace()
        diffs.overlap = overlap
        diffs.removed = removed
        diffs.added = added
        self.rdf.diffs = diffs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号