Fix terms serialization

This commit is contained in:
Antonin Delpeuch 2018-01-04 01:31:43 +01:00
parent 497505eef1
commit 9a3093b045
3 changed files with 15 additions and 2 deletions

View File

@ -2,6 +2,17 @@ package org.openrefine.wikidata.schema;
import org.openrefine.wikidata.utils.JacksonJsonizable;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
@JsonTypeInfo(use=JsonTypeInfo.Id.NAME,
include=JsonTypeInfo.As.PROPERTY,
property="type")
@JsonSubTypes({
@Type(value = WbLanguageConstant.class, name = "wblanguageconstant"),
@Type(value = WbLanguageVariable.class, name = "wblanguagevariable")
})
public abstract class WbLanguageExpr extends JacksonJsonizable {
/**
* Evaluates the language expression to a Wikimedia language code

View File

@ -20,7 +20,7 @@ public class WbNameDescExpr extends JacksonJsonizable {
@JsonCreator
public WbNameDescExpr(
@JsonProperty("type") NameDescrType type,
@JsonProperty("name_type") NameDescrType type,
@JsonProperty("value") WbMonolingualExpr value) {
this.type = type;
this.value = value;
@ -45,6 +45,7 @@ public class WbNameDescExpr extends JacksonJsonizable {
}
}
@JsonProperty("name_type")
public NameDescrType getType() {
return type;
}

View File

@ -23,7 +23,8 @@ import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
@Type(value = WbLanguageConstant.class, name = "wblanguageconstant"),
@Type(value = WbLanguageVariable.class, name = "wblanguagevariable"),
@Type(value = WbDateConstant.class, name = "wbdateconstant"),
@Type(value = WbDateVariable.class, name = "wbdatevariable") ,
@Type(value = WbDateVariable.class, name = "wbdatevariable"),
@Type(value = WbMonolingualExpr.class, name = "wbmonolingualexpr"),
})
public abstract class WbValueExpr extends JacksonJsonizable {
/* An expression that represents a Wikibase value,