Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
6a45404
Merge remote-tracking branch 'upstream/develop' into develop
Nov 4, 2020
770680e
Merge remote-tracking branch 'upstream/develop' into develop
Dec 10, 2020
a38f0df
cvm-sp
ekoi Dec 11, 2020
c48df18
cvm-sp temp
ekoi Dec 11, 2020
2868228
cvm-sp temp
ekoi Dec 11, 2020
a55a378
cvm-sp temp
ekoi Dec 11, 2020
db89d30
tmp
ekoi Dec 12, 2020
de12144
tmp
ekoi Dec 12, 2020
74dd56d
tmp
ekoi Dec 12, 2020
53f25b5
Merge remote-tracking branch 'upstream/develop' into develop
Dec 15, 2020
673eef0
uses external js
ekoi Dec 16, 2020
6bc0f17
adding signposting configuration setting
ekoi Jan 12, 2021
879f236
Merge remote-tracking branch 'upstream/develop' into develop
Jan 13, 2021
18ba37c
Merge remote-tracking branch 'upstream/develop' into develop
Jan 14, 2021
3950734
signposting poc from eko
Jan 15, 2021
5abe639
error fix
Jan 15, 2021
3d644d1
move the signposting location in code
Jan 15, 2021
65d69fe
Signposting with MicroSettings cleanup v1
Jan 18, 2021
7345f66
Signposting with MicroSettings cleanup v1 xhtml revert to vanilla
Jan 18, 2021
33fcb95
clean up
Jan 20, 2021
a2e5b64
bug fix and add default file type; TODO: Bug on the baseurl (empty st…
Jan 25, 2021
ddb8780
hide type when do not use default
Jan 25, 2021
f2fb557
set default when no config is set for signposting
Jan 27, 2021
9de4c35
Merge branch 'signposting' of github.com:DANS-KNAW/dataverse into sig…
janvanmansum Jan 28, 2021
1c6fde5
modification according to reviews
Jan 28, 2021
9752c6a
move long json string from code to bunddle
Jan 28, 2021
1c0cbbc
allow empty config on the level 2 profile
Jan 28, 2021
0c40649
Merge branch 'develop' into signposting
janvanmansum Feb 2, 2021
c6d3df2
DD-174 Signposting (#42)
vicding-mi Feb 2, 2021
b441c65
revision based on Herbert feedback
Feb 3, 2021
690c450
coding style cleanup SignpostingResources
Feb 3, 2021
200429a
remove leading comma
Feb 4, 2021
ae21398
fix capitalize with header name
Feb 4, 2021
1211ec2
solve conficts
Feb 12, 2021
2e6deae
DD-174 Signposting (#46)
vicding-mi Feb 18, 2021
65d1ac0
Merge remote-tracking branch 'upstream/develop' into signposting
Feb 19, 2021
545adb0
add items to header when less than maxItems, default license to cc0
Mar 17, 2021
5106574
add items to l1 profile and set default license to cc0
Mar 18, 2021
edf7cc8
use actual file type on l1 profile for items
Mar 18, 2021
d741c14
limit maxAuthors
Mar 19, 2021
17d6450
Merge remote-tracking branch 'upstream/develop' into signposting
Mar 19, 2021
1c25c23
Merge branch 'develop' into signposting
PaulBoon Mar 19, 2021
7e20eae
Merge pull request #58 from PaulBoon/signposting
PaulBoon Mar 19, 2021
891670b
solve conflicts
Mar 19, 2021
ffe7b61
Add Dataset type to landing page, both profile and linkset
Apr 8, 2021
27b2f4e
use configed type instead of string
Apr 12, 2021
0c11ff2
Merge back develop in signposting (#69)
janvanmansum Apr 14, 2021
314f7d1
fix missing author error, note: identity URL is empty sometimes
Apr 19, 2021
ce7f943
create function to get author URL
Apr 19, 2021
e06d9a9
remove num author limit in json
Apr 19, 2021
3f52adc
merged back develop
janvanmansum Apr 23, 2021
300c1e7
revision list 20210511
May 12, 2021
313dae9
Signposting (#59)
vicding-mi May 28, 2021
5ec179a
Resolved conflicts
janvanmansum May 28, 2021
8a53bb6
merging conflicts
May 31, 2021
8c92245
solving conflicts from dans dev
May 31, 2021
15e7f28
Signposting to DANS:signposting branch (#77)
vicding-mi Jun 3, 2021
bb82e32
merge develop from iqss
Jun 9, 2021
1411af0
Merge branch 'signposting' into signposting
janvanmansum Jun 9, 2021
190a0f9
Merge pull request #84 from vicding-mi/signposting
janvanmansum Jun 9, 2021
bd07cb7
Merge remote-tracking branch 'blessed/signposting' into signposting
janvanmansum Jun 9, 2021
5011558
Removed duplicate method
janvanmansum Jun 9, 2021
a656610
Trigger build, to see if Travis succeeds
janvanmansum Jun 9, 2021
ce893a4
Remove unused function
janvanmansum Jun 10, 2021
724e6e4
add release note and skip license link in case of None
Jul 1, 2021
da8f52e
Merge pull request #98 from vicding-mi/signposting
janvanmansum Jul 2, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions doc/release-notes/5962-signposting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Signposting for DV 5.5

This branch adds [Signposting](https://signposting.org/) support to DV 5.5.

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"`.

The configuration is stored as JSON string in the `Bundle.properties` file, key name is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see from code below that this is just a default setting and that there is SignpostingConf setting as well. Minimally, the docs should indicate that it is set-able without editing the Bundle. More deeply - I'm not sure the Bundle is the right place for a default, i.e. it isn't something that should be internationalized. If it is easier to get a default for the whole setting, should it go in the code instead? Or?

`signposting.configuration.SignpostingConf`. Please see a sample configuration below with explaination for each of the
config items.

```json
{
"license": {
"CC0": "https://creativecommons.org/licenses/cc0/"
},
"describedby": {
"doi": "https://doi.org/",
"type": "application/vnd.citationstyles.csl+json"
},
"useDefaultFileType": true,
"defaultFileTypeValue": "https://schema.org/Dataset",
"maxItems": 5,
"maxAuthors": 5
}
```

* The `license` is a `dict` contains the URI for `CC0`. Please be noted that this is a
temporary solution as all the licenses should be given by `multi-license` support once it's merged.
* `describedby` is required by [Signposting](https://signposting.org/). It shows the link to the metadata
which describes the resources that is the origin of the link.
* `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.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -675,12 +675,12 @@
</dependency>
</dependencies>
<build>
<!-- <testResources>
<!-- <testResources>
<testResource>
<directory>${project.basedir}/src/main/resources</directory>
</testResource>
</testResources>-->
<!-- <testResources>
<!-- <testResources>
<testResource>
<directory>${project.basedir}/src/test/java</directory>
<excludes>
Expand Down
31 changes: 21 additions & 10 deletions src/main/java/edu/harvard/iq/dataverse/DatasetPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,8 @@
import edu.harvard.iq.dataverse.search.SearchFilesServiceBean;
import edu.harvard.iq.dataverse.search.SortBy;
import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
import edu.harvard.iq.dataverse.util.ArchiverUtil;
import edu.harvard.iq.dataverse.util.BundleUtil;
import edu.harvard.iq.dataverse.util.FileSortFieldAndOrder;
import edu.harvard.iq.dataverse.util.FileUtil;
import edu.harvard.iq.dataverse.util.JsfHelper;
import edu.harvard.iq.dataverse.util.*;

import static edu.harvard.iq.dataverse.util.JsfHelper.JH;
import static edu.harvard.iq.dataverse.util.StringUtil.isEmpty;

Expand Down Expand Up @@ -85,6 +82,8 @@

import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.file.UploadedFile;

import javax.json.*;
import javax.validation.ConstraintViolation;
import org.apache.commons.httpclient.HttpClient;
//import org.primefaces.context.RequestContext;
Expand Down Expand Up @@ -130,6 +129,7 @@
import edu.harvard.iq.dataverse.search.SearchServiceBean;
import edu.harvard.iq.dataverse.search.SearchUtil;
import edu.harvard.iq.dataverse.search.SolrClientService;
import edu.harvard.iq.dataverse.util.SignpostingResources;
import java.util.Comparator;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.impl.HttpSolrClient;
Expand Down Expand Up @@ -1917,7 +1917,7 @@ private String init(boolean initFull) {
logger.warning("Problem getting rsync script (Command Exception): " + cex.getLocalizedMessage());
}
}

tooLargeToDownload = getSizeOfDatasetNumeric() > settingsWrapper.getZipDownloadLimit();
tooLargeToDownloadOriginal = getSizeOfDatasetOrigNumeric() > settingsWrapper.getZipDownloadLimit();
tooLargeToDownloadArchival = getSizeOfDatasetArchivalNumeric() > settingsWrapper.getZipDownloadLimit();
Expand Down Expand Up @@ -2940,15 +2940,15 @@ public void startDownloadAllOriginal(){
this.setSelectedFiles(workingVersion.getFileMetadatas());
startDownload(true);
}

public void startDownloadSelectedArchival() {
startDownload(false);
}

public void startDownloadSelectedOriginal() {
startDownload(true);
}

private void startDownload(boolean downloadOriginal){
boolean guestbookRequired = isDownloadPopupRequired();
boolean validate = validateFilesForDownload(guestbookRequired, downloadOriginal);
Expand Down Expand Up @@ -3019,15 +3019,15 @@ public boolean validateFilesForDownload(boolean guestbookRequired, boolean downl
setValidateFilesOutcome("Mixed");
return true;
}

if (guestbookRequired) {
setValidateFilesOutcome("GuestbookRequired");
}

return true;

}

private void updateGuestbookResponse (boolean guestbookRequired, boolean downloadOriginal) {
// Note that the GuestbookResponse object may still have information from
// the last download action performed by the user. For example, it may
Expand Down Expand Up @@ -5477,4 +5477,15 @@ public boolean isFileDeleted (DataFile dataFile) {

return dataFile.getDeleted();
}

/**
* Add Signposting
* @return String
*/
public String getSignpostingLinkHeader() {
if (!workingVersion.isReleased())
return "DRAFT";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why DRAFT? is this expected with SignPosting? Or should the header not be included if the dataset is draft?

SignpostingResources sr = new SignpostingResources(systemConfig, workingVersion, settingsService.getValueForKey(SettingsServiceBean.Key.SignpostingConf));
return sr.getLinks();
}
}
13 changes: 13 additions & 0 deletions src/main/java/edu/harvard/iq/dataverse/api/AbstractApiBean.java
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,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 ) {
return Response.ok( Json.createObjectBuilder()
.add("linkset", bld).build() )
.type(MediaType.APPLICATION_JSON)
.build();
}
}

class LazyRef<T> {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/edu/harvard/iq/dataverse/api/Admin.java
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public Response listBuiltinRoles() {
return error(Response.Status.INTERNAL_SERVER_ERROR, e.getMessage());
}
}

@DELETE
@Path("roles/{id}")
public Response deleteRole(@PathParam("id") String id) {
Expand Down
31 changes: 29 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/api/Datasets.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@
import edu.harvard.iq.dataverse.ingest.IngestServiceBean;
import edu.harvard.iq.dataverse.privateurl.PrivateUrl;
import edu.harvard.iq.dataverse.S3PackageImporter;
import static edu.harvard.iq.dataverse.api.AbstractApiBean.error;
import edu.harvard.iq.dataverse.api.dto.RoleAssignmentDTO;
import edu.harvard.iq.dataverse.batch.util.LoggingUtil;
import edu.harvard.iq.dataverse.dataaccess.DataAccess;
Expand All @@ -104,9 +103,13 @@
import edu.harvard.iq.dataverse.util.FileUtil;
import edu.harvard.iq.dataverse.util.SystemConfig;
import edu.harvard.iq.dataverse.util.json.JsonParseException;
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.JsonPrinter.jsonLinkset;
import static edu.harvard.iq.dataverse.util.json.NullSafeJsonBuilder.jsonObjectBuilder;

import edu.harvard.iq.dataverse.util.json.JsonPrinter;
import edu.harvard.iq.dataverse.util.json.NullSafeJsonBuilder;
import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -535,7 +538,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");
Comment on lines +561 to +562
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering about the error responses - not sure I would want users to know whether the config key exists. One option would just be to send no message or "Signposting not enabled". I also wonder if 501/not implemented or 409/conflict be better for the first?
For the second - I assume the getDatasetVersionOrDie (findDatasetOrDie) above will return before you could hit this?

return okLinkset(JsonPrinter.jsonLinkset(new SignpostingResources(systemConfig, dsv, signpostingConf)));
});
}
@GET
@Path("{id}/modifyRegistration")
public Response updateDatasetTargetURL(@PathParam("id") String id ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,12 @@ public enum Key {
* some other metrics app.
*/
MetricsUrl,


/**
* Key for Setting of Signposting
*/
SignpostingConf,

/**
* Number of minutes before a metrics query can be rerun. Otherwise a cached value is returned.
* Previous month dates always return cache. Only applies to new internal caching system (not miniverse).
Expand Down
Loading