RDFLib / OWL-RL

A simple implementation of the OWL2 RL Profile on top of RDFLib: it expands the graph with all possible triples that OWL RL defines. It can be used together with RDFLib to expand an RDFLib Graph object, or as a stand alone service with its own serialization.
http://www.ivan-herman.net/Misc/2008/owlrl/
Other
140 stars 30 forks source link

Simplify literals related code #8

Closed wrobell closed 5 years ago

wrobell commented 5 years ago
  1. Use dict.get method with identity function as default converter instead of try..except... clause.
  2. for in some_dict is the same as for in list(some_dict.keys(), but avoids creating the list.
  3. Reuse _LiteralStructure class equality operator overload.

Above changes are compatible with both Python 2.7 and Python 3.

ashleysommer commented 5 years ago

I think the instances of for in list(some_dict.keys()) in the code were added by our use of the python 2to3 tool when porting from python2 to python3, I agree that for in some_dict is much cleaner and works exactly the same. This change looks good, I will merge.