@Override public WikidataEntity getProperty(int id) throws DaoException { Map<Integer, WikidataEntity> properties = getProperties(); // should be cached! if (properties == null || properties.size() == 0) { return getEntityWithoutCache(WikidataEntity.Type.PROPERTY, id); } else { return properties.get(id); } }
@Override public WikidataEntity getProperty(int id) throws DaoException { Map<Integer, WikidataEntity> properties = getProperties(); // should be cached! if (properties == null || properties.size() == 0) { return getEntityWithoutCache(WikidataEntity.Type.PROPERTY, id); } else { return properties.get(id); } }
@Override public WikidataEntity getProperty(Language language, String name) throws DaoException { name = name.toLowerCase(); for (WikidataEntity entity : getProperties().values()) { String ename = entity.getLabels().get(language); if (ename != null && ename.toLowerCase().equals(name)) { return entity; } } return null; }
@Override public WikidataEntity getProperty(Language language, String name) throws DaoException { name = name.toLowerCase(); for (WikidataEntity entity : getProperties().values()) { String ename = entity.getLabels().get(language); if (ename != null && ename.toLowerCase().equals(name)) { return entity; } } return null; }
public Collection<WikidataEntity> getPropertyByName(String name) throws DaoException { Set<WikidataEntity> matches = new HashSet<WikidataEntity>(); Map<Integer, WikidataEntity> props = getProperties(); for (WikidataEntity e : props.values()) { if (e.getLabels().values().contains(name)) { matches.add(e); continue; } if (e.getAliases().values().contains(name)) { matches.add(e); continue; } } return matches; }
public Collection<WikidataEntity> getPropertyByName(Language language, String name) throws DaoException { List<WikidataEntity> matches = new ArrayList<WikidataEntity>(); Map<Integer, WikidataEntity> props = getProperties(); for (WikidataEntity e : props.values()) { if (e.getAliases().containsKey(language) && e.getAliases().get(language).contains(name)) { matches.add(e); } else if (e.getLabels().containsKey(language) && e.getLabels().get(language).contains(name)) { matches.add(e); } } return matches; }
public Collection<WikidataEntity> getPropertyByName(Language language, String name) throws DaoException { List<WikidataEntity> matches = new ArrayList<WikidataEntity>(); Map<Integer, WikidataEntity> props = getProperties(); for (WikidataEntity e : props.values()) { if (e.getAliases().containsKey(language) && e.getAliases().get(language).contains(name)) { matches.add(e); } else if (e.getLabels().containsKey(language) && e.getLabels().get(language).contains(name)) { matches.add(e); } } return matches; }
public Collection<WikidataEntity> getPropertyByName(String name) throws DaoException { Set<WikidataEntity> matches = new HashSet<WikidataEntity>(); Map<Integer, WikidataEntity> props = getProperties(); for (WikidataEntity e : props.values()) { if (e.getLabels().values().contains(name)) { matches.add(e); continue; } if (e.getAliases().values().contains(name)) { matches.add(e); continue; } } return matches; }