-
Notifications
You must be signed in to change notification settings - Fork 1
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
Additional backend resource GND #46
Labels
enhancement
New feature or request
Comments
We have lobid provider in cocoda-sdk to access GND (see source code): a mapping from Lobid API to JSKOS-API. Possibly related issue: #51 |
Hi All,
below i inserted our java code from antelope to find terms via lobidGnd.
If you need help to get some infos from the german spec, i am happy to help out.
best regards, Kolja
protected static List<String> getLobidGndResults(List<String> requestText) throws Exception {
List<String> results = new ArrayList<>();
String baseUrl = "https://lobid.org/gnd/search?q=preferredName:";
for (String actText : requestText) {
String result = "";
// Encode the search text
String encodedText = URLEncoder.encode(actText, StandardCharsets.UTF_8);
// Create the API request URL
String requestUrl = baseUrl + encodedText + "%20OR%20variantName:" + encodedText + "%20OR%20preferredNameForTheSubjectHeading:"+ encodedText +"&format=json&size=50";
HttpGet request = new HttpGet(new URI(requestUrl));
request.addHeader("content-type", "application/json");
try (CloseableHttpClient httpClient = HttpClients.createDefault();
CloseableHttpResponse response = httpClient.execute(request)) {
result = EntityUtils.toString(response.getEntity());
JSONObject jsonResult = new JSONObject(result);
JSONArray entitiesArray = jsonResult.getJSONArray("member");
// Extract the required fields from the response
JSONArray extractedEntities = new JSONArray();
for (int i = 0; i < entitiesArray.length(); i++) {
JSONObject actEntityObj = entitiesArray.getJSONObject(i);
//System.out.println( actEntityObj.toString() );
String actEntityId = actEntityObj.getString("gndIdentifier");
String actEntityUri = actEntityObj.getString("id");
//String actEntityType = actEntityObj.getString("type");
String actEntityName = actEntityObj.getString("preferredName");
JSONObject extractedEntity = new JSONObject();
extractedEntity.put("id", actEntityId);
extractedEntity.put("URI", actEntityUri);
((extractedEntity)).put("label", actEntityName);
extractedEntity.put("name", actEntityName);
extractedEntity.put("obj", actEntityObj);
extractedEntities.put(extractedEntity);
}
results.add(extractedEntities.toString());
}
}
return results;
}
…________________________________
Von: Jakob Voß ***@***.***>
Gesendet: Dienstag, 11. Februar 2025 15:04:33
An: ts4nfdi/api-gateway
Cc: Bailly, Kolja; Mention
Betreff: Re: [ts4nfdi/api-gateway] Additional backend resource GND (Issue #46)
We have lobid provider<https://github.com/gbv/cocoda-sdk?tab=readme-ov-file#providers> in cocoda-sdk to access GND (see source code<https://github.com/gbv/cocoda-sdk/blob/master/src/providers/lobid-api-provider.js>): a mapping from Lobid API to JSKOS-API. Possibly related issue: #51<#51>
—
Reply to this email directly, view it on GitHub<#46 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5PJDGDYRWLHHYI7ZSX6AZD2PH7PDAVCNFSM6AAAAABVEOXJWSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNJQHEZDANJWGQ>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is possible to access the GND via lobid. The API specifications are listed here: https://lobid.org/gnd/api. Sadly everything there is in German. But it should be possible to translate this via a translation tool or via a LLM.
There are already requests from the groups of RADAR and DiscussData.
Maybe @baillyk from the Antelope project (GitHub, GitLab) could support in the integration of the GND to the API Gateway.
The text was updated successfully, but these errors were encountered: