diff --git a/include/wb/DataValueQuantity.php b/include/wb/DataValueQuantity.php --- a/include/wb/DataValueQuantity.php +++ b/include/wb/DataValueQuantity.php @@ -1,6 +1,7 @@ self::sign( $amount ), - 'unit' => "http://www.wikidata.org/entity/$wikidata_unit_id" - ]; + $value = []; + + // if the Wikidata unit ID is not specified, just "1" + // if that is NOT a Q-ID, just "1" too + if (($wikidata_unit_id === null) || (strtoupper(substr($wikidata_unit_id, 0, 1)) !== 'Q')) { + $value['unit'] = '1'; + } else { + $value['unit'] = "http://www.wikidata.org/entity/$wikidata_unit_id"; + } + if( null !== $upper_bound ) { $value['upperBound'] = self::int2string( $upper_bound ); } diff --git a/include/wb/SnakQuantity.php b/include/wb/SnakQuantity.php --- a/include/wb/SnakQuantity.php +++ b/include/wb/SnakQuantity.php @@ -1,6 +1,7 @@