Islandora / documentation

Contains islandora's documentation and main issue queue.
MIT License
104 stars 71 forks source link

Linked agent URIs have format=jsonld query param appended in fedora/triplestore #1766

Closed mdlincoln closed 3 years ago

mdlincoln commented 3 years ago

Running Islandora 8 from the current dev branch of https://github.com/Islandora-Devops/islandora-playbook, I've noticed an error in how Repository Item field_linked_agent gets mapped to RDF in Fedora/blazegraph.

For a given node, we'll have the predicate-object statement

<http://id.loc.gov/vocabulary/relators/aut> | <http://localhost:8000/taxonomy/term/47?_format=jsonld>

However the appended query param ?_format=jsonld means we now have a broken graph - blazegraph sees http://localhost:8000/taxonomy/term/47?_format=jsonld as a different URI than http://localhost:8000/taxonomy/term/47, which is where the rest of the statements about that agent are actually linked.

dannylamb commented 3 years ago

Hi @mdlincoln, you can configure the module to drop the ?_format=jsonld at the end.

image

If you have that box checked and reindex in blazegraph, then everything should :tm: line up again.

mdlincoln commented 3 years ago

@dannylamb I already had that box checked, then went to Content > selected all > Action: Index node in triplestore, and no dice - still seeing that param on the URI in Fedora/blazegraph. Am I reindexing correctly?

dannylamb commented 3 years ago

Yeah, that should do it. Maybe it's a cache issue? Try clearing the caches and then re-index.

If all else fails, go visit the ?_format=jsonld version of one of your objects and check if '@id still has the _format=jsonld at the end.

If everything checks out we may have a :bug: here.

mdlincoln commented 3 years ago

Sadly, the errant param persists after clearing cache and reindexing!

FWIW other node references from field_member_of or taxonomy references for subject have clean URIs. I haven't exhaustively checked all the different fields yet, but so far it's only field_linked_agent that I've seen with the dangling _format param.

whikloj commented 3 years ago

This might not be it, but it is possible you will now have 2 copies, both a Uri with and without the ?format=jsonld. Unless you deleted your blazegraph journal file before reindexing.

On Tue., Feb. 23, 2021, 14:23 Matthew Lincoln, notifications@github.com wrote:

Sadly, the errant param persists after clearing cache and reindexing!

FWIW other node references from field_member_of or taxonomy references for subject have clean URIs. I haven't exhaustively checked all the different fields yet, but so far it's only field_linked_agent that I've seen with the dangling _format param.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Islandora/documentation/issues/1766#issuecomment-784486009, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVZVYJRG4ODNPWK2O25HRLTAQFFDANCNFSM4YCZIMZA .

kspurgin commented 3 years ago

Testing...

"http:\/\/id.loc.gov\/vocabulary\/relators\/aut":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/38?_format=jsonld"}]
"http:\/\/id.loc.gov\/vocabulary\/relators\/aut":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/38?_format=jsonld"}]

This wouldn't be about needing to reindex the taxonomy terms after unchecking the Remove jsonld parameter from @ids box, would it? (I don't see how to do that via the UI)

"http:\/\/id.loc.gov\/vocabulary\/relators\/abr":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/39?_format=jsonld"}]

So that is not it.

Even after unchecking Remove jsonld parameter from @ids and reindexing, I'm seeing several other ids in the JSONLD representation of my node which have ?_format=jsonld at the end, not just the Linked Agent field:

"@id":"http:\/\/future.islandora.ca\/node\/43?_format=jsonld"
"http:\/\/schema.org\/author":[{"@id":"http:\/\/future.islandora.ca\/en\/user\/3?_format=jsonld"}]
"http:\/\/schema.org\/sameAs":[{"@id":"http:\/\/future.islandora.ca\/node\/43?_format=jsonld"}]}

With Remove jsonld parameter from @ids still unchecked, I created a new node and populated Linked Agent.

The JsonLD view still has ?_format=jsonld on the end of some ids.

whikloj commented 3 years ago

Thank you for the step by step description.

I am wondering if this isn't a problem in the json-ld serializer which is not removing the _format tag for the Uri of linked items.

I'll try to test this tomorrow, but if anyone else has a thought please speak up.

Cheers, Jared

On Wed., Feb. 24, 2021, 13:44 kspurgin, notifications@github.com wrote:

Testing...

"http:\/\/id.loc.gov\/vocabulary\/relators\/aut":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/38?_format=jsonld"}]

"http:\/\/id.loc.gov\/vocabulary\/relators\/aut":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/38?_format=jsonld"}]

This wouldn't be about needing to reindex the taxonomy terms after unchecking the Remove jsonld parameter from @ids box, would it? (I don't see how to do that via the UI)

  • With Remove jsonld parameter from @ids still unchecked, I created a new Person taxonomy entry and used it to populate Linked Agent field in my node.
  • Still seeing this:

"http:\/\/id.loc.gov\/vocabulary\/relators\/abr":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/39?_format=jsonld"}]

So that is not it.

Even after unchecking Remove jsonld parameter from @ids and reindexing, I'm seeing several other ids in the JSONLD representation of my node which have ?_format=jsonld at the end, not just the Linked Agent field:

"@id":"http:\/\/future.islandora.ca\/node\/43?_format=jsonld" "http:\/\/schema.org\/author":[{"@id":"http:\/\/future.islandora.ca\/en\/user\/3?_format=jsonld"}] "http:\/\/schema.org\/sameAs":[{"@id":"http:\/\/future.islandora.ca\/node\/43?_format=jsonld"}]}

With Remove jsonld parameter from @ids still unchecked, I created a new node and populated Linked Agent.

The JsonLD view still has ?_format=jsonld on the end of some ids.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Islandora/documentation/issues/1766#issuecomment-785326971, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAVZVYNHOU3ZTH2XPU4GKOLTAVJKNANCNFSM4YCZIMZA .

seth-shaw-unlv commented 3 years ago

@fgeisser21 asked me about this issue on Slack today.

This happens with the typed relationships because of this line in the controlled_access_terms_jsonld_alter_normalized_array hook: https://github.com/Islandora/controlled_access_terms/blob/8.x-1.x/controlled_access_terms.module#L59. We wrote that hook before JSONLD added the option to strip them.

One option is to copy/pasta https://github.com/Islandora/jsonld/blob/a34c4bef6b16beeca3795de9eab8ae05407defef/src/Normalizer/ContentEntityNormalizer.php#L275-L279 into the relevant spot of controlled_access_terms.

Alternatively, we make that bit of code (ContentEntityNormalizer:: getEntityUri) part of a static helper class so we just pass it our Entity and let the JSON-LD module take care of it.

seth-shaw-unlv commented 3 years ago

@whikloj, would you mind weighing in on adding the helper class (or not) as the maintainer of the jsonld module?

whikloj commented 3 years ago

It can only be a static class if you pass both the entity and the current JSON-LD configuration in. Otherwise we need to dependency inject the config to see if we are (or are not) supposed to be adding the ?_format=jsonld.

So we'd have to create a new utility class that injects the configuration manager, but I think that is fine. I'll play around with it a bit.

seth-shaw-unlv commented 3 years ago

Fixed with https://github.com/Islandora/controlled_access_terms/releases/tag/2.0.1