Hi all.
So I was sent a link to the instance and had a quick look and it was
as I suspected.
(here is my response with links removed..)
The JSON includes the following:
"P251": [
{
"rank": "normal",
"mainsnak": {
"snaktype": "value",
"property": "P251",
"datavalue": {
"type": "wikibase-entityid",
"value": {
"entity-type": "item",
"numeric-id": 85
}
},
"datatype": "wikibase-item"
},
"type": "statement"
}
],
Note that this is trying to use P251 as a 'wikibase-entityid'.
When looking at the property page
http://SOMEHOST/index.php/Property:P251 you can see that the datatype
is listed as 'String'.
It was said in a previous email that P251 should refer to another
item, in which case this property has been created incorrectly!
When creating a property, for example on
http://SOMEHOST/index.php/Special:NewProperty
you can see that there is a 'data type' field. This allows you to
select the type of data to be stored!
This is also available through the API
You'll have to create a new property to replace P251 that uses and
'Item' instead of 'String'
Addshore
On 11 August 2015 at 10:22, Addshore <addshorewiki(a)gmail.com
<mailto:addshorewiki@gmail.com>> wrote:
Hi Bo!
Would it be possible to get access / a URL to this test instance?
Feel free to send it to me outside of this list (if possible)
Addshore
On 11 August 2015 at 08:05, Bo Ferri <zazi(a)smiy.org
<mailto:zazi@smiy.org>> wrote:
Hi Addshore,
currently, I can't see what's wrong with the Statement with
the property P251. It should refer to another Item (which
should be possible within the Wikidata data model). This is
the difference between all other Statements - they simply
refer to literal Values. I also had a look at the JSON
serialisation documentation. In the Snak section [1] I can
find an example that looks similar to mine (or maybe I'm blind
and oversee something). Furthermore, I'm serialising POJO
objects from the Wikidata Toolkit (i.e. I do not construct the
JSON at my own). The Item that is the Value of this Statement
exists already in my Wikibase instance (all properties exists
as well).
We are running a nightly snapshot of MediaWiki (incl. Wikibase
extension).
Thanks a lot in advance for all your help.
Cheers,
Bo/T
[1]
https://www.mediawiki.org/wiki/Wikibase/DataModel/JSON#Snaks
Quoting Addshore <addshorewiki(a)gmail.com
<mailto:addshorewiki@gmail.com>>:
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(a)smiy.org
<mailto: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_cl…
[4]
https://github.com/zazi/Wikidata-Toolkit/tree/wikibase_api_write_modificati…
[5]
https://github.com/Wikidata/Wikidata-Toolkit/issues/162
[6]
https://github.com/zazi/wikidata-d-swarm-importer/blob/own_mediawiki_api_cl…
_______________________________________________
Wikidata-tech mailing list
Wikidata-tech(a)lists.wikimedia.org
<mailto:Wikidata-tech@lists.wikimedia.org>
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
--
Addshore
_______________________________________________
Wikidata-tech mailing list
Wikidata-tech(a)lists.wikimedia.org
<mailto:Wikidata-tech@lists.wikimedia.org>
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech
--
Addshore
--
Addshore
_______________________________________________
Wikidata-tech mailing list
Wikidata-tech(a)lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/wikidata-tech