At a guess this is due to a miss match between the datavalue of a property and the datavalue that you are trying to set in a statement for that property.

The error also says that it gets an array where it expects a string so I guess the issue is with P251 where the value is an array instead of a string!

Could P251 possibly be a string?

On 10 August 2015 at 14:25, Bo Ferri <zazi@smiy.org> wrote:
Hi all,

(apologies, if this is not the right place for raising the following issue (if this is the case, then please delegate me to a more appropriated place ;) ))

we are currently evaluating Wikibase as storage for D:SWARM GDM data (see [1,2]). Right now, we have a prototype client [3] that makes use of a Wikidata Toolkit fork [4]. So far, we were able to write/create simple items and properties. However, we also would like to create new items with a given set of statements. Therefore, we intended to utilise the 'wbeditentity' HTTP API (and I had (and still have) a lively conversation with Markus Krötzsch about this topic, see [5]). We get (a kind of) item JSON serialisation (e.g. with help of JacksonObjectFactory-based DatamodelConverter (Wikidata Toolkit code)). However, when sending this to the 'webeditentity' API we always receive an error response like this:

"
{
  "error": {
    "code": "modification-failed",
    "info": "array instead of string",
    "messages": [
      {
        "name": "wikibase-validator-bad-type",
        "parameters": [
          "string",
          "array"
        ],
        "html": {
          "*": "array instead of string"
        }
      }
    ],
    "*": "See http://[OUR WIKIBASE SERVICE IP]/api.php for API usage"
  }
}
"

We cannot really interpret what's wrong with the data model that we send to this API (note: we make use of the POJOs below 'org.wikidata.wdtk.datamodel.json.jackson' package of Wikidata Toolkit, see [6]). An example of a data JSON is attached to this e-mail.

Thanks a lot in advance for all your help.

Cheers,


Bo/T


[1] http://dswarm.org
[2] https://github.com/dswarm/dswarm-documentation/wiki/Graph-Data-Model
[3] https://github.com/zazi/wikidata-d-swarm-importer/tree/own_mediawiki_api_client
[4] https://github.com/zazi/Wikidata-Toolkit/tree/wikibase_api_write_modifications
[5] https://github.com/Wikidata/Wikidata-Toolkit/issues/162
[6] https://github.com/zazi/wikidata-d-swarm-importer/blob/own_mediawiki_api_client/src/main/java/org/dswarm/wikidataimporter/WikibaseAPIClient.java#L368

_______________________________________________
Wikidata-tech mailing list
Wikidata-tech@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech




--
Addshore