Frame Systems for Knowledge Representation in Python
MetadataShow full item record
The class system in Python 2.2 is able to handle all of the information needed for a frame system. Hierarchies, inheritance, and introspection are all easily and naturally implemented within the class system. Using the Python class system has some advantages. For example, the hierarchy of a frame system is very easy to see when implemented using classes, as long as good coding is being used. The root of the frame system (the parent class that does not have its own parent) is at the top of the code. Logically, each child should come directly after its parent in the code, making it easy to see the hierarchy. Even if that's not the case, the parent of each subclass is passed in as a parameter to that class. The Python frame system is written so that this is not always the case. Definitions can get very messy using the frame system. The classes can be defined in any order, and it's not always easy to see the parent of a certain class. It's harder to follow the code due to the messy syntax, and therefore harder to see the hierarchy of any given frame system. The class system supports multiple inheritance, which is an advantage over my frame system already since the frame system only supports single inheritance. Other than the difference in multiple and single inheritance though, the frame system and class system are both very similar. Both support inheritance of both attributes and methods between classes and instances. The biggest difference here is the syntax. It is very easy to see which attributes and methods belong to which class in the class system, but it is a little messy when it comes to attributes and methods in the frame system. Introspection is essentially equal between the two systems. The Python 2.2 class system wasn't written to be a frame system, so I did need to add a few functions in order to make it work as a frame system. I only needed to add a few functions though, and they were all fairly simple. Once again though, the syntax of the class system is much more simple and user-friendly than the syntax of the frame system. The Python class system has many advantages over the frame system. Hierarchies and inheritance are both easier to see in the class system; multiple inheritance is supported rather than only single inheritance; and the biggest difference of all, the syntax of the class system is much cleaner and clearer than in the frame system. The code is easy to follow and easy to write.