Skip to content

Commit 739052f

Browse files
qqmyerspdurbin
andauthored
IQSS/8914 COAR compliant LDN messaging (#10490)
* HDC 3b 1.5 initial update * add workflow settings to main list per qa * start adding default bestID * replace system.out.println call * Improve default compound field handling and some reformatting * add template custom instructions info * get blocks from metadataroot * fix parsing to match spec/dash msg * use getString for 'Relationship', revert other changes * temporarily drop name/type in display * misplaced } * Add callback loop and make display tolerant wrt name/type being found * add fields missing in https://notify.coar-repositories.org/scenarios/10/ * debugging * added logging/switched to info for HDC debugging * merge issues * updates to send context, use as namespace, use relationType, DASH-NRS * doc updates * note some ToDos * New format has strings, not objects with @id * add space to fix link * more doc tweaks * refactor, use JVMSettings, add tests, add superusers only flag * refactor wf step - name change, multiple targets, gen. improvements prioritize publicationIDNumber field over url, support all IDTypes if they provide URIs, check DOIs and Handles for any form, including raw, fix logic for other fields, check for URI form in all cases, handle null results, ... * drop lower case start to DataCite relation types, use constants * test fixes, use COAR step announcement builder * don't autofollow redirect, handle more redirect codes * get absolute redirect url, fix signposting parsing * remove overloaded method (failing in xhtml) * cleanup, fine logging * info to fine * doc updates * Changes per review * Apply suggestions from code review Co-authored-by: Philip Durbin <[email protected]> * typo * add IT tests to list * null bug fix, refactor tests so that allowed hosts can be mocked * update docs per QA * missing / --------- Co-authored-by: Philip Durbin <[email protected]>
1 parent b8f5c1e commit 739052f

25 files changed

+1293
-488
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
### Support for COAR Notify Relationship Announcement
2+
3+
Dataverse now supports sending and receiving [Linked Data Notification ](https://www.w3.org/TR/ldn/) messages involved in the
4+
[COAR Notify Relationship Announcement Workflow](https://coar-notify.net/catalogue/workflows/repository-relationship-repository/).
5+
6+
Dataverse can send messages to configured repositories announcing that a dataset has a related publication (as defined in the dataset metadata). This may be done automatically upon publication or triggered manually by a superuser. The receiving repository may do anything with the message, with the default expectation being that the repository will create a backlink from the publication to the dataset (assuming the publication exists in the repository, admins agree the link makes sense, etc.)
7+
8+
Conversely, Dataverse can receive notices from other configured repositories announcing relationships between their publications and datasets. If the referenced dataset exists in the Dataverse instance, a notification will be sent to users who can publish the dataset, or, optionally, only superusers who can publish the dataset. They can then decide whether to create a backlink to the publication in the dataset metadata.
9+
10+
(Earlier releases of Dataverse had experimental support in this area that was based on message formats defined prior to finalization of the COAR Notify specification for relationship announcements.)
11+
12+
#### New Settings/JVM Options
13+
14+
Configuration for sending messages involves specifying the
15+
:COARNotifyRelationshipAnnouncementTargets and :COARNotifyRelationshipAnnouncementTriggerFields
16+
17+
Configuration to receive messages involves specifying
18+
DATAVERSE_LDN_ALLOWED_HOSTS (dataverse.ldn.allowed-hosts)
19+
20+
Notifications are sent by default to users who can publish a dataset. The option below can be used to restrict notifications to superusers who can publish the dataset.
21+
22+
DATAVERSE_COAR_NOTIFY_RELATIONSHIP_ANNOUNCEMENT_NOTIFY_SUPERSUSERS_ONLY
23+

doc/sphinx-guides/source/api/linkeddatanotification.rst

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
Linked Data Notification API
22
============================
33

4-
Dataverse has a limited, experimental API implementing a Linked Data Notification inbox allowing it to receive messages indicating a link between an external resource and a Dataverse dataset.
4+
Dataverse has an API implementing a Linked Data Notification (LDN) inbox allowing it to receive messages implementing the `COAR Notify Relationship Announcement <https://coar-notify.net/catalogue/workflows/repository-relationship-repository/>`_ indicating a link between an external resource and a Dataverse dataset.
5+
6+
Dataverse has a related capability to send COAR Notify Relationship Announcement messages, automatically upon publication or manually. See the :doc:`/developers/workflows` section of the Guides.
7+
58
The motivating use case is to support a use case where Dataverse administrators may wish to create back-links to the remote resource (e.g. as a Related Publication, Related Material, etc.).
69

7-
Upon receipt of a relevant message, Dataverse will create Announcement Received notifications for superusers, who can edit the dataset involved. (In the motivating use case, these users may then add an appropriate relationship and use the Update Curent Version publishing option to add it to the most recently published version of the dataset.)
10+
Upon receipt of a relevant message, Dataverse will create Announcement Received notifications for users who can edit the dataset involved. Notifications can be restricted to superusers who can publish the dataset as described below. (In the motivating use case, these superusers may then add an appropriate relationship and use the Update Curent Version publishing option to add it to the most recently published version of the dataset.)
11+
12+
The ``dataverse.ldn.allowed-hosts`` JVM option is a comma-separated list of hosts from which Dataverse will accept and process messages. By default, no hosts are allowed. ``*`` can be used in testing to indicate all hosts are allowed.
813

9-
The ``:LDNMessageHosts`` setting is a comma-separated whitelist of hosts from which Dataverse will accept and process messages. By default, no hosts are allowed. ``*`` can be used in testing to indicate all hosts are allowed.
14+
The ``dataverse.ldn.coar-notify.relationship-announcement.notify-superusers-only`` JVM option can be set to ``true`` to restrict notifications to superusers only (those who can publish the dataset). The default is to notify all users who can publish the dataset.
1015

1116
Messages can be sent via POST, using the application/ld+json ContentType:
1217

@@ -15,10 +20,12 @@ Messages can be sent via POST, using the application/ld+json ContentType:
1520
export SERVER_URL=https://demo.dataverse.org
1621
1722
curl -X POST -H 'ContentType:application/ld+json' $SERVER_URL/api/inbox --upload-file message.jsonld
23+
1824
19-
The supported message format is described by `our preliminary specification <https://docs.google.com/document/d/1dqj8_vEcIBeyDIZCaPQvp0FM1eSGO_5CSNCdXOpoUz0/edit?usp=sharing>`_. The format is expected to change in the near future to match the standard for relationship announcements being developed as part of `the COAR Notify Project <https://notify.coar-repositories.org/>`_.
25+
The supported message format is described by `the COAR Notify Relationship Announcement specification <https://coar-notify.net/catalogue/workflows/repository-relationship-repository/2/>`_.
2026

21-
An example message is shown below. It indicates that a resource with the name "An Interesting Title" exists and "IsSupplementedBy" the dataset with DOI https://doi.org/10.5072/FK2/GGCCDL. If this dataset is managed in the receiving Dataverse, a notification will be sent to user with the relevant permissions (as described above).
27+
An example message is shown below. It indicates that a resource in the "Harvard DASH" test server has, as a "supplement", the dataset with DOI doi:10.5074/FKNOAHNQ.
28+
If this dataset is managed in the receiving Dataverse, a notification will be sent to user with the relevant permissions (as described above).
2229

2330
.. code:: json
2431
@@ -27,39 +34,44 @@ An example message is shown below. It indicates that a resource with the name "A
2734
"https://www.w3.org/ns/activitystreams",
2835
"https://purl.org/coar/notify"
2936
],
30-
"id": "urn:uuid:94ecae35-dcfd-4182-8550-22c7164fe23f",
3137
"actor": {
32-
"id": "https://research-organisation.org/dspace",
33-
"name": "DSpace Repository",
38+
"id": "https://harvard-dash.staging.4science.cloud",
39+
"name": "Harvard DASH",
3440
"type": "Service"
3541
},
3642
"context": {
37-
"IsSupplementedBy":
38-
{
39-
"id": "http://dev-hdc3b.lib.harvard.edu/dataset.xhtml?persistentId=doi:10.5072/FK2/GGCCDL",
40-
"ietf:cite-as": "https://doi.org/10.5072/FK2/GGCCDL",
41-
"type": "sorg:Dataset"
42-
}
43+
"id": "https://harvard-dash.staging.4science.cloud/handle/1/42718322",
44+
"ietf:cite-as": "https://harvard-dash.staging.4science.cloud/handle/1/42718322",
45+
"ietf:item": {
46+
"id": "https://harvard-dash.staging.4science.cloud/bitstreams/e2ae80a1-35e5-411b-9ef1-9175f6cccf23/download",
47+
"mediaType": "application/pdf",
48+
"type": [
49+
"Article",
50+
"sorg:ScholarlyArticle"
51+
]
52+
},
53+
"type": "sorg:AboutPage"
4354
},
55+
"id": "urn:uuid:3c933c09-c246-473d-bea4-674db168cfee",
4456
"object": {
45-
"id": "https://research-organisation.org/dspace/item/35759679-5df3-4633-b7e5-4cf24b4d0614",
46-
"ietf:cite-as": "https://research-organisation.org/authority/resolve/35759679-5df3-4633-b7e5-4cf24b4d0614",
47-
"sorg:name": "An Interesting Title",
48-
"type": "sorg:ScholarlyArticle"
57+
"as:object": "doi: 10.5074/FKNOAHNQ",
58+
"as:relationship": "http://purl.org/vocab/frbr/core#supplement",
59+
"as:subject": "https://harvard-dash.staging.4science.cloud/handle/1/42718322",
60+
"id": "urn:uuid:0851f805-c52f-4d0b-81ac-a07e99c33e20",
61+
"type": "Relationship"
4962
},
5063
"origin": {
51-
"id": "https://research-organisation.org/dspace",
52-
"inbox": "https://research-organisation.org/dspace/inbox/",
64+
"id": "https://harvard-dash.staging.4science.cloud",
65+
"inbox": "https://harvard-dash.staging.4science.cloud/server/ldn/inbox",
5366
"type": "Service"
5467
},
5568
"target": {
56-
"id": "https://research-organisation.org/dataverse",
57-
"inbox": "https://research-organisation.org/dataverse/inbox/",
69+
"id": "http://ec2-3-238-245-253.compute-1.amazonaws.com/",
70+
"inbox": "http://ec2-3-238-245-253.compute-1.amazonaws.com/api/inbox",
5871
"type": "Service"
5972
},
6073
"type": [
6174
"Announce",
62-
"coar-notify:ReleaseAction"
75+
"coar-notify:RelationshipAction"
6376
]
6477
}
65-

