Need advice on where to begin a more intricate data model...

malachii - March 18, 2009 - 15:13

First of all, hello, and thanks for creating a wonderful product. I've come a long way with Drupal, and am getting into CCK/Views now, but I've run into a situation I need to model and I don't know where to begin.

I'm trying to model something akin to (but not the same) IMDB's actor/movie/character relationship. It's basically a many-to-many relationship where an actor may appear in several movies, and a movie has several actors. At the same time, the actors have a role/character they play. If I were in total control of the data model there would be a dedicated join table with a column to represent the character/role name.

- CCK/Views seems to be uni-directional only.
- I saw a dev-only views relationship module that allows reverse relationship visualization, but that's not enough for me (I don't think) because it will only represent (I think) one-to-many and many-to-one relationships (backwards), and I'm quite sure it will not be able to handle my "join table" situation where I have a character/role name associated with the relationship.

I'm looking for the easiest way to start doing this. I have dev skills, but I'm not a drupal developer (yet). Where should I start? I'd like a jump-start.

Thanks!

Mal.

p.s. I have another post about my conflict with views and node views/page. This is related to some extent, but it's a different topic (do I represent the 'movie' as a node page, or as a view?).

what functionality are you trying to achieve

justageek - March 18, 2009 - 15:52

You can certain create , Movie, Actor, and Character content types, although I don't immediately see a benefit to having Character by a content type.

Movie has a node-reference field relating Actor Nodes to the Movie.

Then, take a look at the module http://drupal.org/project/nodereferrer

NodeReferrer provides a counter part to CCK's nodereference field. The options for a NodeReferrer field allow you to select content types and field instances to match when creating back reference lists.

This post has useful discussion that might help

http://drupal.org/node/161867

I would prefer not to have a

malachii - March 18, 2009 - 16:50

I would prefer not to have a character type, but sadly I think it's necessary, because I need to represent what the actor's character name was in the movie, and that's part of the relationship. So when Harrison Ford was in Raiders of the Lost Ark, his character was "Indiana Jones" I think I need to have a Character content type to achieve that.

So I think that I need:

Movie [node-references] Character [node-references] Actor

The trick will be how to extract that information in the node page for Movie so I can show all the actors, and their character names!

I'll check out that link you provided. Thanks.

yoru node reference can be one to many

justageek - March 18, 2009 - 20:22

You can select many Actors to link to your Movie in your node reference field.

Concerning your Character content type, I feel like there is another solution, I just don't know what it is off top of my head. I think you would have to write custom code to really make it work right, where you choose an Actor to associate with your Movie and then enter an additional value with the reference, which would be the name of the character. It is sort of like a new type of CCK file, "Node Reference plus Attribute" or something like that.

yep

malachii - March 19, 2009 - 01:54

"Node Reference plus Attribute"

That's exactly what I'm looking for. Did you totally invent that, or are you thinking that you've seen something about this before? Oh and dude, you're answering all my questions on this forum (in different threads). Thanks!

I did just make that up

justageek - March 19, 2009 - 16:09

But it would be a cool cck field, I might work on it when I get some time.

If you find another solution let me know. I am hunting for some documentation on creating cck field types.

Node-Taxonomy-Node-Reference

haleagar - August 12, 2009 - 22:22

Subscribe

I (and as far as I can tell from the forums lots of other folks) need/want a similar solution.
I'm guessing it's not a simple solution to turn into a module. It's not so complex in specific form, but I'm not sure myself how to hook into all the parts needed for Drupal.

I'd like to use a taxonomy as the reference label (reference type). Other folks have talked about using a node as the reference, but I like taxonomy and the features it already includes such as synonyms.

And for me I need the back reference, so the linkage would appear on both nodes, though I don't mind if you can only add the reference from one node type to the other.
Also I want my reference label to be the same on the forward and back reference though, in the super generalized solution I've seen other folks request different labels for each direction.

Janie "has a" gun.
Gun "belongs to" Janie.

Subscribing. Node and User

2440media2 - June 27, 2009 - 03:01

Subscribing.

Node and User References with an attribute or description field would be great - also something like the filefield, links, or attachment interfaces where you can organize them and give them names, etc would be awesome for node reference fields because multi-select lists are bad when you have 100s.

 
 

Drupal is a registered trademark of Dries Buytaert.