-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #36 from hbz/rpb-28-hbzIds
Map almaMmsIds to rpbIds for input data with `#983` (RPB-28)
- Loading branch information
Showing
59 changed files
with
1,224 additions
and
1,727 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,4 @@ bulk.ndjson | |
application-log-*.gz | ||
RPB-Export_HBZ_SW.txt | ||
RPB-Export_HBZ_Tit.txt | ||
RPB-Export_HBZ_Tit_hbzIds.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* Copyright 2023 Fabian Steeg, hbz. Licensed under the GPLv2 */ | ||
|
||
package rpb; | ||
|
||
import java.io.IOException; | ||
import java.net.URL; | ||
import java.net.URLConnection; | ||
|
||
import org.metafacture.framework.ObjectReceiver; | ||
import org.metafacture.framework.helpers.DefaultStreamPipe; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
|
||
import play.Logger; | ||
import play.libs.Json; | ||
|
||
/** | ||
* Create a mapping for RPB Allegro export data with hbzIds: map almaMmsId to rpbId. | ||
*/ | ||
public final class MapAlmaToRpb extends DefaultStreamPipe<ObjectReceiver<String>> { | ||
|
||
private String id; | ||
@Override | ||
public void startRecord(String identifier) { | ||
this.id = identifier; | ||
super.startRecord(identifier); | ||
} | ||
@Override | ||
public void literal(String name, String hbzId) { | ||
String almaMmsId = getAlmaMmsId(hbzId); | ||
getReceiver().process(String.format("%s\tRPB%s", almaMmsId, id)); | ||
} | ||
private String getAlmaMmsId(String hbzId) { | ||
String url = "https://test.lobid.org/resources/" + hbzId; | ||
Logger.debug("Trying to get almaMmsId from: " + url); | ||
try { | ||
URLConnection connection = new URL(url).openConnection(); | ||
connection.setRequestProperty("Accept", "application/json"); | ||
connection.connect(); | ||
JsonNode jsonNode = Json.parse(connection.getInputStream()); | ||
Thread.sleep(100); | ||
return jsonNode.get("almaMmsId").textValue(); | ||
} catch (IOException | InterruptedException e) { | ||
e.printStackTrace(); | ||
} | ||
return "#983: " + hbzId; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,72 @@ | ||
{ | ||
"@context" : "http://lobid.org/resources/context.jsonld", | ||
"type" : [ "BibliographicResource", "Article" ], | ||
"rpbId" : "RPB036t0121517", | ||
"id" : "https://lobid.org/resources/RPB036t0121517", | ||
"rpbId" : "RPB107t01147870", | ||
"id" : "https://lobid.org/resources/RPB107t01147870", | ||
"inCollection" : [ { | ||
"id" : "http://lobid.org/resources/HT013494180#!", | ||
"type" : [ "Collection" ], | ||
"label" : "Rheinland-Pfälzische Bibliographie" | ||
} ], | ||
"title" : "Sprendlingens Einwohnerzahl", | ||
"title" : "¬Die¬ Herren von Hainfeld - zur Geschichte e. vorderpfälzischen Adelssitzes im Mittelalter", | ||
"publication" : [ { | ||
"startDate" : "1959", | ||
"startDate" : "1983", | ||
"type" : [ "PublicationEvent" ] | ||
} ], | ||
"subject" : [ { | ||
"id" : "http://purl.org/lobid/rpb#n240400", | ||
"label" : "Platzhalter Schlagwortlabel", | ||
"type" : [ "Concept" ], | ||
"source" : { | ||
"id" : "http://purl.org/lobid/rpb", | ||
"label" : "Systematik der Rheinland-Pfälzischen Bibliographie" | ||
} | ||
}, { | ||
"id" : "http://purl.org/lobid/rpb#n207020", | ||
"label" : "Platzhalter Schlagwortlabel", | ||
"type" : [ "Concept" ], | ||
"source" : { | ||
"id" : "http://purl.org/lobid/rpb", | ||
"label" : "Systematik der Rheinland-Pfälzischen Bibliographie" | ||
} | ||
}, { | ||
"type" : [ "ComplexSubject" ], | ||
"label" : "Hainfeld / Familie | Geschichte 1100-1300", | ||
"componentList" : [ { | ||
"id" : "https://rpb.lobid.org/sw/00Sn01s147870528a", | ||
"label" : "Hainfeld / Familie", | ||
"source" : { | ||
"id" : "http://rpb.lobid.org/sw", | ||
"label" : "RPB-Sachsystematik" | ||
} | ||
}, { | ||
"id" : "https://rpb.lobid.org/sw/00Sn06k1444137a", | ||
"label" : "Geschichte 1100-1300", | ||
"source" : { | ||
"id" : "http://rpb.lobid.org/sw", | ||
"label" : "RPB-Sachsystematik" | ||
} | ||
} ] | ||
} ], | ||
"spatial" : [ { | ||
"id" : "https://rpb.lobid.org/spatial#n33703036", | ||
"label" : "o33703036", | ||
"type" : [ "Concept" ], | ||
"source" : { | ||
"id" : "https://rpb.lobid.org/spatial", | ||
"label" : "RPB-Raumsystematik" | ||
} | ||
} ], | ||
"contribution" : [ { | ||
"agent" : { | ||
"id" : "https://rpb.lobid.org/agent/00Pn01m21445842a", | ||
"label" : "Wagner, Hermann Josef" | ||
"id" : "https://d-nb.info/gnd/11944027X", | ||
"label" : "Müller, Carl Werner / 1931-2018" | ||
}, | ||
"role" : { | ||
"id" : "http://id.loc.gov/vocabulary/relators/aut", | ||
"label" : "Autor/in" | ||
}, | ||
"type" : [ "Contribution" ] | ||
} ], | ||
"bibliographicCitation" : "Heimat am Mittelrhein. - 4 (1959), Nr. 1" | ||
"bibliographicCitation" : "Historischer Verein der Pfalz: Mitteilungen des Historischen Vereins der Pfalz. - 81 (1983), S. 229-271" | ||
} |
Oops, something went wrong.