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.
| Comment | File | Size | Author |
|---|---|---|---|
| #15 | rdfx-1073986-15-reverse-predicates.patch | 1.78 KB | milesw |
Comments
Comment #1
konnak commentedAlso, 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).
Comment #2
konnak commentedOK, 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?
Comment #3
scor commentedyes, 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).
Comment #4
konnak commentedThanks 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'.
Comment #5
scor commentedThis 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.
Comment #6
konnak commentedHmm, 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.
Comment #7
scor commentedyou 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.
Comment #8
milesw commentedJust want to point out some work being done in this area: Relation project
Not clear how far along it is, but sounds promising.
Comment #9
Anonymous (not verified) commentedYeah, 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.
Comment #10
scor commentedComment #11
larjohn commentedI 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?
Comment #12
scor commentedabsolutely, no need to ask, please post your patches :)
Comment #13
larjohn commentedNice,
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...
Comment #14
larjohn commentedIs this issue stuck?
Comment #15
milesw commentedA 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.
Comment #16
milesw commented