You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was testing RDFReader and ran into the problem with comparing odml objects. The thing is after building an odml document from an RDF graph the initial order of values, properties and sections become lost. That is why I cannot simply check if the processed document after conversion is equal to initial one. (See tests in test_parser.py)
For example:
Although the lists [<Section TheStarship[starship] (1)>, <Section TheCrew[crew] (4)>] and [<Section TheCrew[crew] (4)>, <Section TheStarship[starship] (1)>] contains same objects, the lists object itself are not equal. The same case happens with all attributes of base odml classes that have list values.
From conceptual view do the lists from above example are considered equal if its consist of an equal set of elements? If so can I add code to __eq__ method of baseobject(_baseobj) class to process the described cases?
The most straightforward way:
If the attribute value is the instance of a list compare the length, return false if different.
Compare each element from the first to each element from the second and track the number the same objects which should be equal to the number of elements in each list.
I implemented this method and all tests have passed.
The text was updated successfully, but these errors were encountered:
I was testing RDFReader and ran into the problem with comparing odml objects. The thing is after building an odml document from an RDF graph the initial order of values, properties and sections become lost. That is why I cannot simply check if the processed document after conversion is equal to initial one. (See tests in
test_parser.py
)For example:
Although the lists
[<Section TheStarship[starship] (1)>, <Section TheCrew[crew] (4)>]
and[<Section TheCrew[crew] (4)>, <Section TheStarship[starship] (1)>]
contains same objects, the lists object itself are not equal. The same case happens with all attributes of base odml classes that have list values.From conceptual view do the lists from above example are considered equal if its consist of an equal set of elements? If so can I add code to
__eq__
method ofbaseobject(_baseobj)
class to process the described cases?The most straightforward way:
I implemented this method and all tests have passed.
The text was updated successfully, but these errors were encountered: