Open awead opened 9 years ago
See also #714
This would refactor/replace #780
:+1: on something like this.
:+1: This would be great, and was something I was looking to put in activefedora-aggregations, but I think you're right that it belongs here.
:+1: to doing it, but the example code does't look right to me. I'm also not sure the thing-that-contains-containers needs to know what type of container it has, does it?
@cbeer Seems like that's the case where you'd want it to know, so that it could initialize the container on creation.
I don't really understand what is_direct_container_for
does, though.
@terrellt @cbeer Yeah, that was just a mock-up, so my code example is probably wrong. I wondered if we needed is_direct_container_for
as well and now thinking on it more it seems unnecessary.
I think a good start would be
class GenericFile < ActiveFedora::Base
has_direct_container :files, :member_relation => RDF::DC.hasPart
end
Which will spin up a /files direct container on save with a MemberRelation of RDF::DC.hasPart and a membershipResource of GenericFile's #id, when it's created.
I think has_
implies that the membershipResource is the containing resource, but maybe i'm wrong? It seems like if it's not then the statement would sit somewhere else.
@terrellt :+1:
@terrellt yep!
This has been implemented in: 3facdba2b7a07cebde590bdbce976b376d0f8e76 (direct containers) 7a36f432ef2023b0fce0a876d29d72aefc596b44 (indirect containers)
What if you could do:
And then have similar methods,
has_basic_container
andhas_indirect_container
.