private String encodeValue(WikidataValue value) { return gson.toJson(value.getJsonValue()); }
private String encodeValue(WikidataValue value) { return gson.toJson(value.getJsonValue()); }
@Override public double score(LocalId candidate, Map<String, String> row, Geometry geometry) throws DaoException { for (WikidataStatement st : wikidataDao.getStatements(candidate.asLocalPage())) { if (st.getProperty() == null || st.getProperty().getId() != COORDINATE_PROPERTY) { continue; } Geometry point = WikiBrainSpatialUtils.jsonToGeometry(st.getValue().getJsonValue().getAsJsonObject()); if (point != null && geometry.contains(point)) { return 1.0; } } return 0.0; } }
@Override public double score(LocalId candidate, Map<String, String> row, Geometry geometry) throws DaoException { for (WikidataStatement st : wikidataDao.getStatements(candidate.asLocalPage())) { if (st.getProperty() == null || st.getProperty().getId() != COORDINATE_PROPERTY) { continue; } Geometry point = WikiBrainSpatialUtils.jsonToGeometry(st.getValue().getJsonValue().getAsJsonObject()); if (point != null && geometry.contains(point)) { return 1.0; } } return 0.0; } }
private boolean storeStatement(TIntSet savedConcepts, LanguageSet langs, WikidataStatement statement) throws DaoException { UniversalPage uPage = wdDao.getUniversalPage(statement.getItem().getId()); if (uPage == null || !uPage.isInLanguageSet(langs, false)){ return false; } int itemId = statement.getItem().getId(); Geometry g = WikiBrainSpatialUtils.jsonToGeometry(statement.getValue().getJsonValue().getAsJsonObject()); if (g == null) { return false; } if (savedConcepts.contains(itemId)) { return false; } savedConcepts.add(itemId); spatialDao.saveGeometry(itemId, Layers.WIKIDATA, RefSys.EARTH, g); miDao.incrementRecords(Geometry.class); return true; } }
private boolean storeStatement(TIntSet savedConcepts, LanguageSet langs, WikidataStatement statement) throws DaoException { UniversalPage uPage = wdDao.getUniversalPage(statement.getItem().getId()); if (uPage == null || !uPage.isInLanguageSet(langs, false)){ return false; } int itemId = statement.getItem().getId(); Geometry g = WikiBrainSpatialUtils.jsonToGeometry(statement.getValue().getJsonValue().getAsJsonObject()); if (g == null) { return false; } if (savedConcepts.contains(itemId)) { return false; } savedConcepts.add(itemId); spatialDao.saveGeometry(itemId, Layers.WIKIDATA, RefSys.EARTH, g); miDao.incrementRecords(Geometry.class); return true; } }