doc/sphinx-guides/source/api/native-api.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8241,7 +8241,7 @@ Get details of a workflow with a given id::
82418241
82428242
GET http://$SERVER/api/admin/workflows/$id
82438243
8244-
Add a new workflow. Request body specifies the workflow properties and steps in JSON format.
8244+
Add a new workflow. Request body specifies the workflow properties and steps in JSON format. Specifically, the body of the message should be a JSON Object with a String "name" for the workflow and a "steps" JSON Array containing a JSON Object per workflow step. (See :doc:`/developers/workflows` for the exiting steps and their required JSON representations.)
82458245
Sample ``json`` files are available at ``scripts/api/data/workflows/``::
82468246
82478247
POST http://$SERVER/api/admin/workflows

doc/sphinx-guides/source/developers/workflows.rst

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -202,30 +202,30 @@ Note - the example step includes two settings required for any archiver, three (
202202
}
203203
204204
205-
ldnannounce
206-
+++++++++++
205+
coarNotifyRelationshipAnnouncement
206+
++++++++++++++++++++++++++++++++++
207207

208-
An experimental step that sends a Linked Data Notification (LDN) message to a specific LDN Inbox announcing the publication/availability of a dataset meeting certain criteria.
208+
A step that sends a `COAR Notify Relationship Announcement <https://coar-notify.net/catalogue/workflows/repository-relationship-repository/>`_ message, using the `Linked Data Notification (LDN) <https://www.w3.org/TR/ldn/>`_ message standard,
209+
to a specific set of LDN Inboxes announcing a relationship between a newly published/available dataset and an external resource (e.g. one managed by the recipient).
209210

210211
The two parameters are
211-
* ``:LDNAnnounceRequiredFields`` - a list of metadata fields that must exist to trigger the message. Currently, the message also includes the values for these fields but future versions may only send the dataset's persistent identifier (making the receiver responsible for making a call-back to get any metadata).
212-
* ``:LDNTarget`` - a JSON object containing an ``inbox`` key whose value is the URL of the target LDN inbox to which messages should be sent, e.g. ``{"id": "https://dashv7-dev.lib.harvard.edu","inbox": "https://dashv7-api-dev.lib.harvard.edu/server/ldn/inbox","type": "Service"}`` ).
213-
214-
The supported message format is desribed by `our preliminary specification <https://docs.google.com/document/d/1dqj8_vEcIBeyDIZCaPQvp0FM1eSGO_5CSNCdXOpoUz0/edit?usp=sharing>`_. The format is expected to change in the near future to match the standard for relationship announcements being developed as part of `the COAR Notify Project <https://notify.coar-repositories.org/>`_.
212+
* ``:COARNotifyRelationshipAnnouncementTriggerFields`` - a list of metadata field types that can trigger messages. Separate messages will be sent for each field (whether of the same type or not).
213+
* ``:COARNotifyRelationshipAnnouncementTargets`` - a JSON Array of JSON objects containing ``id``, ``inbox``, and ``type`` fields as required by the `COAR Notify Relationship Announcement specification <https://coar-notify.net/catalogue/workflows/repository-relationship-repository/2/>`_ .
214+
The ``inbox`` value should be the full URL of the target LDN inbox to which messages should be sent, e.g. ``{"id": "https://dashv7-dev.lib.harvard.edu","inbox": "https://dashv7-api-dev.lib.harvard.edu/server/ldn/inbox","type": ["Service"]}`` ).
215215

