Player API Database - finding methods

I’ve got this idea to make a database of all the Flash Player native APIs. The problem I’m running into is figuring out the best way to be able to query the members of a class.

Right now I’ve got one table for all definitions, including classes as well as methods and properties etc. The idea here being that even methods (functions) can be their own definitions - like getDefinitionByName() - its a global function that is like a class defined in a package with its own .as file. It would have basically all the same fields, more or less, as a class. A single field is present to determine definition ‘kind’ to distinguish between class vs. function vs. interface etc.

So each method is defined in a row in the definitions table. Each definition has a unique id and each method has a ‘parentID’ which references the definition (class) which declares it. So, for example, the addEventListener definition has an parentId that references the EventDispatcher id since EventDispatcher defines addEventListener. This sets up a one-to-many relationship with one declarer declaring many methods.

+--+--------+-----------------+
|id|parentID|name             |
+--+--------+-----------------+
|0 |0       |Object           |
+--+--------+-----------------+
|1 |0       |EventDispatcher  |
+--+--------+-----------------+
|2 |1       |addEventListener |
+--+--------+-----------------+
...
+--+--------+-----------------+
|8 |7       |Sprite           |
+--+--------+-----------------+
...

GREAT! The problem is that other definitions inherit these methods. Sprite, for example, inherits from EventDispatcher so it will also have addEventListener. The problem is the addEventListener definition doesn’t have a reference to Sprite, and there can be any number of classes that inherit the addEventListener function.

So, the question here is, how do I set things up to be able to query a class to get a list of all its methods, those it defines as well as those it inherits. Do I somehow need to make a recursive query (if possible?) to work its way through the parentID of a class until object is reached? On top of that, if a subclass defines its own, overridden method, that method should be preferred over any version that’s inherited.

My original solution was to have a many-to-many lookup table which would have a reference to all methods used by any particular class.

+-------+-------+
|ownerID|ownedID|
+-------+-------+
|1      |2      |
+-------+-------+
|8      |2      |
+-------+-------+
...

A colleague told me this would be horrific in terms of maintainability since when a new definition is added, not only would you have to add its DB entry, but you’d have to update the lookup table as well, not just for the new definition, but also any subclasses that might also be affected. For example if EventDispatcher got a new method, all subclasses of EventDispatcher would have to be updated in the lookup table to include the new method (which is a lot).

I’m starting to think the lookup might be the best bet after all despite that inconvenience. Unless maybe someone else has any better ideas?

=)