Skip to content

Commit c010e0d

Browse files
authored
Merge pull request #226 from julian-schneider/update-publisso-conversion
Update "identifier" and "@id" creation
2 parents 0544a18 + 7a06bac commit c010e0d

1 file changed

Lines changed: 48 additions & 29 deletions

File tree

middleware/scripts/publiso_conversor.jq

Lines changed: 48 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,59 @@
1-
..[] | {
1+
.[] | {
22
"@context": {
33
"@language": "en",
44
"@vocab":"https://schema.org/"},
55
"@type": "Dataset",
6-
"@id": ("https://doi.org/" + .doi),
6+
"@id":
7+
(if has("doi")
8+
then "https://doi.org/" + .doi
9+
else "https://repository.publisso.de/resource/" + .["@id"]
10+
end),
711
"name": (if has("title") then (.title[]) else null end),
812
"alternativeHeadline": (if has("alternative") then .alternative[0] else null end),
913
"description": (if has("description") then (.description[]) else null end),
10-
"identifier": (if has("doi") then (.doi | {"@type":"PropertyValue", "value":., "propertyID": "https://registry.identifiers.org/registry/doi", "url": ("https://doi.org/" + .)}) else null end),
11-
"creator":
12-
[
13-
14-
(if has("creator") then
15-
(.creator[]
16-
| {
17-
"@type": "Person",
18-
"familyName": (.prefLabel | split(", ")[0]),
19-
"givenName": (.prefLabel | split(", ")[1: ] | join(" ")),
20-
"identifier": ."@id"
14+
"identifier": ([
15+
(if has("doi") then
16+
{
17+
"@type": "PropertyValue",
18+
"propertyID": "https://registry.identifiers.org/registry/doi",
19+
"value": .doi,
20+
"url": ("https://doi.org/" + .doi)
21+
}
22+
else empty end),
23+
{
24+
"@type": "PropertyValue",
25+
"propertyID": "frl-internal",
26+
"value": .["@id"],
27+
"url": ("https://repository.publisso.de/resource/" + .["@id"])
2128
}
22-
)
23-
else null end)
24-
],
29+
]),
30+
31+
"creator":
32+
[
33+
(if has("creator") then
34+
(.creator[]
35+
| {
36+
"@type": "Person",
37+
"familyName": (.prefLabel | split(", ")[0]),
38+
"givenName": (.prefLabel | split(", ")[1: ] | join(" ")),
39+
"identifier": ."@id"
40+
}
41+
)
42+
else null end)
43+
],
2544
"contributor":
2645
[
27-
(if has("contributor") then
28-
(.contributor[]
29-
| {
30-
"@type": "Person",
31-
"familyName": (.prefLabel | split(", ")[0]),
32-
"givenName": (.prefLabel | split(", ")[1: ] | join(" ")),
33-
"identifier": ."@id"
34-
}
35-
)
36-
else null end)
37-
],
46+
(if has("contributor") then
47+
(.contributor[]
48+
| {
49+
"@type": "Person",
50+
"familyName": (.prefLabel | split(", ")[0]),
51+
"givenName": (.prefLabel | split(", ")[1: ] | join(" ")),
52+
"identifier": ."@id"
53+
}
54+
)
55+
else null end)
56+
],
3857
"sourceOrganization":
3958
[
4059
(if has("institution") then (.institution[] | {"@type":"Organization", "@id": ."@id", "name": .prefLabel}) else null end)
@@ -46,7 +65,7 @@
4665
(if has("ddc") then (.ddc[] | {"@type":"DefinedTerm", "name": .prefLabel, "identifier": ."@id", "inDefinedTermSet": "https://www.oclc.org/en/dewey.html"}) else null end),
4766
(if has("subject") then (.subject[] | {"@type":"DefinedTerm", "name": .prefLabel, "identifier": ."@id"}) else null end)
4867
],
49-
"measurementTechnique":
68+
"measurementTechnique":
5069
[
5170
(if has("dataOrigin") then (.dataOrigin[] | {"@type":"DefinedTerm", "name": .prefLabel, "identifier": ."@id"}) else null end)
5271
],
@@ -56,7 +75,7 @@
5675
],
5776
"funding":
5877
[
59-
(if has("joinedFunding") then (.joinedFunding[] | {"@type":"Grant", "name": .fundingProgramJoined, "funder": .fundingJoined | {"@type":"Organization", "@id": ."@id", "name": .prefLabel}}) else (if has("fundingProgram") then (.fundingProgram[] | {"@type":"Grant", "name": .}) else null end) end)
78+
(if has("joinedFunding") then (.joinedFunding[] | {"@type":"Grant", "name": .fundingProgramJoined, "funder": .fundingJoined | {"@type":"Organization", "@id": ."@id", "name": .prefLabel}}) else (if has("fundingProgram") then (.fundingProgram[] | {"@type":"Grant", "name": .}) else null end) end)
6079
],
6180
"distribution":
6281
[

0 commit comments

Comments
 (0)