active_fedora icon indicating copy to clipboard operation
active_fedora copied to clipboard

Should ActiveFedora implement LDP containment principles?

Open awead opened this issue 10 years ago • 11 comments

What if you could do:

class SomeItems < ActiveFedora:Base
  has_direct_container Box
end
class Box < ActiveFedora:Base
  is_direct_container_for SomeItems, membership: :hasItems
end

And then have similar methods, has_basic_container and has_indirect_container.

awead avatar May 04 '15 14:05 awead

See also #714

awead avatar May 04 '15 14:05 awead

This would refactor/replace #780

awead avatar May 04 '15 14:05 awead

:+1: on something like this.

no-reply avatar May 04 '15 14:05 no-reply

:+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.

tpendragon avatar May 04 '15 14:05 tpendragon

:+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 avatar May 04 '15 15:05 cbeer

@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.

tpendragon avatar May 04 '15 15:05 tpendragon

@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.

awead avatar May 04 '15 15:05 awead

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.

tpendragon avatar May 04 '15 16:05 tpendragon

@terrellt :+1:

cbeer avatar May 04 '15 16:05 cbeer

@terrellt yep!

awead avatar May 04 '15 16:05 awead

This has been implemented in: 3facdba2b7a07cebde590bdbce976b376d0f8e76 (direct containers) 7a36f432ef2023b0fce0a876d29d72aefc596b44 (indirect containers)

awead avatar May 08 '15 15:05 awead