Fix unit checking with novalue claims
This commit is contained in:
parent
4bb3505aa5
commit
ddbe4fe2a2
@ -213,11 +213,7 @@ public class WikidataConstraintFetcher implements ConstraintFetcher {
|
|||||||
|
|
||||||
if (specs != null) {
|
if (specs != null) {
|
||||||
List<Value> properties = findValues(specs, ALLOWED_UNITS_CONSTRAINT_PID);
|
List<Value> properties = findValues(specs, ALLOWED_UNITS_CONSTRAINT_PID);
|
||||||
if (properties.contains(null)) {
|
return properties.stream().map(e -> e == null ? null : (ItemIdValue) e).collect(Collectors.toSet());
|
||||||
return Collections.emptySet();
|
|
||||||
} else {
|
|
||||||
return properties.stream().map(e -> (ItemIdValue) e).collect(Collectors.toSet());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,9 @@ public class QuantityScrutinizer extends SnakScrutinizer {
|
|||||||
issue.setProperty("example_value", value.getNumericValue().toString());
|
issue.setProperty("example_value", value.getNumericValue().toString());
|
||||||
issue.setProperty("example_item_entity", entityId);
|
issue.setProperty("example_item_entity", entityId);
|
||||||
if (currentUnit != null) {
|
if (currentUnit != null) {
|
||||||
issue.setProperty("unit_entity", currentUnit);
|
issue.setProperty("unit_entity",
|
||||||
|
// this is a hack but it will not be needed anymore in the upcoming version of Wikidata-Toolkit
|
||||||
|
Datamodel.makeWikidataItemIdValue(currentUnit.substring(currentUnit.indexOf("Q"))));
|
||||||
}
|
}
|
||||||
addIssue(issue);
|
addIssue(issue);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user