-
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
Enrich JSONLD representations with additional predicate for Drupal URI #768
Comments
🤦♂️ wrong ticket |
Ok, now I'm on the right ticket. I have two directions on this one.
|
The one hook method is...iffy, I think I am in the wrong spot. Probably need a service between the normalizer and encoder to do this. But I was able to make Islandora inject the URL with the chosen predicate of owl:sameAs (which I configured).
|
Here is my work so far on the one hook solution. It gets called for each item, so I need to move where the hook is invoked in jsonld to after the normalizer is totally finished. But this gives an idea of my idea? |
So the two hook method would be adding fake fields after adding those to the fake mapping? Maybe the one hook approach isn't so iffy. We'll have to do something similar to add rdf:types if we want to break away from the one bundle per mapping constraint. But yeah, I'm pickin' up what you're puttin' down. 😃 |
Question folks: if you are already invested in Context module (@mjordan ping ping) or Rules, would it not an option to deal with those extra RDFs properties/types via any of those module by implementing a context aware/rule based implementation here and maybe even at display level? That would allow for much greater flexibility for admin users with no code... Just an idea. |
@DiegoPino 👍 This would definitely play nicely with Context. |
So I have no idea how to do this in Context, can you give me some guidance or any documentation if there is. |
@whikloj can do some research this weekend but i guess @mjordan would be a very good/better-than-me primary source for this. What i know right now is that at least a piece of Context one is built into Drupal 8 in the way of the plugins and reactions can be configured via the UI. https://www.drupal.org/docs/8/api/plugin-api/plugin-contexts and https://www.drupal.org/project/context (says the same) But I don't know enough to be useful 😢 |
Alas, my hands-on experience with Context has not expanded much past 7.x.... but IIRC @dannylamb just opened a PR (which I cannot now find) that included a full Context reaction, which would be a good example to start with. @dannylamb .... can haz link? |
So there is no documentation for Context...that is disappointing. @dannylamb was there a good example you turned to when you started with this stuff? |
Yeah if anyone has a suggestion. I'm not clear if the idea here is now that we are adding a context to the entity or to the normalized array? If its the entity then I guess we also have to make a context to the rdf_mapping? I'm looking at the original Using Context instead of Rules PR, but there is sooooo much in that one I'm having trouble understanding what does what. |
@whikloj if you look in the Context module's The example that I was thinking of is at https://github.com/Islandora-CLAW/islandora/pull/75/files, but if you look at the other PRs listed in https://github.com/Islandora-CLAW/islandora/pulls?utf8=%E2%9C%93&q=is%3Apr+context+is%3Aclosed+context you might find more helpful examples. |
I'll try my best to distill this. You can do this all with a single context reaction. The reaction encompasses both the 'execute' function and a configuration form.
There's some extra structure there, like I'm pointing you to an abstract class that won't be neccessary in your case. You can just make the thing in |
@mjordan @whikloj Oh, and the PR you're looking for was with a Condition, which is mostly similar, except it has a well-defined https://github.com/Islandora-CLAW/islandora/pull/75/files |
@whikloj Me again... I learned by looking through the Context module's source, so here's a good non-CLAW example of using a context reaction like a hook. Here's the reaction, and check its execute, it just returns its own config: https://cgit.drupalcode.org/context/tree/src/Plugin/ContextReaction/Menu.php?h=8.x-1.x Then at the call site, that config is used to mangle a menu link: https://cgit.drupalcode.org/context/tree/src/ContextMenuActiveTrail.php?h=8.x-1.x |
Thanks for the clarification @dannylamb. |
Thanks for all that @dannylamb, this is probably going to be a s&*t show of a PR but I'll give it a try. |
Resolved with 21124f3 |
From https://groups.google.com/forum/#!topic/islandora-dev/WqgmbkLlUUY:
Allow the user to configure a predicate for the Drupal URI in serialized JSONLD. Firing an alter in the jsonld module and implementing the alter in core islandora would be a clean way to achieve this. You'll need to add the predicate to islandora's existing configuration form to expose it to the end user so it can be looked up in islandora's alter implementation.
The text was updated successfully, but these errors were encountered: