How to assign a type to a fedora object?

44 views
Skip to first unread message

Peter .

unread,
May 8, 2013, 7:33:26 PM5/8/13
to island...@googlegroups.com

Hi,

I have been using the information contained on this page for creating and accessing fedora objects:

https://github.com/Islandora/islandora/wiki/Build,-Access,-Modify-and-Delete-Fedora-objects-with-the-Tuque-interface

What I have noticed is that if I go to the overview tab for the collection that contains my newly created objects I see the following screen (see top of post).

What is missing is the Type for the object. I thought I set this value through the content_model.xml but that doesn't seem to be working. How do I set this value?

Thanks.


Nigel Banks

unread,
May 9, 2013, 3:09:31 AM5/9/13
to island...@googlegroups.com
Hmm that information does seem to be missing from the guide.

This will get you going though.

$object = islandora_object_load($pid); 
// Print the existing models
print_r($object['models']);
// Change the models
$object['models'] = array('islandora:collectionCModel');
// Print the new list of models
print_r($object['models']);
// Check if it worked 
if(isset($object['models']['islandora:collectionCModel'])) {
 echo "Successfully changed the content model";
}
// Remove the model
unset($object['models']['islandora:collectionCModel']);
if(!isset($object['models']['islandora:collectionCModel'])) {
 echo "Successfully removed the content model";
}

Nigel

Peter .

unread,
May 9, 2013, 11:45:43 AM5/9/13
to island...@googlegroups.com
Thanks for that information Nigel!

Peter .

unread,
May 9, 2013, 12:27:31 PM5/9/13
to island...@googlegroups.com
I tried what you said and it does not work for me. When I load the object and try the print_r, I do not get a listing of models just the value 1. If I just try to print_r the loaded object itself I get the same result 1. If I dsm($object->models) I do see a list of models (2) and I do see that one of the models listed is what I want (islandora:sp_strict_pdf). However the type is still not being displayed and throws the same error at the beginning of this thread. There must be some other missing information about setting this up correctly.

Thanks,
Peter

Nigel Banks

unread,
May 9, 2013, 12:53:18 PM5/9/13
to island...@googlegroups.com
Not 100% sure but my guess for the error message's is that maybe the content model object doesn't exist, so you have an object that is of type "islandora:sp_strict_pdf" but the object "islandora:sp_strict_pdf" doesn't exist?

Can you access:


Nigel

Peter .

unread,
May 9, 2013, 1:11:59 PM5/9/13
to island...@googlegroups.com
I entered that url and the root level of the repository was returned. I'm guessing that is not what was suppose to happen, but I am also not sure what it should have returned either. I do have the PDF solution pack installed so I think it should know what "islandora:sp_strict_pdf" is.

Nigel Banks

unread,
May 9, 2013, 1:45:45 PM5/9/13
to island...@googlegroups.com
Have you gone to admin/islandora/solution_packs, and made sure all the solution pack objects have been ingested?

Peter .

unread,
May 9, 2013, 1:50:57 PM5/9/13
to island...@googlegroups.com
That was the first thing I checked. Green check marks across the board.

Peter .

unread,
May 13, 2013, 2:28:08 PM5/13/13
to island...@googlegroups.com
Shouldn't Islandora be picking up the hasModel relationship and be displaying it here? Any other things I should be looking at or is this a bug?

Nigel Banks

unread,
May 13, 2013, 3:05:09 PM5/13/13
to island...@googlegroups.com
We haven't seen this problem in other locations, its likely something that is slightly different about your specific setup or data within your repository.

This is the function responsible for rendering that table with the missing label:


Depending on what commit your on the line numbers may be different than your error message.

Try throwing a dsm in after the get objects function like so:

$members = islandora_basic_collection_get_objects($object);
dsm($members);

That may give us the clue we need to sort this out.

Adam Vessey

unread,
May 13, 2013, 3:43:39 PM5/13/13
to island...@googlegroups.com
The content model "islandora:sp_strict_pdf" is not in the 7 PDF SP--we use "islandora:sp_pdf".

- Adam
--
You received this message because you are subscribed to the Google Groups "islandora-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to islandora-de...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Peter .

unread,
May 13, 2013, 4:30:07 PM5/13/13
to island...@googlegroups.com
That would explain it. Figures I would grab the wrong model from the wrong place. Thanks for pointing out my error.
Reply all
Reply to author
Forward
0 new messages