I use the latest RDF module and the latest References module. I have created a Person content type and a Course content type. The Course content type contains a node reference field pointing to a Person node (the professor that teaches the course), in order to display the node links at the course's page and implement content type model that can be viewed in rdf. Though, when I try to get the rdf output (provided by the RDFx submodule - accessed via the RDF tab above the content) I get the following error message:

Fatal error: Unsupported operand types in C:\...\drupal-7.0-testing\sites\all\modules\rdf\rdfx.module on line 151

The RDF output works great on any other page (even with other fields enabled by the References module, ie. Link). Any ideas?

PS: I am new and inexperienced to Drupal.

Comments

konnak’s picture

Component: ARC compatibility » Miscellaneous

Also, when I hit "back" on the browser, right after the error, and then go the site's home page, I get the following notice:

Notice: Undefined variable: props in _rdfx_build_arc2_index_p_o() (line 364 of C:\...\drupal-7.0-testing\sites\all\modules\rdf\rdfx.module).

konnak’s picture

OK, some update:

The issue seems to exist only when I set the node reference field's rdf attribute property to "rev". I have created twp content types, 'Course' and 'Professor'. I then create a node reference field 'Teaches' in Professor, and set its rdf attribute property to 'rel', which causes no problem, but I then create a node reference field "Is taught by" in content type 'Course', with its rdf attribute property to 'rev' (to define the opposite relationship), and I receive the above error.

Any ideas? Where do I go wrong? Is it just a strange incompatibility?

scor’s picture

Title: RDF output on a content item that uses some node reference produces "Fatal error: Unsupported operand types in rdfx.module" » Add support for reverse predicate in RDF export
Category: support » feature

yes, the reverse predicate (@rev in RDFa) is not supported yet in the RDF output. It is a bit more tricky to impement as it requires to define the object as a new subject (and the subject as object).

konnak’s picture

Thanks for the reply.

I suppose a simple solution would be to create two rdf relationships, one with "teaches" predicate for the Professor content type, and one with "is_taught_by" predicate for the Course content type, and define both with 'rel' property attribute.

I just thought that defining a reverse rdf relationship would be more 'canonical'.

scor’s picture

This is a little off topic for the RDF module, but you seem to be dealing with with two fields for back references. It would make more sense, and be less error prone, to only have one field in one direction, and use a back reference module for the other direction. There could be RDF support as well for this back reference.

For now, the "teaches" relation would be supported by the current RDFx module.

konnak’s picture

Hmm, then I suppose I have to wait for the D7 version release of the modules BackReference or Node Relationships, which implement a back reference feature. I guess what I really wanted to do was to be able to automatically link the one content type's nodes with the other's, ie. when I create a Person node and link him via the 'teaches' relation (and the corresponding node reference field) with a certain Course node, to have an immediate back-relation as well, and have him appear at the corresponding Course node without manually inserting the Professor node (defining one relation twice). Of course, you had me all figured out, and I guess back reference was what I was looking all along! Sorry for the long text and the offtopic. For now I think I will have to stick with the one way relation.

scor’s picture

you could still use a double field, it is just extra work and error prone as you could miss reverse relation if they are done manually. that said it's only a few in the whole and it is manageable for your use case, you might use 2 fields for now until the D7 modules are available, I was just saying there are solutions for this kind of reverse relation problem.

milesw’s picture

Just want to point out some work being done in this area: Relation project

Not clear how far along it is, but sounds promising.

Anonymous’s picture

Yeah, I think Relation might end up being the big new thing, I had some conversations about it with folks at DrupalCon and everyone seems pretty excited about it. We should work with them to make sure that the RDFa makes sense and see if we can do reverse relations easily.

scor’s picture

Project: Resource Description Framework (RDF) » RDF Extensions
larjohn’s picture

I have altered the rdfx.module code a bit, to support the rev relation for my site. It seems to work fine for my SPARQL endpoint too. If you are really interested and want to have a look, I can submit a patch here.

Anyone willing to test it?

scor’s picture

absolutely, no need to ask, please post your patches :)

larjohn’s picture

StatusFileSize
new3.57 KB

Nice,

I am attaching my patch. What I have made is put an optional reference parameter in rdfx_get_predicates() and then get it as output in rdfx_add_resource().

It should be better included in the return array some way, but that might break compatibility.

For me, it just works now, I 'd like to see a more clear implementation though, if rel/rev are still politically correct...

larjohn’s picture

Is this issue stuck?

milesw’s picture

Issue summary: View changes
StatusFileSize
new1.78 KB

A little late here, but this is a nice feature that would be quite useful.

Here's an updated patch that will apply to dev. Plan to test this quite thoroughly myself in the coming weeks.

milesw’s picture

Status: Active » Needs review