ActiveFedora aggregations - How to and Best Practices
Table of Contents
Setup
How to make an object an activefedora-aggregation?
aggregates :members, :predicate => RDFVocabularies::PCDMTerms.hasMember, :class_name => "ActiveFedora::Base"
How to set the rdf type?
type RDFVocabularies::PCDMTerms.Collection
Questions: Is there a way to append another type using multiple statements? Something like...
type RDFVocabularies::PCDMTerms.Object type RDFVocabularies::WorksTerms.GenericWork
Behaviors
Append to an aggregation.
coll1 << coll2 coll1 << obj1 obj1 << obj2 obj1 << file1 # NOT AN AGGREGATION, but contains for files should be similar
Append and multiple proxies for the same member
coll1 << coll2 # <- [coll2] coll1 << coll3 # <- [coll2,coll3] coll1 << coll4 # <- [coll2,coll3,coll4] coll1 << coll2 # <- [coll3,coll4,coll2] OR RAISE ERROR because coll2 is already in coll1 coll1 << obj1 # <- [obj1] coll1 << obj2 # <- [obj1,obj2] coll1 << obj3 # <- [obj1,obj2,obj3] coll1 << obj2 # <- [obj1,obj2,obj3,obj2] - Object can be repeated in an aggregation # again, not an aggregation, but similar behaviors obj1 << file1 # <- [file1] obj1 << file2 # <- [file1,file2] obj1 << file1 # <- [file1,file2] OR [file1,file2,file1] ??? Does this replace file 1 ???
Set all
coll1.collections = [coll2,coll3,coll4] # does there need to be a check to disallow repeats in this array? coll1.collections = [coll2,coll3,coll4,coll2] # RAISE ERROR? because of repeat of coll2 coll1.objects = [obj1,obj2,obj3] coll1.objects = [obj1,obj2,obj3,obj2] # repeat of obj2 is OK
It is less efficient to set all instead of appending. Currently, set all will rewrite all the proxies.
Insert at
TBA - Is there a way to do this? What would it look like?
Reordering
TBA - what method would be called and how would the insertion point be identified?
Delete one from an aggregation
TBA - what method would be called and how would the member to delete be identified?