View · Index
No registered users in community rubick
in last 10 minutes

Using acs-rels

What are acs-rels?

Don't use this as a definitive document. I'm writing as I figure things out. But I finally found some documentation for them:


ACS-rels are used to link together ACS Objects. This may make it possible to arbitrarily map different OpenACS objects and applications. Dave B says: "About using acs_rels to associate arbitrary objects to a project (just another object.) The acs_rels system is very flexible and powerful. It can define relationships between two different object types. Because acs rel types are themselves object types, you can extend those object types with additional attributes."

The documentation doesn't make it look that complicated. Basically acs-rels are a long skinny table that contains references to two other Objects, and has its own object_id as well. Apparently, it is also a general table, meant to be used not just for permissions but for any sort of association between objects.

The part I'm less clear of is that the data model has types of associations. I'm not clear on what that means yet.

Future cool things to do with acs-rels

Ignore this part if you're trying to learn about acs-rels. It is just some thinking I wanted to jot down, and will refine later A really neat idea would be to create a "related items" package built on top of acs-rels, which would relate any two packages together. DaveB suggested this to me.

Let's say you're building a project management software package for OpenACS. You'd like to let users associate all sorts of things with a project: photos, files, whatever.

You've been good, so you're using the object system, as described in the developer tutorial. Now you get to see some of the benefits of using objects.

Let's say you'd like to link surveys (a package) to projects. I haven't used the surveys package, so this is just an example. You extend the project view page to:

  • First, check that the survey package is installed. If not, don't show any of these links.
  • Show links for administrators on the project page (they would need admin on survey too), to create a survey.
  • After the survey is created, it would be linked in to the project page.
  • The project page would show surveys that project members could participate in.
  • When they click on the survey, they could fill it out.
  • When done, they would be returned to the project page.
My understanding is that this is not yet the way everything works. However, that is what developers are working towards, and parts of this are in place.

First of all, you could get a list of surveys, or files, or whatever, once you can get a URL for a given object_id. This work is described in this OpenACS thread.