-
Notifications
You must be signed in to change notification settings - Fork 534
Signposting on Dataverse 5.9 #8424
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
Changes from all commits
6a45404
770680e
a38f0df
c48df18
2868228
a55a378
db89d30
de12144
74dd56d
53f25b5
673eef0
6bc0f17
879f236
18ba37c
3950734
5abe639
3d644d1
65d69fe
7345f66
33fcb95
a2e5b64
ddb8780
f2fb557
9de4c35
1c6fde5
9752c6a
1c0cbbc
0c40649
c6d3df2
b441c65
690c450
200429a
ae21398
1211ec2
2e6deae
65d1ac0
545adb0
5106574
edf7cc8
d741c14
17d6450
1c25c23
7e20eae
891670b
ffe7b61
27b2f4e
0c11ff2
314f7d1
ce7f943
e06d9a9
3f52adc
300c1e7
313dae9
5ec179a
8a53bb6
8c92245
15e7f28
bb82e32
1411af0
190a0f9
bd07cb7
5011558
a656610
ce893a4
724e6e4
0fab268
3d40896
ce8de80
c91f28f
a42eba3
2b7022a
7d25b86
190cb73
1f12893
41abfab
61d14ff
5fe6a8a
149e45a
4a65b4a
a538289
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Signposting for Dataverse | ||
|
|
||
| This branch adds [Signposting](https://signposting.org/) support to Dataverse | ||
|
|
||
| There are 2 Signposting profile levels, level 1 and level 2. In this implementation, | ||
| * level 1 links are shown in | ||
| HTTP header, which can be fetched by `curl -I https://domain/link-to-article`. | ||
| * The level 2 linkset can be fetched by visiting the dedicated linkset page for | ||
| that artifact. The link can be seen in level 1 links with key name `rel="linkset"`. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The term "artifact" might be confusing here. Are we talking about a dataset? |
||
|
|
||
| The configuration is stored as JSON string in the `Bundle.properties` file, key name is | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the config in Bundle.properties? I see elsewhere that @qqmyers has suggested a database setting called :Signposting, which sounds like a better approach to me.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is the config in Bundle.properties? I see elsewhere that @qqmyers has suggested a database setting called :Signposting, which sounds like a better approach to me. |
||
| `signposting.configuration.SignpostingConf`. Please see a sample configuration below with explaination for each of the | ||
| config items. | ||
|
|
||
| ```json | ||
| { | ||
| "useDefaultFileType": true, | ||
| "defaultFileTypeValue": "https://schema.org/Dataset", | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. and again - are there options one might want to choose that are compatible with Signposting?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. starting with |
||
| "maxItems": 5, | ||
| "maxAuthors": 5 | ||
vicding-mi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A related question - is there a reason to not enable signposting? Right now with the entry in Bundle.properties, this feature is always on unless one were to edit that. My sense is that this is not really something people will object to, e.g. we don't make the schema.org info in the pages optional, so if we do end up removing the options based on the questions above, I'm not sure we'd be left with a Bundle or Setting for this.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The signposting cannot be disabled :D The parameters can be set to the preference of the users. We wanted to make it slightly customizable as in the first draft these are not changeable and the level 1 header becomes really messy and difficult to read, even though it is not particularly set for human to read. ;) For example, for now Herbert is ok with a default file type set to
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With the :Signposting setting you're giving people a very easy way to change all of these parameters (or to put '{}' as the value - not sure if that just turns off signposting or breaks the dataset page). In general, I'm OK with leaving in any parameters you think are needed. My concern is really that by exposing these here you're not just making it possible for Herbert to change them but everyone else as well. If I as a Dataverse installation admin change the type from application/vnd.citationstyles.csl+json or use a different filetypevalue than schema.org/Dataset, would I still be 'Signposting-compliant'? The ones that make the most sense to me are the maxItems/maxAuthor ones - a local admin might want to show 10 authors which would still be valid. The rest seem more like things that should be constants in the code, or only read from the properties file if there has to be a way to change them without recompiling code. That might suggest that just having a :Signposting setting that lets you change maxItems/maxAuthors (defaulting to 5 if you can't parse) and doesn't otherwise let you mess-up/disable Signposting overall might be better. As far as I'm concerned, it's up to you whether this makes sense - I doubt many people will even touch the setting since it works by default anyway. |
||
| ``` | ||
|
|
||
| * `useDefaultFileType` and `defaultFileTypeValue` are used in combination to provide extra `Dataset` type to DV | ||
| datasets. `AboutPage` is required by `Signposting`, hence always present in the datasets. Whilst a second type | ||
| could be configured to better reflect the actual scholarly type of the dataset. | ||
| * `maxItems` sets the max number of items/files which will be shown in `level 1` profile. Datasets with | ||
| too many files will not show any file link in `level 1` profile. They will be shown in `level 2` linkset only. | ||
| * `maxAuthors` Same with `maxItems`, `maxAuthors` sets the max number of authors to be shown in `level 1` profile. | ||
| If amount of authors exceeds this value, no link of authors will be shown in `level 1` profile. | ||
|
|
||
| Note: Authors without author link will not be counted nor shown in any profile/linkset. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In addition to a release note, it probably makes sense to have this in the guides (the whole idea that Dataverse supports Signposting level 1 and 2 and some info about what is included or not included (like authors without a URI). I'm not sure where the best place - @pdurbin might be able to suggest (is there a FAIR section already? I see dataverse.org/software-features points to a presentation on FAIR).
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure, please let me know the ideal location, I can add some docs accordingly.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hopefully @pdurbin has a suggestion as to where in the guides would be best. One thing I'll note about the above is that it seems to mix things I can change (e.g. maxAuthors) with info about signposting and fields like AboutPage that I can't change. It might be worthwhile to just give an example level 1 header and then just talk about the parts you might want to change, or at least indicate what is changeable when you list fields.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's no FAIR section but I just created vicding-mi#1 to suggest creating a "Discoverability" page in the Admin Guide. @vicding-mi if you like this, please feel free to merge it and add more docs. Thanks. |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -850,6 +850,19 @@ protected static Response error( Status sts, String msg ) { | |
| .add( "message", msg ).build() | ||
| ).type(MediaType.APPLICATION_JSON_TYPE).build(); | ||
| } | ||
|
|
||
| /** | ||
| * Adding Signposting | ||
| * | ||
| * @param bld | ||
| * @return HTTP OK response which contains the json structure of linkset | ||
| */ | ||
| protected Response okLinkset( JsonArrayBuilder bld ) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A ~style question - is there ever used (now or in the future) except for the Datasets linkset endpoint? If not, would it be simpler to just send an ok(entity, MediaType) from there?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I agree. Instead of a proliferation of "ok" methods like old: return okLinkset(JsonPrinter.jsonLinkset(new SignpostingResources(systemConfig, dsv, signpostingConf))); new: return ok(Json.createObjectBuilder().add("linkset", JsonPrinter.jsonLinkset(new SignpostingResources(systemConfig, dsv, signpostingConf)))); |
||
| return Response.ok( Json.createObjectBuilder() | ||
| .add("linkset", bld).build() ) | ||
| .type(MediaType.APPLICATION_JSON) | ||
| .build(); | ||
| } | ||
| } | ||
|
|
||
| class LazyRef<T> { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,6 +86,8 @@ | |
| import edu.harvard.iq.dataverse.util.json.JSONLDUtil; | ||
| import edu.harvard.iq.dataverse.util.json.JsonLDTerm; | ||
| import edu.harvard.iq.dataverse.util.json.JsonParseException; | ||
| import edu.harvard.iq.dataverse.util.json.JsonPrinter; | ||
| import edu.harvard.iq.dataverse.util.SignpostingResources; | ||
| import edu.harvard.iq.dataverse.search.IndexServiceBean; | ||
| import static edu.harvard.iq.dataverse.util.json.JsonPrinter.*; | ||
| import static edu.harvard.iq.dataverse.util.json.NullSafeJsonBuilder.jsonObjectBuilder; | ||
|
|
@@ -530,7 +532,31 @@ public Response getVersionMetadataBlock( @PathParam("id") String datasetId, | |
| return notFound("metadata block named " + blockName + " not found"); | ||
| }); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Add Signposting | ||
| * @param datasetId | ||
| * @param versionId | ||
| * @param uriInfo | ||
| * @param headers | ||
| * @return | ||
| */ | ||
| @GET | ||
| @Path("{id}/versions/{versionId}/linkset") | ||
| public Response getLinkset( @PathParam("id") String datasetId, @PathParam("versionId") String versionId, @Context UriInfo uriInfo, @Context HttpHeaders headers) { | ||
| if ( ":draft".equals(versionId) ) { | ||
| return badRequest("The :draft version can be viewed"); | ||
| } | ||
| return response( req -> { | ||
| DatasetVersion dsv = getDatasetVersionOrDie(req, versionId, findDatasetOrDie(datasetId), uriInfo, headers); | ||
| String dataverseSiteUrl = systemConfig.getDataverseSiteUrl(); | ||
| String anchor = dataverseSiteUrl + "/dataset.xhtml?persistentId=" + dsv.getDataset().getPersistentURL(); | ||
| String signpostingConf = settingsService.getValueForKey(SettingsServiceBean.Key.SignpostingConf, BundleUtil.getStringFromBundle("signposting.configuration.SignpostingConf")); | ||
| if (signpostingConf.isEmpty()) return notFound("Configuration key for signposting is empty [SignpostingConf]"); | ||
| if (dsv.getId() == null) return notFound("Dataset not found: Id is empty"); | ||
| return okLinkset(JsonPrinter.jsonLinkset(new SignpostingResources(systemConfig, dsv, signpostingConf))); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar question to above - if the end goal is a linkset object containing an array, why not have JsonPrinter create that? Are there current/future use cases where this separation helps? |
||
| }); | ||
| } | ||
| @GET | ||
| @Path("{id}/modifyRegistration") | ||
| public Response updateDatasetTargetURL(@PathParam("id") String id ) { | ||
|
|
||
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.
Would
link-to-datasetmake more sense thanlink-to-article?