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

What the heck does "Map URI to Predicate" mean? #1303

Closed
rosiel opened this issue Oct 11, 2019 · 8 comments
Closed

What the heck does "Map URI to Predicate" mean? #1303

rosiel opened this issue Oct 11, 2019 · 8 comments

Comments

@rosiel
Copy link
Member

rosiel commented Oct 11, 2019

The interface contains a context reaction with:

  • "Map URI to predicate" as the name of the Reaction,
  • "Drupal URI predicate" as the name of the configured variable
  • "The Drupal object's URI will be added to the resource with this predicate. Must use a defined prefix." as the description.

Screen Shot 2019-10-11 at 12 39 45 PM

What it does, which is not clear from the wording, is allow you to configure the Fedora URI to contain a "schema:sameAs" (or some other predicate) pointing to its Drupal URI counterpart.

I propose to change this to:

  • "JSON-LD self-reference" as the name of the Reaction
  • "Self-reference predicate" as the name of the configuration variable
  • "When creating the JSON-LD for this Drupal entity, add a relationship from the entity to itself using this predicate. It must use a defined RDF namespace prefix." as the description.

Wording changes welcome!

I have a pull request ready to open if there's agreement on the wording.

@rosiel
Copy link
Member Author

rosiel commented Oct 14, 2019

Oh... Here's a further complication. This reaction, when executed, will also:

  • test whether the entity in question (the subject of the RDF) is a Media
  • if so, gets the URL of the file.
  • it does this by asking for the media's "Source Field" (apparently this is a drupal config thing - while Media objects can and do use different names for the field that contains "the file this media is about", and since Media objects can have as many fields as you want to give them (including more fields where you can upload "files"), one field is always configured as the Media's "source field").
  • then it swaps out the @id of the RDF graph for the File's URL, making it the file's URI.

This is why the default "self-reference" for media objects (i.e. configured in islandora defaults) uses iana:describedby as the predicate.

Mind blown. This class kind of does two different things, but they're kind of the same thing, and it's confusing to think about and document. I get it.

@whikloj
Copy link
Member

whikloj commented Oct 14, 2019

@rosiel it does that weird behaviour for media so that we properly store the subject of the RDF for a binary as the binary. Instead of the media.

This is a weirdness of Fedora too. If you goto a file in Fedora and look at the RDF (easier using curl) though the URL is http://localhost:808/fcrepo/rest/path/to/file.tiff/fcr:metadata the subject of the RDF is http://localhost:808/fcrepo/rest/path/to/file.tiff

@dannylamb
Copy link
Contributor

@rosiel++ I totally forgot about that little twist.

@bseeger
Copy link
Member

bseeger commented Oct 16, 2019

My .02 (which is somewhat of an aside, as it sounds like this is complicated to change given the above) -- JSON-LD is just a serialization, but the predicate is part of RDF. So naming it JSON-LD is misleading, as it's not JSON-LD, it's an RDF predicate that I8 serializes as JSON-LD (versus, say, turtle, or rdfxml)

@seth-shaw-unlv
Copy link
Contributor

@bseeger, that is true, but (currently) the RDF module doesn't support any of these alters, so we rely on the JSON-LD module for these tasks. So, while the concept is RDF centric, the implementation is JSON-LD centric. I think using JSON-LD in the name is necessary because it emphasizes where this magic happens.

@rosiel
Copy link
Member Author

rosiel commented Oct 17, 2019

Hmm, there's a good point here. I'm not sure if this alter happens before or after "turning the rdf into jsonld" (if such a thing occurs). But I think that distinction is important, if we've designed this to be flexible, the name should say what it actually does. Thanks @bseeger .

@seth-shaw-unlv
Copy link
Contributor

I'm not sure if this alter happens before or after "turning the rdf into jsonld" (if such a thing occurs)

First, the JSON-LD module serializes the entity based on the RDF mapping; i.e. 'turning the rdf into jsonld'. Afterwards the JSON-LD module executes any implementations of hook_jsonld_alter_normalized_array() and it is the islandora_jsonld_alter_normalized_array() that finds and executes any active NormalizerAlterReactions such as the one we are currently discussing. So, yeah, this is very much a JSON-LD thing.

@dannylamb
Copy link
Contributor

Resolved via Islandora/islandora@1e0b98e

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

No branches or pull requests

5 participants