Skip to content

Commit

Permalink
Merge pull request #290 from tanvi029/schema_upd
Browse files Browse the repository at this point in the history
dataset API schema field upd
  • Loading branch information
pranavrd authored Oct 18, 2023
2 parents ab83347 + ceb7cd9 commit 033cef8
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/main/java/iudx/catalogue/server/database/ElasticClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ public void onSuccess(Response response) {
dataset.put(PROVIDER, provider);
}
if (type.equals("iudx:Resource")) {
if (record.getJsonArray(TYPE).size() > 1) {
String schema =
record.getString("@context")
+ record
.getJsonArray(TYPE)
.getString(1)
.substring(5,
record.getJsonArray(TYPE).getString(1).length());
record.put("schema", schema);
}
record.remove("type");
record.put("resourceId", record.getString("id"));
record.remove("id");
Expand All @@ -179,11 +189,6 @@ public void onSuccess(Response response) {
record.remove("@context");
dataset
.put("schema", schema);
} else {
record.put("schema", "");
record.remove("@context");
dataset
.put("schema", "");
}
if (record.containsKey(LABEL)) {
dataset.put(LABEL, record.getString(LABEL));
Expand Down

0 comments on commit 033cef8

Please sign in to comment.