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

Members' uniqueness #198

Open
awead opened this issue Dec 18, 2015 · 0 comments
Open

Members' uniqueness #198

awead opened this issue Dec 18, 2015 · 0 comments

Comments

@awead
Copy link
Contributor

awead commented Dec 18, 2015

I don't know if this is in scope or not, but the use case I'm dealing with is that members of a PCDM object must be unique according to a given property. For example, no two objects can be members of another object if they have the same value for a given property.

Given:

class List < ActiveFedora::Base
  include Hydra::PCDM::ObjectBehavior
end

class ListItem
  include Hydra::PCDM::ObjectBehavior
  property :pref_label, predicate: ::RDF::SKOS.prefLabel, multiple: false
end

Doing something like this should not be allowed:

> list = List.create
> list.members << ListItem.create(pref_label: "Duplicate")
> list.members << ListItem.create(pref_label: "Duplicate")

It might be helpful to have something like:

class List < ActiveFedora::Base
  include Hydra::PCDM::ObjectBehavior
  validate_uniqueness_of_member with: :pref_label
end

But, not sure if that's appropriate or even possible here.

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

No branches or pull requests

1 participant