Alternative RDF models for Drupal

natuk's picture

RDF support in Drupal has been implemented with this model in mind:
Node = RDF subject
Field = RDF predicate
Field value = RDF object

This is a wonderful solution for most of Drupal content where the content type is ontologically connected to the field by a predicate.

But what happens when this is not the case? I.e. a field may be added in a content type because it is convenient for data inputting. But this field may not be directly connected to the content type by ontological rules. Which means that although the field appears within the content type, there is no direct predicate to assign to it. However, a predicate may exist to link to an implied piece of data (which should have been a different content type and) which is not entered for convenience. This implied piece of data then offers a predicate for the field (I tried to be clever in the attached image - see if it helps).
In the above case, the current Drupal RDF model does not work unless one creates that implied piece of data as a new content type. This is inconvenient when inputting data.

Has there been any discussion about a more relaxed model where the developer will be able to define more complicated ontological rules between content type and field than a simple predicate?

Or is this simply done by templates at a theme level?

Indirect linking of content type with field (png)47.79 KB


Yes, I wrote about this in my

linclark's picture

Yes, I wrote about this in my thesis and also created a way to handle this in microdata module. My hope is that we can make this possible with RDFa in D8.

Here's the chapter in my thesis, which has been submitted but not yet published. Specifically, section 5.3 deals with this issue.

Thanks, Lin, for posting

jneubert's picture

Thanks, Lin, for posting this. It comes just in time for my wrestling with similar issues. - Cheers, Joachim

You're right that there can

scor's picture

You're right that there can sometimes be an intentional mismatch between the data model in Drupal and the RDF model (for UI reason or others). In fact for one the projects I'm working on at the moment, we decided to do that because the UI workflow was more intuitive, but the RDF had to be modelled in a slightly different way.

You can look at the experimental Entity RDF module which allows you to "construct" your RDF model based on fields and tokens: by default it follows the current field based output, but you can alter the subject or object depending on your needs. You can read more on this in
Entity RDF: data descriptions for plugable serializations of Drupal entities (JSON-LD and more)
, in particular see the example in the latter part of the "Proof of concept implementations" section (Entity RDF ships with token support...). Note this only support the non-HTML formats such as Turtle, N-Triples, RDF/XML and JSON-LD. Supporting this in HTML is more complicated and requires more caution as Lin has argued many times if you want to do it well the DRY way (of course you can always dump it as hidden metadata in HTML, but this practice is questionable depending on who you talk to).

The issue where this will

linclark's picture

The issue where this will most likely be tackled in D8 is


natuk's picture

Lin, thanks for posting your chapter and issue and Stephane, thanks for the pointer.

Semantic Web

Group organizers

Group events

  • 2018-05-31 17:00 - 2018-06-02 18:00 Europe/Amsterdam
Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week