Skip to content

Commit

Permalink
hack fix data missing and optimize query
Browse files Browse the repository at this point in the history
  • Loading branch information
DiaZork committed Jan 28, 2025
1 parent d63e134 commit 4101b28
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -854,23 +854,23 @@ public JSONArray facetOutermostRegions(
JSONObject element = new JSONObject();
String iUri = querySolution.getBinding("instance").getValue().stringValue();
element.put("instance", iUri);
element.put("instanceLabel", this.nutsRegion.get(iUri).name.get(language));
// this is a hack because the data was not fine, can be removed
if (querySolution.getBinding("instance").getValue().stringValue().equals("https://linkedopendata.eu/entity/Q205")) {
if (iUri.equals("https://linkedopendata.eu/entity/Q205")) {
element.put("instanceLabel", this.nutsRegion.get(iUri).name.get(language));
String cUri = "https://linkedopendata.eu/entity/Q7";
element.put("country", cUri);
element.put("countryLabel", this.nutsRegion.get(cUri).name.get(language));
} else if (querySolution.getBinding("instance").getValue().stringValue().equals("https://linkedopendata.eu/entity/Q206")) {
} else if (iUri.equals("https://linkedopendata.eu/entity/Q206")) {
element.put("instanceLabel", "La Réunion");
String cUri = "https://linkedopendata.eu/entity/Q20";
element.put("country", cUri);
element.put("countryLabel", this.nutsRegion.get(cUri).name.get(language));
} else if (querySolution.getBinding("country") != null) {
element.put("instanceLabel", this.nutsRegion.get(iUri).name.get(language));
String cUri = querySolution.getBinding("country").getValue().stringValue();
element.put("country", cUri);
element.put("countryLabel", this.nutsRegion.get(cUri).name.get(language));

}

result.add(element);
}
return result;
Expand Down

0 comments on commit 4101b28

Please sign in to comment.