Initially it looks like it should work, its using the appropriate function, but it seems that its expecting the first parameter to be qualified.
https://github.com/Islandora/islandora/blob/6.x/api/fedora_item.inc#L346
See:
So something like this might solve your problem
$contributions->add_relationship('fedora-model:hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI);
Although you may need to explicitly include the namespace as well:
It seems as though the code has not been adding the prefix's automatically for some time now.
On Friday, May 10, 2013 3:18:23 PM UTC+2, Franck Falcoz wrote:
Hi,
When creating a collection in the following way:
$contributions = Fedora_Item::ingest_new_item($pid = '', $state = 'A', $label = 'Contributions', $owner = '');
$contributions->add_relationship('hasModel', 'islandora:collectionCModel', FEDORA_MODEL_URI);
$contributions->add_relationship('isMemberOfCollection', $parent_pid);
$contributions->add_relationship('contributionCollection', $parent_pid);
Which looks to me pretty much like how it's done in the Islandora code, I end up with RDF which has namespaces at the tag level rather than using a prefix, e.g. <hasModel xmlns="info:fedora..."> instead of <fedora-model:hasModel>.
The problem with that is that the result from get_rdf_relationships can contain hasModel or fedora-model:hasMode. I could check for both but I'd rather fix the RDF if possible.
Anyone knows what I'm doing wrong? I'm using 6.x-13.1 and the problem appeared in that version... although that could also be because of some other change I did.
Cheers,
franck