Ignore unknown fields in schema JSON deserialization

This commit is contained in:
Antonin Delpeuch 2018-01-31 11:48:30 +00:00
parent 8b1869414d
commit fffd31382e
5 changed files with 12 additions and 9 deletions

View File

@ -4,9 +4,10 @@ import org.openrefine.wikidata.schema.exceptions.SkipSchemaExpressionException;
import org.wikidata.wdtk.datamodel.interfaces.MonolingualTextValue;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class WbNameDescExpr {
enum NameDescrType {

View File

@ -10,10 +10,11 @@ import org.wikidata.wdtk.datamodel.interfaces.Snak;
import org.wikidata.wdtk.datamodel.interfaces.SnakGroup;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
public class WbReferenceExpr implements WbExpression<Reference> {
@JsonIgnoreProperties(ignoreUnknown = true)
public class WbReferenceExpr {
private List<WbSnakExpr> snakExprs;
@JsonCreator
@ -22,7 +23,6 @@ public class WbReferenceExpr implements WbExpression<Reference> {
this.snakExprs = snakExprs;
}
@Override
public Reference evaluate(ExpressionContext ctxt) throws SkipSchemaExpressionException {
List<SnakGroup> snakGroups = new ArrayList<SnakGroup>();
for (WbSnakExpr expr : getSnaks()) {

View File

@ -7,10 +7,11 @@ import org.wikidata.wdtk.datamodel.interfaces.Snak;
import org.wikidata.wdtk.datamodel.interfaces.Value;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
public class WbSnakExpr implements WbExpression<Snak> {
@JsonIgnoreProperties(ignoreUnknown = true)
public class WbSnakExpr {
private WbExpression<? extends PropertyIdValue> prop;
private WbExpression<? extends Value> value;
@ -23,7 +24,6 @@ public class WbSnakExpr implements WbExpression<Snak> {
this.value = valueExpr;
}
@Override
public Snak evaluate(ExpressionContext ctxt) throws SkipSchemaExpressionException {
PropertyIdValue propertyId = getProp().evaluate(ctxt);
Value evaluatedValue = value.evaluate(ctxt);

View File

@ -17,9 +17,10 @@ import org.wikidata.wdtk.datamodel.interfaces.StatementRank;
import org.wikidata.wdtk.datamodel.interfaces.Value;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class WbStatementExpr {
private WbExpression<? extends Value> mainSnakValueExpr;

View File

@ -11,9 +11,10 @@ import org.wikidata.wdtk.datamodel.interfaces.Statement;
import org.wikidata.wdtk.datamodel.interfaces.StatementGroup;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
@JsonIgnoreProperties(ignoreUnknown = true)
public class WbStatementGroupExpr {
private WbExpression<? extends PropertyIdValue> propertyExpr;