Forum OpenACS Improvement Proposals (TIPs): TIP#101: (Implemented/Withdrawn) Create object references, internal links between objects

TIP#101
Author: Dave Bauer
Purpse: To support a way to keep track of links between objects without acs_rels or cr_item_rels.

How will it work?

The proposal is to create a new table in acs-kernel

create table object_references (
    object_id integer,
    ref_object_id integer,
    type text
);
I am proposing using a seperate table to simplify the implementation. By implementing a Tcl API around this feature we can always decide in the future if we need to change the implementation.

The goal of storing this information is to generate a list of "related items". One applicaiton of this is scanning HTML content for URLs that point to other objects. Using the /o/${object_id} syntax we can find a link to any object_id.

This is basically a more general way of recording backlinks in xowiki.

Historically, developers have avoided using acs_rels for this type of mapping since it requires an acs_object for every reference.

In addition I am working on a feature to allow image or file upload of attachments without storing them in file-storage, or photo-album etc. The system will also allow reuse of previously uploaded files or images. It would be useful, in this case, to keep track of where the files or images were referenced. Since the reference to the uploaded file or image in the related object is embedded in the HTML content of the related object, there is not other way to find of if an image is in use.

This proposal includes a tcl procedure to scan text or html content and extract a list of object_ids that are referenced within the content. It also will support inserting/updating these refernces.

See Also:
related-items package, which solves a similar problem, but focuses on user-generated "this is related to that" actions. This proposal looks to extract the references from within the object content itself. I also think its important to have this in the core of OpenACS to allow it to work with other site-wide features such as the image upload previously mentioned.

Another goal is to replace the attachments package, allowing references to objects to show up right in the content.
My initial implemenation of this code is done including automated tests. It should run on PostgreSQL and Oracle.
Okay, you might want to have to extend this by a type of the relationship if you really need it. Application_link and application_data_link rely on the object_type of the target object, so you can say "show me all forum postings linked to this photo".
Malte,

No I want it simple, I don't need to type the links. In fact I don't even want to restrict by type of object. I just want to say "give me all the objects linked to this object"

Thanks for pointing this out :)

Malte,

any reason the table has a rel_id column? What is it for?

I only needed to add a few new tcl procs to support my applicaiton with the existing acs_data_links table so I am withdrawing this proposal.

Adding a new tcl proc that doesn't change the behavior of an existing API does not require a TIP.

Thanks Malte!

I added tests for the new functions. Its checked in on HEAD.

The rel_id exists because we want to be able to reference the relationship of the data. Not sure when we really needed that, so it might be a relict of the time when these things still were objects, not sure.