@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 void save(WikidataStatement item) throws DaoException { insert( item.getId(), item.getItem().getType().code, item.getItem().getId(), item.getProperty().getId(), item.getValue().getTypeName().toLowerCase(), encodeValue(item.getValue()), item.getRank().ordinal() ); }
@Override public WikidataValue visit(GlobeCoordinatesValue value) { return new WikidataValue(type, gsonToPrimitive(jsonValue), jsonValue); }
@Override public Set<Integer> conceptsWithValue(String propertyName, WikidataValue value) throws DaoException { Set<Integer> concepts = new HashSet<Integer>(); for (WikidataStatement st : getByValue(propertyName, value)) { if (st.getItem().getType() == WikidataEntity.Type.ITEM) { concepts.add(st.getItem().getId()); } } return concepts; }
@Override public WikidataEntity next() { fillBuff(); WikidataEntity next = buff; buff = null; return next; }
/** * @param file */ public WikidataDumpParser(File file, LanguageSet languages) { this.file = file; this.languages = languages; this.wdParser = new WikidataParser(); }
public WikidataValue(Type type, Object value, JsonElement jsonValue) { this.type = type; this.typeName = type.toString(); this.value = value; this.jsonValue = jsonValue; }
@Override public Iterator<WikidataEntity> iterator() { return new IteratorImpl(); }
@Override public WikidataEntity getItem(int id) throws DaoException { return getEntityWithoutCache(WikidataEntity.Type.ITEM, id); }
@Override public void save(WikidataStatement item) throws DaoException { insert( item.getId(), item.getItem().getType().code, item.getItem().getId(), item.getProperty().getId(), item.getValue().getTypeName().toLowerCase(), encodeValue(item.getValue()), item.getRank().ordinal() ); }
@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 Set<Integer> conceptsWithValue(String propertyName, WikidataValue value) throws DaoException { Set<Integer> concepts = new HashSet<Integer>(); for (WikidataStatement st : getByValue(propertyName, value)) { if (st.getItem().getType() == WikidataEntity.Type.ITEM) { concepts.add(st.getItem().getId()); } } return concepts; }
@Override public WikidataValue visit(GlobeCoordinatesValue value) { return new WikidataValue(type, gsonToPrimitive(jsonValue), jsonValue); }
@Override public boolean hasNext() { if (buff == null) { fillBuff(); } return (buff != null); }
/** * @param file */ public WikidataDumpParser(File file, LanguageSet languages) { this.file = file; this.languages = languages; this.wdParser = new WikidataParser(); }
public WikidataValue(Type type, Object value, JsonElement jsonValue) { this.type = type; this.typeName = type.toString(); this.value = value; this.jsonValue = jsonValue; }
@Override public WikidataValue visit(QuantityValue value) { return new WikidataValue(type, gsonToPrimitive(jsonValue), jsonValue); }
@Override public WikidataEntity next() { fillBuff(); WikidataEntity next = buff; buff = null; return next; }
@Override public WikidataValue visit(QuantityValue value) { return new WikidataValue(type, gsonToPrimitive(jsonValue), jsonValue); }
@Override public boolean hasNext() { if (buff == null) { fillBuff(); } return (buff != null); }