Posted by gregorychandler on December 11, 2010 at 10:42pm
Hi there! New to Drupal. I need help.
What module(s) or resources are best to help me enable triple tags, where:
1. Each tag is composed of a subject, predicate, and object.
2. The subject, predicate, and object can be chosen from specific nodes on my site. Each field can suggest nodes as you type.
3. Two nodes with the same name can be differentiated by an ID or something.
My goal is to link my nodes into a linked graph that can be queried by something like views. I want to display the relationships between nodes.
Thanks for your help!
Greg
Comments
Drupal provides this natively
Hi Greg,
I'm not sure how familiar you are with Drupal, so please excuse this suggestion if it seems a bit obvious.
I would recommend using the content management tools built into Drupal to manage the relationships between subjects. In Drupal 6 you have the CCK module which allows you to add properties to nodes. Drupal 7 has a similar, even more felxible Fields system build in. Using CCK and/or Fields it is possible to model relationships to literals and other nodes, users or terms. You can see that this structure closely resembles an RDF triple, joining the subject node to a literal or another resource.
To address each of your points:
You have modeled a linked graph using standard Drupal tools which can then be accessed via views etc.
scor put together a very nice diagram as to how Drupal's internal structure applies to common ontologies:
http://groups.drupal.org/node/44094
I suspect that this doesn't really answer your question... Drupal can be used to define and manage the data model - that is really why you would use Drupal in the first place. The real challenge comes down to integrating a Drupal site with external systems but your post doesn't mention that.
cheers
Murray
Managing Director
Morpht
Thank you
Murray,
This is just the sort of thoughtful reply I was hoping to get. You are very kind.
Most of your points are well taken, and I will be thinking about how best to implement these ideas. One thing I am still unsure about: I started experimenting with the node reference module. It seems to allow links from one node to another (with auto-complete), but I don't see the field where I can enter the predicate.
In general, I am more confident that Drupal was the right choice for me. Thanks again for your help.
Greg
The predicate is the property (with a bit of mapping)
Greg,
When you add a new field to a content type you are asked to enter a "label" and a "name" for the type of field you wish to add. At this point you are defining the predicate of which you speak. You will notice that the "predicate" at this point is not a URI. This is where the RDF mapping comes into play - by providing Drupal with some extra data about the properties and content types, it is possible to express the data within Drupal as RDF.
If you are using D6 then check out rdfcck
http://drupal.org/project/rdfcck
It is probably best to use D7 though if you are just starting a sem web project in Drupal.
I must admit that it has been a few months since I played around with this in D7 and things have certainly moved on since then, so others might chime in to update on the current state of play... In D7 it is possible to define mappings from types and properties to URIs. ie. this is built into core. When I looked you could do the mapping declaratively in a module. Eventually you should be able to do it through a GUI. Once this has been done the data within Drupal can be expressed as RDFa or other RDF formats. This is one of the major improvements within D7.
cheers
Murray
Managing Director
Morpht
OK, I finally installed Drupal 7.
Now I am playing with fields. I can see where I can map the RDF predicate to a field on the back end. But what I want to do is allow the user to create a node, type a free tag into the tag field, then choose a predicate for that tag from a vocabulary. How do I make the predicate field changeable for each tag entered and visible to the user on the front end?
The RDF mapping API in core
The RDF mapping API in core only stores mappings at the level of a field attached to a bundle. It produces the same predicate for that field for each instance of the bundle.
It doesn't save mappings for each value of a field. If this is required for your project, it would need to be custom coded and would not be able to rely on the RDF mapping API.
EDIT: Had to change the wording of the first paragraph because of the fuzzy meaning of field instance.
So maybe RDF is not the best route to solving my problem
Maybe I need another way to create triple tags for my nodes. Is there another method besides RDF?
Could I create a free-tagging system, where each node of content type 1 can be tagged with either an existing or non-existing node of type 1, then allow the user to populate a second field pointing to a node of type 2. Type 2 nodes could then be used as the predicate for describing the relationship between two nodes of Type 1.
You're right, RDF might not
You're right, RDF might not be the solution for this problem. The good thing about RDF is that everyone uses universal names for predicates so people working across different sites can combine their data easily.
If you don't need that part, and are just using RDF for the graphy-ness, then you definitely don't need to integrate with the RDF mapping API and could just use something like Relations as you suggest.
How about this idea?
What if I just create a Content Type 2 which acts as the predicate? Content Type 2 would have two node reference fields to Content Type 1. Therefore the two nodes of Content Type 1 which I want to relate are connected through this third node of Content Type 2, which defines the relationship? My graph would have only one-dimensional links, but the structure would define the nature of the links instead of requiring triple tags.