@Override public void processItemDocument(ItemDocument itemDocument) { if (itemDocument.hasStatement("P1181")) { if (lacksSomeLanguage(itemDocument)) { addLabelForNumbers(itemDocument.getEntityId()); } else { System.out.println("*** Labels already complete for " + itemDocument.getEntityId().getId()); } } // else: ignore items that have no numeric value }
@Override public void processItemDocument(ItemDocument itemDocument) { if (itemDocument.hasStatement("P1181")) { if (lacksSomeLanguage(itemDocument)) { addLabelForNumbers(itemDocument.getEntityId()); } else { System.out.println("*** Labels already complete for " + itemDocument.getEntityId().getId()); } } // else: ignore items that have no numeric value }
/** * Returns a human-readable string representation of the given object. * * @see java.lang.Object#toString() * @param o * the object to represent as string * @return a string representation of the object */ public static String toString(ItemDocument o) { StringBuilder sb = new StringBuilder(); sb.append("==ItemDocument ").append(o.getEntityId().getIri()); sb.append(" (r").append(o.getRevisionId()).append(") "); sb.append("==").append(toStringForTermedDocument(o)); sb.append(toStringForStatementDocument(o)); sb.append("* Site links: "); boolean first = true; SortedSet<String> siteKeys = new TreeSet<>(o.getSiteLinks() .keySet()); for (String key : siteKeys) { if (first) { first = false; } else { sb.append("; "); } sb.append(toString(o.getSiteLinks().get(key))); } return sb.toString(); }
/** * Returns a human-readable string representation of the given object. * * @see java.lang.Object#toString() * @param o * the object to represent as string * @return a string representation of the object */ public static String toString(ItemDocument o) { StringBuilder sb = new StringBuilder(); sb.append("==ItemDocument ").append(o.getEntityId().getIri()); sb.append(" (r").append(o.getRevisionId()).append(") "); sb.append("==").append(toStringForTermedDocument(o)); sb.append(toStringForStatementDocument(o)); sb.append("* Site links: "); boolean first = true; SortedSet<String> siteKeys = new TreeSet<>(o.getSiteLinks() .keySet()); for (String key : siteKeys) { if (first) { first = false; } else { sb.append("; "); } sb.append(toString(o.getSiteLinks().get(key))); } return sb.toString(); }
@Override public void processItemDocument(ItemDocument itemDocument) { for (String propertyId : integerProperties) { if (hasPlusMinusOneValues(itemDocument .findStatementGroup(propertyId))) { fixIntegerPrecisions(itemDocument.getEntityId(), propertyId); } // else: ignore items that have no value or only correct values // for the property we consider } }
@Override public void processItemDocument(ItemDocument itemDocument) { for (String propertyId : integerProperties) { if (hasPlusMinusOneValues(itemDocument .findStatementGroup(propertyId))) { fixIntegerPrecisions(itemDocument.getEntityId(), propertyId); } // else: ignore items that have no value or only correct values // for the property we consider } }
@Override public void processItemDocument(ItemDocument itemDocument) { // Record relevant labels: Integer itemId = getNumId(itemDocument.getEntityId().getId(), false); if (this.classRecords.containsKey(itemId)) { this.classRecords.get(itemId).label = itemDocument.findLabel("en"); } countTerms(itemDocument, itemStatistics); processStatementDocument(itemDocument, itemStatistics); this.countSiteLinks += itemDocument.getSiteLinks().size(); for (SiteLink siteLink : itemDocument.getSiteLinks().values()) { countSiteLink(siteLink); } }
out.print(itemDocument.getEntityId().getId()); out.print(","); out.print(csvEscape(itemDocument.findLabel("en")));
out.print(itemDocument.getEntityId().getId()); out.print(","); out.print(csvEscape(itemDocument.findLabel("en")));
@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() ); }
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() ); }
String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary);
String data = JsonSerializer.getJsonString(itemDocument); return (ItemDocument) this.wbEditingAction.wbEditEntity(itemDocument .getEntityId().getId(), null, null, null, data, clear, this.editAsBot, itemDocument.getRevisionId(), summary);
/** * 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()); }
public void writeItemDocument(ItemDocument document) throws RDFHandlerException { if (!hasTask(RdfSerializer.TASK_ITEMS)) { return; } String subjectUri = document.getEntityId().getIri(); // probably // construct the // URI from // Vocabulary Resource subject = this.rdfWriter.getUri(subjectUri); if ((this.tasks & (RdfSerializer.TASK_ALL_EXACT_DATA | RdfSerializer.TASK_SIMPLE_STATEMENTS)) != 0) { this.rdfWriter.writeTripleValueObject(subject, RdfWriter.RDF_TYPE, RdfWriter.WB_ITEM); } writeDocumentTerms(subject, document); if (hasTask(RdfSerializer.TASK_SIMPLE_STATEMENTS)) { writeSimpleStatements(subject, document); } if (hasTask(RdfSerializer.TASK_STATEMENTS)) { writeStatements(subject, document); } writeSiteLinks(subject, document.getSiteLinks()); this.snakRdfConverter.writeAuxiliaryTriples(); this.owlDeclarationBuffer.writePropertyDeclarations(this.rdfWriter, hasTask(RdfSerializer.TASK_STATEMENTS), hasTask(RdfSerializer.TASK_SIMPLE_STATEMENTS)); this.referenceRdfConverter.writeReferences(); }
String subjectUri = document.getEntityId().getIri(); Resource subject = this.rdfWriter.getUri(subjectUri);