@Override public Map<String, List<LocalWikidataStatement>> getLocalStatements(Language lang, WikidataEntity.Type type, int id) throws DaoException { lang = getRealLang(lang); WikidataFilter filter = new WikidataFilter.Builder() .withEntityType(type) .withEntityId(id) .build(); Map<String, List<LocalWikidataStatement>> local = new HashMap<String, List<LocalWikidataStatement>>(); for (WikidataStatement st : get(filter)) { LocalWikidataStatement lws = getLocalStatement(lang, st); if (!local.containsKey(lws.getProperty())) { local.put(lws.getProperty(), new ArrayList<LocalWikidataStatement>()); } local.get(lws.getProperty()).add(lws); } return local; }
@Override public Iterable<WikidataStatement> getByValue(String propertyName, WikidataValue value) throws DaoException { Set<Integer> propIds = new HashSet<Integer>(); for (WikidataEntity e : getPropertyByName(propertyName)) { propIds.add(e.getId()); } if (propIds.isEmpty()) { return new ArrayList<WikidataStatement>(); } WikidataFilter filter = new WikidataFilter.Builder() .withPropertyIds(propIds) .withValue(value) .build(); return get(filter); }
@Override public List<WikidataStatement> getStatements(LocalPage page) throws DaoException { int conceptId = upDao.getUnivPageId(page); if (conceptId < 0) { return new ArrayList<WikidataStatement>(); } WikidataFilter filter = new WikidataFilter.Builder() .withEntityType(WikidataEntity.Type.ITEM) .withEntityId(conceptId) .build(); return IteratorUtils.toList(get(filter).iterator()); }
.withEntityId(id) .build(); for (WikidataStatement st : get(filter)) { if (st != null) { entity.getStatements().add(st);
@Override public Map<String, List<LocalWikidataStatement>> getLocalStatements(Language lang, WikidataEntity.Type type, int id) throws DaoException { lang = getRealLang(lang); WikidataFilter filter = new WikidataFilter.Builder() .withEntityType(type) .withEntityId(id) .build(); Map<String, List<LocalWikidataStatement>> local = new HashMap<String, List<LocalWikidataStatement>>(); for (WikidataStatement st : get(filter)) { LocalWikidataStatement lws = getLocalStatement(lang, st); if (!local.containsKey(lws.getProperty())) { local.put(lws.getProperty(), new ArrayList<LocalWikidataStatement>()); } local.get(lws.getProperty()).add(lws); } return local; }
@Override public Iterable<WikidataStatement> getByValue(String propertyName, WikidataValue value) throws DaoException { Set<Integer> propIds = new HashSet<Integer>(); for (WikidataEntity e : getPropertyByName(propertyName)) { propIds.add(e.getId()); } if (propIds.isEmpty()) { return new ArrayList<WikidataStatement>(); } WikidataFilter filter = new WikidataFilter.Builder() .withPropertyIds(propIds) .withValue(value) .build(); return get(filter); }
.withEntityId(id) .build(); for (WikidataStatement st : get(filter)) { if (st != null) { entity.getStatements().add(st);
@Override public List<WikidataStatement> getStatements(LocalPage page) throws DaoException { int conceptId = upDao.getUnivPageId(page); if (conceptId < 0) { return new ArrayList<WikidataStatement>(); } WikidataFilter filter = new WikidataFilter.Builder() .withEntityType(WikidataEntity.Type.ITEM) .withEntityId(conceptId) .build(); return IteratorUtils.toList(get(filter).iterator()); }
@Override public Iterable<WikidataStatement> getByValue(WikidataEntity property, WikidataValue value) throws DaoException { WikidataFilter filter = new WikidataFilter.Builder() .withPropertyId(property.getId()) .withValue(value) .build(); return get(filter); }
@Override public Iterable<WikidataStatement> getByValue(WikidataEntity property, WikidataValue value) throws DaoException { WikidataFilter filter = new WikidataFilter.Builder() .withPropertyId(property.getId()) .withValue(value) .build(); return get(filter); }