Multi-way join files with types?


#1

As part of the Arti (http://mephisto-ar.cfcl.com) effort,
I’m looking into creating a database to store information
on entities and relationships found in Ruby and Rails, as:

Method M1 is defined for Class C1 in File F1.

Method M1 of Class C1 is used by Method M2 in File F2.

Disregarding (for the moment) questions of Ruby ontology,
let’s look at how this information might be encoded in AR.

I gather that AR wants me to name join files by the ordered
names of the tables being joined. So, if I have tables
named “classes”, “files”, and “methods”, I would create a
join file named “classes_files_methods”.

I have two relationships that join the same set of tables,
so I need a way to tell them apart. I can do so by means of
a “type” column, with values such as “defines” and “uses”.

However, I’m not at all sure that AR supports multi-table
joins. In fact, my inquiries indicate that it does not.
I could use model code to work around this problem, but I’d
like to keep things as simple as possible.

Am I missing some obvious answer? Can someone suggest some
code and/or documentation that addresses this issue?

-r

http://www.cfcl.com/rdm Rich M.
http://www.cfcl.com/rdm/resume removed_email_address@domain.invalid
http://www.cfcl.com/rdm/weblog +1 650-873-7841

Technical editing and writing, programming, and web development