Commits

gweis committed 9b8c271

do a full isomorphic comparison for graph equality

Comments (0)

Files changed (1)

             break
         return version
 
-    # def __eq__(self, other):
-    #     if not super(Graph, self).__eq__(other):
-    #         return False
-    #     # FIXME: asking for len in __eq__ ends in endless recursion in IOMemory store
-    #     # if len(self) != len(other):
-    #     #     return False
-    #     # FIXME: this may be called very often due to IOMemory implementation
-    #     return isomorphic(self, other)
-
-    def __ne__(self, other):
-        # FIXME: this is asymmetric to __eq__ (which does identifier check only)
-        return not(isinstance(other, Graph)
-                   and self.identifier == other.identifier
-                   and isomorphic(self, other))
+    def __eq__(self, other):
+        return (isinstance(other, _Graph)
+                and self.identifier == other.identifier
+                and isomorphic(self, other))
 
 
 class ConjunctiveGraph(_CGraph, _Common):
             super(ConjunctiveGraph, self).__init__(store=store, identifier=identifier, **kw)
         bind_ns(self)
 
+    def __eq__(self, other):
+        return (isinstance(other, _Graph)
+                and self.identifier == other.identifier
+                and isomorphic(self, other))
+
+
 class ReadOnlyGraphAggregate(_ROGraph, _Common):
     pass