216216

217217
.. code:: json
218218
219219
220220
{
221221
"provider":":internal",
222-
"stepType":"ldnannounce",
222+
"stepType":"coarNotifyRelationshipAnnouncement",
223223
"parameters": {
224-
"stepName":"LDN Announce"
224+
"stepName":"COAR Notify Relationship Announcement"
225225
},
226226
"requiredSettings": {
227-
":LDNAnnounceRequiredFields": "string",
228-
":LDNTarget": "string"
227+
":COARNotifyRelationshipAnnouncementTriggerFields": "string",
228+
":COARNotifyRelationshipAnnouncementTargets": "string"
229229
}
230230
}
231231

doc/sphinx-guides/source/installation/config.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3716,7 +3716,7 @@ Experimental. See :doc:`/developers/search-services`.
37163716
.. _dataverse.cors:
37173717

37183718
CORS Settings
3719-
-------------
3719+
+++++++++++++
37203720

37213721
The following settings control Cross-Origin Resource Sharing (CORS) for your Dataverse installation.
37223722

@@ -3798,6 +3798,23 @@ Example: ``dataverse.api.mdc.min-delay-ms=100`` (enforces a minimum 100ms delay
37983798

37993799
Can also be set via any `supported MicroProfile Config API source`_, e.g. the environment variable ``DATAVERSE_API_MDC_MIN_DELAY_MS``.
38003800

3801+
.. dataverse.ldn
3802+
3803+
Linked Data Notifications (LDN) Allowed Hosts
3804+
+++++++++++++++++++++++++++++++++++++++++++++
3805+
3806+
Dataverse supports receiving LDN notifications via the /api/inbox endpoint. The dataverse.ldn.allowed-hosts allows you to specify the list of host IP addresses from which LDN notifications can be received, or ``*`` to receive messages from anywhere.
3807+
3808+
Example: ``dataverse.ldn.allowed-hosts=*``
3809+
3810+
COAR Notify Relationship Announcement Notify Superusers Only
3811+
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3812+
3813+
When Dataverse receives an LDN message conforming to the COAR Notify Relationship Announcement format and the message is about a dataset hosted in the installation, Dataverse will send an notification to users who have permission to publish the dataset.
3814+
This can instead be restricted to only superusers who can publish the dataset using this option.
3815+
3816+
Example: ``dataverse.coar-notify.relationship-announcement.notify-superusers-only=true``
3817+
38013818
.. _feature-flags:
38023819

38033820
Feature Flags
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"name": "COAR Notify Relationship Announcement workflow",
3+
"steps": [
4+
{
5+
"provider":":internal",
6+
"stepType":"coarNotifyRelationshipAnnouncement",
7+
"parameters": {
8+
"stepName":"LDN Announce"
9+
},
10+
"requiredSettings": {
11+
":COARNotifyRelationshipAnnouncementTriggerFields": "string",
12+
":COARNotifyRelationshipAnnouncementTargets": "string"
13+
}
14+
}
15+
]
16+
}

scripts/api/data/workflows/internal-ldnannounce-workflow.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/main/java/edu/harvard/iq/dataverse/MailServiceBean.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,9 @@ public String getMessageTextBasedOnNotification(UserNotification userNotificatio
737737
Object[] paramArrayDatasetMentioned = {
738738
userNotification.getUser().getName(),
739739
BrandingUtil.getInstallationBrandName(),
740-
citingResource.getString("@type"),
740+
citingResource.getString("@type", "External Resource"),
741741
citingResource.getString("@id"),
742-
citingResource.getString("name"),
742+
citingResource.getString("name", citingResource.getString("@id")),
743743
citingResource.getString("relationship"),
744744
systemConfig.getDataverseSiteUrl(),
745745
dataset.getGlobalId().toString(),

0 commit comments

Comments
 (0)