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

Custom predicates with Fedora resources, ref #198 #230

Merged
merged 2 commits into from
Oct 10, 2017
Merged

Conversation

awead
Copy link
Contributor

@awead awead commented Sep 7, 2017

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.

@cjcolvar
Copy link
Member

cjcolvar commented Sep 7, 2017

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

@escowles
Copy link
Contributor

escowles commented Sep 7, 2017

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?

@tpendragon
Copy link
Collaborator

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.

@escowles
Copy link
Contributor

escowles commented Sep 7, 2017

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.

@tpendragon
Copy link
Collaborator

So I think the cleanest solution for that would be to make the API more like schema.predicate_for(resource: resource, property: property) or something.

@awead
Copy link
Contributor Author

awead commented Sep 7, 2017

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.
@tpendragon tpendragon merged commit 056741d into master Oct 10, 2017
@tpendragon tpendragon deleted the fedora-adaptor branch October 10, 2017 20:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants