-
Notifications
You must be signed in to change notification settings - Fork 71
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
Support additional RDF types based on a configurable field #889
Comments
We should do this in the islandora module, in an alter with a |
Adding to sprint. We'll want this for the agents we create from |
From Spring Kick-off: Resolving this ticket will solve 2 types of problems:
|
Related ticket: #893 |
@seth-shaw-unlv I'm interested in this helping on this if #895 doesn't need all my time. |
So it looks like there's two pieces to this. One is to make a 'compound' field that has the entity reference field plus a role. The other piece is to provide an implementation in the islandora module's jsonld alter to re-write the rdf accordingly. Does that sound about right? Do we want to split this into sub-tickets? |
@dannylamb Yes. This ticket would have a simple list field that allows selecting a type. Then the islandora jsonld alter would re-write the RDF accordingly (type's value). The compound field case is slightly different in that the drop-down subfield modifies the predicate associated with the compound field's value. |
Thinking out loud, @dannylamb can you check my reasoning on this: So, considering how islandora_jsonld_alter_normalized_array is currently setup, we need to add a \Drupal\islandora\ContextReaction\NormalizerAlterReaction that will alter the type attribute based on the value of a field (to be configured) for the passed entity. The condition would be, what, that the entity is of a predetermined content type (configurable in the Context admin)? Am I on the right track? The type predicate is in the normalized array, right? If the above is correct, we could also have a another NormalizerAlterReaction for altering TypedRelation fields. |
@seth-shaw-unlv I think the Condition will be left to the user, but probably something along the lines of picking a content type. We could flesh out something akin to a "has field" condition if we needed one, but we can probably make due with what we've already got for now. I imagine the context reaction would just give you a list of taxonomy term reference fields to choose from, and the user would be allowed to select multiple. Then when actually exectuing, the external uris from terms in those fields would be appended to rdf:type. We'll probably also want to remove whatever predicate it was configured as in the rdf mapping from the jsonld body (if it was configured in the first place). After that we'd have to figure out how to make it work with the TypedRelation fields like we're providing. It should all boil down to where do you scrape out the external uri to append to rdf:type. |
@Natkeeran @seth-shaw-unlv I'm about to assign this to @patdunlavey. Is there anything else either of you have cooking we should know about? |
@dannylamb Sounds like a plan. I've been working on some bits for another project this morning (trying to clear the plate a bit more) and then I can better focus here. I don't think we need to unset the existing |
@seth-shaw-unlv I figured we'd keep that |
Does this module have any potential utility? https://www.drupal.org/project/rdfui (watch the video). Sorry if not, I'm at the bottom end of this learning curve! |
@patdunlavey Also, it is limited to Schema.org (I believe). |
@seth-shaw-unlv ok to close this issue? |
@mjordan, I would like to wait until Islandora/controlled_access_terms#16 is merged before closing it since the PR came out of this issue thread. |
For a given bundle, I would like to define a field that stores one (or more) types that will be included as a typeof property in the RDFa and a @type in the JSON-LD serialization.
For example, in my controlled access terms module I define a Corporate Body bundle with the rdf.mapping config set to use schema:Organization as the type. I would like to add a List field of sub-types (e.g. Organizational Unit, Corporation, and Performing Group) that would be included as additional types.
I tried simply listing the field as a fieldMapping using the type property, but that didn't work as setting the type fields is a separate step from mapping the properties (and the resulting output made all my schema testers throw errors).
Adding it to the RDFa requires implementing a hook_preprocess_node(). I have an example gist that worked in my testing; although it would need to be made configurale. This fix only works for the HTML serialization. JSON-LD populates the
@type
field based on the rdf.mapping (which is what we would expect) and would need to be extended in some other way.The text was updated successfully, but these errors were encountered: