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

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

Closed
mdlincoln opened this issue Feb 23, 2021 · 11 comments
Closed
Labels
Subject: Linked Data related to linked data. Consider also using metadata or modelling tags. Type: bug identifies a problem in the software with clear steps to reproduce

Comments

@mdlincoln
Copy link
Contributor

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
Copy link
Contributor

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 ™️ line up again.

@mdlincoln
Copy link
Contributor Author

mdlincoln commented Feb 23, 2021

@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
Copy link
Contributor

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 🐛 here.

@mdlincoln
Copy link
Contributor Author

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
Copy link
Member

whikloj commented Feb 24, 2021 via email

@kspurgin
Copy link
Contributor

Testing...

"http:\/\/id.loc.gov\/vocabulary\/relators\/aut":[{"@id":"http:\/\/future.islandora.ca\/ru\/taxonomy\/term\/38?_format=jsonld"}]
  • Unchecked Remove jsonld parameter from @ids in JSONLD Settings.
  • Saved configuration
  • Selected my node in Content and applied Action: Index Node in Triplestore
  • Action indicated success.
  • I still see this in the node's 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.

@whikloj
Copy link
Member

whikloj commented Feb 26, 2021 via email

@seth-shaw-unlv
Copy link
Contributor

seth-shaw-unlv commented Sep 14, 2021

@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
Copy link
Contributor

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

@whikloj
Copy link
Member

whikloj commented Sep 15, 2021

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.

@kstapelfeldt kstapelfeldt added Type: bug identifies a problem in the software with clear steps to reproduce Subject: Linked Data related to linked data. Consider also using metadata or modelling tags. and removed bug labels Sep 25, 2021
@seth-shaw-unlv
Copy link
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Subject: Linked Data related to linked data. Consider also using metadata or modelling tags. Type: bug identifies a problem in the software with clear steps to reproduce
Projects
None yet
Development

No branches or pull requests

6 participants