I am working on functionality for building role-playing games, and I will be using nodereference to create relationships between different nodes. The content types are person, place, thing, and event. Creating the nodereference field is no problem, however I'd like to include more information with the nodereference than just the link between the two nodes. For example, for a relationship between a person and a place, is that place the person's home, workplace, or something else? Or for a person's relationship to another person, are they enemies, friends, allies, lovers, coworkers, soldier/commander, master/apprentice, etc?

I am looking at using Node Relationships, but even that module does not solve this semantic information about the nodereference. I've tried looking for a semantic nodereference add-on module, but I have not been able to find anything yet. While I have submitted this as a feature request, I am willing to work on a new module that would serve this purpose if there is no solution available.

Comments

naught101’s picture

Version: 6.x-2.6 » 6.x-3.x-dev

I'm also looking for this function. I think it might require a new module, as I doubt this would get into CCK, definitely not in 2.x now.

Basically, you'd need to store 4 data:
- Referring Node
- Reference field name (same as current field_name)
- Field relationship type
- Node to be referenced

That set-up would completely remove the need for multiple different reference fields for different relationships, but it would still work well with multiple fields (eg. in your example, you could still have fields separating person->person, person->place and person->thing relationships).

Ideally, the field relationship type could be set as either a select drop-down (with options specified in the field settings in the content type settings), or an auto-complete field (same as the node reference field itself).

I'd also be willing to work on this as a separate module, however it'd be good to get someone who's working on CCK to review the idea first, and see if it might fit in core CCK.

naught101’s picture

Version: 6.x-3.x-dev » 6.x-2.x-dev

ignore that bit about 2.x... I was talking out of my arse...

naught101’s picture

Title: Identify the type of reference when using nodereference » Abitrary reference names for node reference

better name.

naught101’s picture

Hrm... after talking to a friend, it seems this might be possible with CCK3's multi-fields (ie. just combine a text field and a nodereference field).

Still, it might be useful to have a custom field to do this, just so there's a standardised way of dealing with this use case (so other modules like http://drupal.org/project/graphviz_noderef can interface with it).

R.J. Steinert’s picture

I feel your pain on this. Right now that extra piece of descriptive data that describes the relationship between the nodes can simply be the CCK field name. For example, you could have an 'Enemies' node reference field that references other user profile nodes and a 'Friends' node reference field that references other user profile nodes. Because the user puts nodes in a 'Friends' field and an 'Enemies' field, you can infer the relationship between the two users.

Multi-fields is definitely a way you can pair descriptive data with a relationship, the drawback there is multi-fields + Views is not hashed out so well.

If you are interested in outputting RDFa or RDF data that explains the nodereferences check out the RDF CCK module. You can map CCK fields to RDF triplets using that module. A good place to start would be the RDF project page.

http://drupal.org/project/rdf

naught101’s picture

Status: Active » Closed (duplicate)

I think this is probably better as part of CCK Attributes, so I'm marking this as a duplicate of #762932: Extending Attributes Module to Provide other field types.