/** * Count the terms (labels, descriptions, aliases) of an item or property * document. * * @param termedDocument * document to count the terms of * @param entityStatistics * record where statistics are counted */ protected void countTerms(TermedDocument termedDocument, EntityStatistics entityStatistics) { entityStatistics.countLabels += termedDocument.getLabels().size(); // for (MonolingualTextValue mtv : termedDocument.getLabels().values()) // { // countKey(usageStatistics.labelCounts, mtv.getLanguageCode(), 1); // } entityStatistics.countDescriptions += termedDocument.getDescriptions() .size(); // for (MonolingualTextValue mtv : termedDocument.getDescriptions() // .values()) { // countKey(usageStatistics.descriptionCounts, mtv.getLanguageCode(), // 1); // } for (String languageKey : termedDocument.getAliases().keySet()) { int count = termedDocument.getAliases().get(languageKey).size(); entityStatistics.countAliases += count; // countKey(usageStatistics.aliasCounts, languageKey, count); } }
/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o * the object to create a hash for * @return the hash code of the object */ private static int hashCodeForTermedDocument(TermedDocument o) { int result; result = o.getAliases().hashCode(); result = prime * result + o.getDescriptions().hashCode(); result = prime * result + o.getLabels().hashCode(); result = prime * result + Long.hashCode(o.getRevisionId()); return result; }
/** * Returns a hash code for the given object. * * @see java.lang.Object#hashCode() * @param o * the object to create a hash for * @return the hash code of the object */ private static int hashCodeForTermedDocument(TermedDocument o) { int result; result = o.getAliases().hashCode(); result = prime * result + o.getDescriptions().hashCode(); result = prime * result + o.getLabels().hashCode(); result = prime * result + Long.hashCode(o.getRevisionId()); return result; }
private static boolean equalsTermedDocument(TermedDocument o1, TermedDocument other) { return o1.getEntityId().equals(other.getEntityId()) && o1.getAliases().equals(other.getAliases()) && o1.getDescriptions().equals(other.getDescriptions()) && o1.getLabels().equals(other.getLabels()) && (o1.getRevisionId() == other.getRevisionId()); }
private static boolean equalsTermedDocument(TermedDocument o1, TermedDocument other) { return o1.getEntityId().equals(other.getEntityId()) && o1.getAliases().equals(other.getAliases()) && o1.getDescriptions().equals(other.getDescriptions()) && o1.getLabels().equals(other.getLabels()) && (o1.getRevisionId() == other.getRevisionId()); }
SortedSet<String> aliasKeys = new TreeSet<>(o.getAliases() .keySet()); for (String key : aliasKeys) { for (MonolingualTextValue mtv : o.getAliases().get(key)) { if (first) { first = false;
SortedSet<String> aliasKeys = new TreeSet<>(o.getAliases() .keySet()); for (String key : aliasKeys) { for (MonolingualTextValue mtv : o.getAliases().get(key)) { if (first) { first = false;
/** * Count the terms (labels, descriptions, aliases) of an item or property * document. * * @param usageStatistics * statistics object to store counters in * @param termedDocument * document to count the terms of */ protected void countTerms(UsageStatistics usageStatistics, TermedDocument termedDocument) { usageStatistics.countLabels += termedDocument.getLabels().size(); for (MonolingualTextValue mtv : termedDocument.getLabels().values()) { countKey(usageStatistics.labelCounts, mtv.getLanguageCode(), 1); } usageStatistics.countDescriptions += termedDocument.getDescriptions() .size(); for (MonolingualTextValue mtv : termedDocument.getDescriptions() .values()) { countKey(usageStatistics.descriptionCounts, mtv.getLanguageCode(), 1); } for (String languageKey : termedDocument.getAliases().keySet()) { int count = termedDocument.getAliases().get(languageKey).size(); usageStatistics.countAliases += count; countKey(usageStatistics.aliasCounts, languageKey, count); } }
/** * Count the terms (labels, descriptions, aliases) of an item or property * document. * * @param usageStatistics * statistics object to store counters in * @param termedDocument * document to count the terms of */ protected void countTerms(UsageStatistics usageStatistics, TermedDocument termedDocument) { usageStatistics.countLabels += termedDocument.getLabels().size(); for (MonolingualTextValue mtv : termedDocument.getLabels().values()) { countKey(usageStatistics.labelCounts, mtv.getLanguageCode(), 1); } usageStatistics.countDescriptions += termedDocument.getDescriptions() .size(); for (MonolingualTextValue mtv : termedDocument.getDescriptions() .values()) { countKey(usageStatistics.descriptionCounts, mtv.getLanguageCode(), 1); } for (String languageKey : termedDocument.getAliases().keySet()) { int count = termedDocument.getAliases().get(languageKey).size(); usageStatistics.countAliases += count; countKey(usageStatistics.aliasCounts, languageKey, count); } }
void writeDocumentTerms(Resource subject, TermedDocument document) throws RDFHandlerException { if (hasTask(RdfSerializer.TASK_LABELS)) { writeTermTriples(subject, RdfWriter.RDFS_LABEL, document .getLabels().values()); } if (hasTask(RdfSerializer.TASK_DESCRIPTIONS)) { writeTermTriples(subject, RdfWriter.SCHEMA_DESCRIPTION, document .getDescriptions().values()); } if (hasTask(RdfSerializer.TASK_ALIASES)) { for (List<MonolingualTextValue> aliases : document.getAliases() .values()) { writeTermTriples(subject, RdfWriter.SKOS_ALT_LABEL, aliases); } } }
void writeDocumentTerms(Resource subject, TermedDocument document) throws RDFHandlerException { if (hasTask(RdfSerializer.TASK_LABELS)) { writeTermTriples(subject, RdfWriter.RDFS_LABEL, document .getLabels().values()); } if (hasTask(RdfSerializer.TASK_DESCRIPTIONS)) { writeTermTriples(subject, RdfWriter.SCHEMA_DESCRIPTION, document .getDescriptions().values()); } if (hasTask(RdfSerializer.TASK_ALIASES)) { for (List<MonolingualTextValue> aliases : document.getAliases() .values()) { writeTermTriples(subject, RdfWriter.SKOS_ALT_LABEL, aliases); } } }