Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can related objects be repeated? #92

Open
elrayle opened this issue May 14, 2015 · 4 comments
Open

Can related objects be repeated? #92

elrayle opened this issue May 14, 2015 · 4 comments
Labels

Comments

@elrayle
Copy link
Contributor

elrayle commented May 14, 2015

Service AddRelatedObjectToCollection/Object use the following to add the related object.

parent_collection.related_objects << child_related_object
parent_object.related_objects << child_related_object

Should the following result in related_objects = [object1,object2] OR [object1,object2,object1]

        Hydra::PCDM::AddRelatedObjectToObject.call( subject, object1 )
        Hydra::PCDM::AddRelatedObjectToObject.call( subject, object2 )
        Hydra::PCDM::AddRelatedObjectToObject.call( subject, object1 )

Right now, it results in the later.

See test hdra/pcdm/services/collection/add_related_object_spec.rb xit 'should NOT allow related objects to repeat'

See test hdra/pcdm/services/object/add_related_object_spec.rb xit 'should NOT allow related objects to repeat'

@tpendragon
Copy link
Contributor

#related_objects returns doubles? That seems unlikely, I'd expect #ordered_related_objects to do that

@escowles
Copy link
Contributor

The model doesn't really say anything about whether there can be multiple instances of an item in the related_objects (though it does say that they're not ordered). I don't remember a use case for multiples, though in this case it looks like it would be easier to allow them, right?

@elrayle
Copy link
Contributor Author

elrayle commented Jul 28, 2015

From my talks with others, I am under the impression that related_objects are not ordered and therefore should do not repeat. That said, they are created as indirect containers via ActiveFedora::Aggregation which does allow for ordering. So we would have to do something to prevent the ordering.

Perhaps they should be created as direct containers.

@escowles
Copy link
Contributor

I'm not sure that using DirectContainers changes anything: if we're using proxies, then you can have multiple proxies referring to the same item, unless we go out of our way to prevent that.

Maybe we need a validator to check whether the item is already in the related_objects list, and reject duplicates?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

4 participants