-
Notifications
You must be signed in to change notification settings - Fork 20
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
Custom predicates with Fedora resources, ref #198 #230
Conversation
Since the predicate mapping is adapter-wide, will there ever be an issue where different models want to use different predicates for the same property name? It seems like it might happen especially with community developed models for different mediums (book, newspaper, AV, etc.) |
I agree with @cjcolvar's concern about using an adapter-wide schema. Maybe the model could have an optional custom schema attached to it? Then the resource converter could check if the model's schema has a mapping and fall back on the adapter's schema if not? |
I'm curious why there's a concern about having an adapter-accessible schema? Rather than bind something as concrete as a predicate name to a model (which would mean you couldn't have two RDF representations of the same object), you should be able to get around the issue with either a schema which varies its #fetch response depending on the model you're ingesting (might need to alter the schema interface to support this) or an adapter which chooses a schema based on the model and then delegates down. |
I'd be fine with a fetch method that considered the model and property name — my main concern is that different models be able to have the same property name with different predicates. |
So I think the cleanest solution for that would be to make the API more like |
I agree with @cjcolvar and it would be nice to be able to have different predicate mappings for the same resource. |
Valkyrie was making up predicates when persisting attributes to Fedora. We needed a way to provide a predicate for each attribute in the resource. Fedora's metadata adapter will accept a hash as a schema and use any defined predicate for a given term. If no predicate is defined, the current default one will be used. Custom schemas must be provided when initializing the metadata adapter in config/initializers/valkyrie.rb.
e079b86
to
41069c4
Compare
Valkyrie was making up predicates when persisting attributes to Fedora.
We needed a way to provide a predicate for each attribute in the
resource.
Fedora's metadata adapter will accept a hash as a schema and use any
defined predicate for a given term. If no predicate is defined, the
current default one will be used.
Custom schemas must be provided when initializing the metadata adapter
in config/initializers/valkyrie.rb.