use of org.wikidata.wdtk.datamodel.interfaces.SomeValueSnak in project OpenRefine by OpenRefine.
the class SnakOnlyStatementMerger method match.
/**
* Matches two snaks using the underlying value matcher.
* The snaks must have the same property id to match.
*
* @param existingSnak
* @param addedSnak
* @return
*/
public boolean match(Snak existingSnak, Snak addedSnak) {
// Deliberately only comparing the pids and not the siteIRIs to avoid spurious mismatches due to federation
if (!existingSnak.getPropertyId().getId().equals(addedSnak.getPropertyId().getId())) {
return false;
} else if (existingSnak instanceof NoValueSnak && addedSnak instanceof NoValueSnak) {
return true;
} else if (existingSnak instanceof SomeValueSnak && addedSnak instanceof SomeValueSnak) {
return true;
} else {
Value existingValue = ((ValueSnak) existingSnak).getValue();
Value addedValue = ((ValueSnak) addedSnak).getValue();
return valueMatcher.match(existingValue, addedValue);
}
}
Aggregations