-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add profile negotiation for EMM dump data. #1539
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See other comment.
Other than that, LGTM!
Maybe reuse the profileDoc instead of loading it for each document?
We possibly want to use the types of the selected profile in the update stream.
Instead of the KBV types. But we can deal with that separately.
@@ -357,15 +359,29 @@ private static void writeJsonLdLine(Object object, OutputStream os) throws IOExc | |||
os.write("\n".getBytes(StandardCharsets.UTF_8)); | |||
} | |||
|
|||
private static Object wrapDoc(Document doc, Document contextDoc) { | |||
private static Object formatDoc(Document doc, Document contextDoc, Whelk whelk, TargetVocabMapper targetVocabMapper, String profile) { | |||
var context = new ArrayList<>(); | |||
context.add(null); | |||
context.add(contextDoc.getRecordIdentifiers().getFirst()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe that when a profile is selected we should point to that context here.
Same with the first document of the dump. It should be the profile context instead of the system context.
See e.g. @context
https://libris-qa.kb.se/fxql7jqr38b1dkf/data.jsonld?profile=https%3A%2F%2Fid.kb.se%2Fsys%2Fcontext%2Ftarget%2Fsdo-w3c&embellished=false
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good comments! I believe I've addressed the problems now. Take another look, if I got the context-stuff right?
…ct context for profiles.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
This adds profile negotiation for EMM, the same way it exists for normal record GETs in libris (using &profile=..profile url..).