/** * Returns true if the given item document lacks a label for at least one of * the languages covered. * * @param itemDocument * @return true if some label is missing */ protected boolean lacksSomeLanguage(ItemDocument itemDocument) { for (int i = 0; i < arabicNumeralLanguages.length; i++) { if (!itemDocument.getLabels() .containsKey(arabicNumeralLanguages[i])) { return true; } } return false; }
/** * Returns true if the given item document lacks a label for at least one of * the languages covered. * * @param itemDocument * @return true if some label is missing */ protected boolean lacksSomeLanguage(ItemDocument itemDocument) { for (int i = 0; i < arabicNumeralLanguages.length; i++) { if (!itemDocument.getLabels() .containsKey(arabicNumeralLanguages[i])) { return true; } } return false; }
Map<String, MonolingualTextValue> labels = aitem.getLabels(); if (labels.size() != 0 && labels.containsKey(langid)) { String frtitle = labels.get(langid).getText();
if (q42 instanceof ItemDocument) { System.out.println("The English name for entity Q42 is " + ((ItemDocument) q42).getLabels().get("en").getText()); if (q8 instanceof ItemDocument) { System.out.println("The French label for entity Q8 is " + ((ItemDocument) q8).getLabels().get("fr").getText() + "\nand its English Wikipedia page has the title " + ((ItemDocument) q8).getSiteLinks().get("enwiki")
@Override public void processItemDocument(ItemDocument itemDocument) { this.itemCount++; // Find the first quantity value for this property, if any: QuantityValue quantityValue = itemDocument .findStatementQuantityValue(numberPropertyId); // If a value was found, compare it to the current maximum: if (quantityValue != null) { this.itemsWithPropertyCount++; BigDecimal numericValue = quantityValue.getNumericValue(); if (this.largestNumberValue == null || numericValue.compareTo(this.largestNumberValue) > 0) { this.largestNumberValue = numericValue; this.largestNumberItem = itemDocument.getEntityId(); MonolingualTextValue label = itemDocument.getLabels().get("en"); if (label != null) { this.largestNumberItemLabel = label.getText(); } else { this.largestNumberItemLabel = this.largestNumberItem .getId(); } } } // Print progress every 100,000 items: if (this.itemCount % 100000 == 0) { printStatus(); } }
@Override public void processItemDocument(ItemDocument itemDocument) { this.itemCount++; // Find the first quantity value for this property, if any: QuantityValue quantityValue = itemDocument .findStatementQuantityValue(numberPropertyId); // If a value was found, compare it to the current maximum: if (quantityValue != null) { this.itemsWithPropertyCount++; BigDecimal numericValue = quantityValue.getNumericValue(); if (this.largestNumberValue == null || numericValue.compareTo(this.largestNumberValue) > 0) { this.largestNumberValue = numericValue; this.largestNumberItem = itemDocument.getEntityId(); MonolingualTextValue label = itemDocument.getLabels().get("en"); if (label != null) { this.largestNumberItemLabel = label.getText(); } else { this.largestNumberItemLabel = this.largestNumberItem .getId(); } } } // Print progress every 100,000 items: if (this.itemCount % 100000 == 0) { printStatus(); } }
public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); }
+ ((ItemDocument) q42).getLabels().get("en").getText()); if (q8 instanceof ItemDocument) { System.out.println("The French label for entity Q8 is " + ((ItemDocument) q8).getLabels().get("fr").getText() + "\nand its English Wikipedia page has the title " + ((ItemDocument) q8).getSiteLinks().get("enwiki")
public ItemDocument filter(ItemDocument item) { return dataObjectFactory.getItemDocument( item.getEntityId(), filterMonoLingualTextValues(item.getLabels().values()), filterMonoLingualTextValues(item.getDescriptions().values()), filterMonoLingualTextValues(flatten(item.getAliases().values())), filterStatementGroups(item.getStatementGroups()), filterSiteLinks(item.getSiteLinks()), item.getRevisionId() ); }
arabicNumeralLanguages.length); for (int i = 0; i < arabicNumeralLanguages.length; i++) { if (!currentItemDocument.getLabels().containsKey( arabicNumeralLanguages[i])) { itemDocumentBuilder.withLabel(numberString,
arabicNumeralLanguages.length); for (int i = 0; i < arabicNumeralLanguages.length; i++) { if (!currentItemDocument.getLabels().containsKey( arabicNumeralLanguages[i])) { itemDocumentBuilder.withLabel(numberString,
MonolingualTextValue label = itemDocument.getLabels().get("en"); if (label != null) { this.genderNames.put(itemDocument.getEntityId(),
MonolingualTextValue label = itemDocument.getLabels().get("en"); if (label != null) { this.genderNames.put(itemDocument.getEntityId(),
/** * Copies an {@link ItemDocument}. * * @param object * object to copy * @return copied object */ public ItemDocument copy(ItemDocument object) { return dataObjectFactory.getItemDocument( copy(object.getEntityId()), copyMonoLingualTextValues(object.getLabels().values()), copyMonoLingualTextValues(object.getDescriptions().values()), copyAliasMap(object.getAliases()), copyStatementGroups(object.getStatementGroups()), copySiteLinks(object.getSiteLinks()), object.getRevisionId()); }
/** * Copies an {@link ItemDocument}. * * @param object * object to copy * @return copied object */ public ItemDocument copy(ItemDocument object) { return dataObjectFactory.getItemDocument( copy(object.getEntityId()), copyMonoLingualTextValues(object.getLabels().values()), copyMonoLingualTextValues(object.getDescriptions().values()), copyAliasMap(object.getAliases()), copyStatementGroups(object.getStatementGroups()), copySiteLinks(object.getSiteLinks()), object.getRevisionId()); }