Home
The Toolkit for Online Communities
15898 Community Members, 0 members online, 2395 visitors today
Log In Register

Forum OpenACS Q&A: Groups as members of groups

OpenACS Home : Forums : OpenACS Q&A : Groups as members of groups

Icon of Envelope Request notifications

+
Posted by Tony Kirkham on
According to the design and requirements docs for the groups system one should be able to create membership relations between parties and groups (group a is a member of group c) and composition relations between groups and groups. However, the relationship type for membership_rel, as currently defined, is between person and group.

This prevents the call group::add_member from creating the relationship. In fact it, prevents both, membership and composition relationships between groups because the group::add_member attempts to create a membership_rel for all relationships regardless of type and then another relation of the desired type.

Are there any negative ramifications to simply changing the acs_rel_type membership_rel from being between person and group to party and group?

When I do this things work almost fine. The relationships get created but, in the case of composition, when I remove the relationship the membership_rel is removed while the composition_rel is not.

Is this just incomplete development or am I missing something?

Any help would be greatly appreciated.

Thanks,
-Tony

+
Posted by Dave Bauer on
I don't think you should have a composition_rel AND a membership_rel between groups, so to test your change you would have to change so that when you add a group as a member of another group it only creates the membership_rel.
One or the other should be fine. I think enabled groups as members was discussed on the forums before, I'll see if I can find it.

I am curious what you are trying to do that you can't do with composition_rel.

+
Posted by Dave Bauer on
+
Posted by Tony Kirkham on
Dave, thank you very much. I had searched for info on this topic without much success. The postings from Tom Jackson were quite helpful. They have given me a better idea about how the system may have been intended to be used and certainly how it can be used. The reason I want a membership relation between groups and groups as opposed to composition is so that members of a group do not show up as members of the supergroup.

I notice that Tom, in the example code, does not use the tcl api but, instead uses the more direct sql api. I am referring to the tcl calls group::add_member and group::remove_member. With an understanding of Tom's explanation of the system, I am still not sure the purpose of the group::add_member call. It is the one that, if the rel_type passed in is not "membership_rel" it creates a "membership_rel" anyway, in addition to a relation of the desired type:
ad_proc -public group::add_member
...
if { ![string equal $rel_type "membership_rel"] } {
# Add them with a membership_rel first
relation_add -member_state $member_state "membership_rel" $group_id $user_id
}

relation_add -member_state $member_state $rel_type $group_id $user_id
...

I now assume that this was intended to only be used for subtypes of the membership_rel but, I am still not sure why both relations would get created unless it is needed to make all subtypes of membership_rel show up in the membership_rel queries as well. Is that assumption true?

With that in mind, is it true that if I create my own rel_type I should not use the provided group::member_add call but write my own using the sql api for relationship creation and deletion, unless my rel_type is truly a subtype of the established membership_rel?

I also do not understand relational segments. Tom mentions them but I don't see anywhere in his code examples where a record would get created in the rel_segments table or where these relational segments might be used. Are they simply the members of a group with a particular rel_type or is there more to them being that there is a table defined to contain them. It looks like membership_rel and admin_rel are created by default as rel_segments but not composition_rel. Is there any info on the what and why of relational segments?

+
Posted by Tom Jackson on
I also do not understand relational segments.

Here is a link to a test page in OpenACS which uses a rel_segment:

rel-segments-test.sql

A relational segment creates a subgroup where all members have the same rel_type to the original parent group.

Example from the above:

 -- the segment of all parties that are blah members of G
 seg_G_blahs := rel_segment__new(null,
   ''rel_segment'',
   now(),
   null,
   null,
   null,
   null,                                  
   ''Blahs of Group G'',
   G, 
   ''blah_member_rel'',
   null
);
+
Posted by Tom Jackson on

Here is a search on all of OpenACS code, many examples of creating specialized rel_segments:

Relational Segments Search

Note that this is a 5-10 second search due to the size of the source code

+
Posted by Tom Jackson on

Uggg, the URL got mangled by the enhanced text.

Retry:

Relational Segments Search