Smalyshev has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/196712

Change subject: FIXME fixes
......................................................................

FIXME fixes

Change-Id: I51d6377511b42eb9cf638af975e3a940550643e6
---
M repo/includes/LinkedData/EntityDataSerializationService.php
M repo/includes/rdf/RdfBuilder.php
M repo/includes/rdf/RdfProducer.php
M repo/includes/rdf/RdfSerializer.php
M repo/tests/phpunit/data/rdf/Q4.json
M repo/tests/phpunit/data/rdf/Q4_all_statements.nt
M repo/tests/phpunit/data/rdf/Q4_claims.nt
M repo/tests/phpunit/data/rdf/Q4_props.nt
M repo/tests/phpunit/data/rdf/Q4_truthy_statements.nt
M repo/tests/phpunit/data/rdf/Q4_values.nt
M repo/tests/phpunit/data/rdf/Q6.json
M repo/tests/phpunit/data/rdf/Q6_no_qualifiers.nt
M repo/tests/phpunit/data/rdf/Q6_qualifiers.nt
M repo/tests/phpunit/data/rdf/Q6_with_qualifiers.nt
M repo/tests/phpunit/data/rdf/Q7.json
M repo/tests/phpunit/data/rdf/Q7_references.nt
M repo/tests/phpunit/data/rdf/Q7_refs.nt
M repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
18 files changed, 211 insertions(+), 100 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/12/196712/1

diff --git a/repo/includes/LinkedData/EntityDataSerializationService.php 
b/repo/includes/LinkedData/EntityDataSerializationService.php
index ecaaba1..2c012a7 100644
--- a/repo/includes/LinkedData/EntityDataSerializationService.php
+++ b/repo/includes/LinkedData/EntityDataSerializationService.php
@@ -485,7 +485,7 @@
                        case 'full':
                                return RdfProducer::PRODUCE_ALL;
                        case 'dump':
-                               return RdfProducer::PRODUCE_ALL_STATEMENTS | 
RdfProducer::PRODUCE_TRUTHY_STATEMENTS | RdfProducer::PRODUCE_QUALIFIERS | 
RdfProducer::PRODUCE_REFERENCES | RdfProducer::PRODUCE_SITELINKS;
+                               return RdfProducer::PRODUCE_ALL_STATEMENTS | 
RdfProducer::PRODUCE_TRUTHY_STATEMENTS | RdfProducer::PRODUCE_QUALIFIERS | 
RdfProducer::PRODUCE_REFERENCES | RdfProducer::PRODUCE_SITELINKS | 
RdfProducer::PRODUCE_FULL_VALUES;
                        case 'long':
                                return RdfProducer::PRODUCE_ALL_STATEMENTS | 
RdfProducer::PRODUCE_QUALIFIERS | RdfProducer::PRODUCE_REFERENCES | 
RdfProducer::PRODUCE_SITELINKS | RdfProducer::PRODUCE_VERSION_INFO;
                        case null: // No flavor given
diff --git a/repo/includes/rdf/RdfBuilder.php b/repo/includes/rdf/RdfBuilder.php
index db9a574..d4d48c7 100644
--- a/repo/includes/rdf/RdfBuilder.php
+++ b/repo/includes/rdf/RdfBuilder.php
@@ -24,6 +24,8 @@
 use DataValues\StringValue;
 use DataValues\MonolingualTextValue;
 use DataValues\GlobeCoordinateValue;
+use Wikibase\DataModel\Entity\PropertyDataTypeLookup;
+use DataValues\DecimalValue;
 
 /**
  * RDF mapping for wikibase data model.
@@ -123,7 +125,7 @@
         * @param SiteList $sites
         * @param string $baseUri
         * @param string $dataUri
-        * @param EntityLookup $entityLookup
+        * @param PropertyDataTypeLookup $propertyLookup
         * @param integer $flavor
         * @param EasyRdf_Graph|null $graph
         */
@@ -520,7 +522,7 @@
                        $entityResource->addResource( $propertyQName, 
$statementResource );
                        $this->addSnak( $statementResource, $snak, 
self::NS_VALUE );
 
-                       if ( $this->shouldProduce( 
RdfProducer::PRODUCE_PROPERTIES ) ) { //FIXME: get rid of PRODUCE_PROPERTIES, 
add an option to resolveMentionedEntities instead.
+                       if( $this->shouldProduce( 
RdfProducer::PRODUCE_PROPERTIES) ) {
                                $this->entityMentioned( $snak->getPropertyId() 
);
                        }
 
@@ -599,12 +601,9 @@
                foreach( $props as $prop => $type ) {
                        $getter = "get" . ucfirst( $prop );
                        $data = $value->$getter();
-                       if ( $type == 'url' ) { //FIXME: use the logic from 
addStatementValue recursively here.
-                               $node->addResource( $this->getEntityTypeQName( 
$prop ), $data );
-                               continue;
+                       if( !is_null( $data ) ) {
+                               $this->addValueToNode( $node, 
$this->getEntityTypeQName( $prop ), $type, $data );
                        }
-                       $node->addLiteral( $this->getEntityTypeQName( $prop ),
-                                       new \EasyRdf_Literal( $data, null, 
$type ) ); //FIXME: what happens is $data is not scalar? Avoid hard crash.
                }
        }
 
@@ -621,9 +620,15 @@
                        DataValue $value, $propertyNamespace, $simpleValue = 
false ) {
                $propertyValueQName = $this->getEntityQName( 
$propertyNamespace, $propertyId );
 
-               $property = $this->entityLookup->getEntity( $propertyId ); 
//FIXME: use PropertyDataTypeLookup!
-               $dataType = $property->getDataTypeId();
                $typeId = $value->getType();
+               if( $typeId == 'string' ) {
+                       // Only strings have different types now, so we can 
save time but not asking
+                       // for any other types
+                       $property = $this->entityLookup->getEntity( $propertyId 
); //FIXME: use PropertyDataTypeLookup!
+                       $dataType = $property->getDataTypeId();
+               } else {
+                       $dataType = $typeId;
+               }
 
                //FIXME: use a proper registry / dispatching builder
                $typeId = "addStatementFor".preg_replace( '/[^\w]/', '', 
ucwords( $typeId ) );
@@ -652,7 +657,9 @@
                $entityQName = $this->getEntityQName( self::NS_ENTITY, 
$entityId );
                $entityResource = $this->graph->resource( $entityQName );
                $target->addResource( $propertyValueQName, $entityResource );
-               $this->entityMentioned( $entityId );
+               if( $this->shouldProduce( 
RdfProducer::PRODUCE_RESOLVED_ENTITIES ) ) {
+                       $this->entityMentioned( $entityId );
+               }
        }
 
        /**
@@ -667,13 +674,46 @@
        private function addStatementForString( EasyRdf_Resource $target, 
$propertyValueQName, $dataType,
                        StringValue $value, $simpleValue = false ) {
                if ( $dataType == 'commonsMedia' ) {
-                       $target->addResource( $propertyValueQName, 
$this->getCommonsURI( $value->getValue() ) );
+                       $this->addValueToNode( $target, $propertyValueQName, 
'url', $this->getCommonsURI( $value->getValue() ) );
                } elseif ( $dataType == 'url' ) {
-                       $target->addResource( $propertyValueQName, 
$value->getValue() );
+                       $this->addValueToNode( $target, $propertyValueQName, 
'url', $value->getValue() );
                } else {
                        $target->addLiteral( $propertyValueQName, new 
EasyRdf_Literal( $value->getValue() ) );
                }
        }
+
+       /**
+        * Add value to a node
+        * This function does massaging needed for RDF data types.
+        *
+        * @param EasyRdf_Resource $target
+        * @param string $propertyName
+        * @param string $type
+        * @param string $value
+        */
+       private function addValueToNode( EasyRdf_Resource $target, 
$propertyName, $type, $value ) {
+               if( $type == 'url' ) {
+                       $target->addResource( $propertyName, $value );
+               } elseif( $type == 'xsd:dateTime' ) {
+                       $target->addLiteral( $propertyName,
+                                       new \EasyRdf_Literal_DateTime( 
$this->cleanupDateValue( $value ) ) );
+               } elseif( $type == 'xsd:decimal' ) {
+                       // TODO: handle precision here?
+                       if( $value instanceof DecimalValue ) {
+                               $value = $value->getValue();
+                       }
+                       $target->addLiteral( $propertyName, new 
\EasyRdf_Literal_Decimal( $value ) );
+               } else {
+                       if( !is_scalar( $value ) ) {
+                               // somehow we got a weird value, better not 
risk it and bail
+                               $vtype = gettype( $value );
+                               wfLogWarning( "Bad value passed to 
addValueToNode for {$target->getUri()}:$propertyName: $vtype" );
+                               return;
+                       }
+                       $target->addLiteral( $propertyName, $value, null, $type 
);
+               }
+       }
+
 
        /**
         * Adds specific value
@@ -690,6 +730,57 @@
        }
 
        /**
+        * Clean up Wikidata date value
+        * - remove + from the start - not all data stores like that
+        * - validate month and date value
+        * @param string $dateValue
+        * @return string
+        */
+       private function cleanupDateValue( $dateValue ) {
+               list($date, $time) = explode( "T", $dateValue, 2 );
+               if( $date[0] == "-" ) {
+                       list($y, $m, $d) = explode( "-", substr( $date, 1 ), 3 
);
+                       $y = -(int)$y;
+               } else {
+                       list($y, $m, $d) = explode( "-", $date, 3 );
+                       $y = (int)$y;
+               }
+
+               $m = (int)$m;
+               $d = (int)$d;
+
+               // PHP source docs say PHP gregorian calendar can work down to 
4714 BC
+               // for smaller dates, we ignore month/day
+               if( $y <= -4714 ) {
+                       $d = $m = 1;
+               }
+
+               if( $m <= 0 ) {
+                       $m = 1;
+               }
+               if( $m >= 12 ) {
+                       // Why anybody would do something like that? Anyway, 
better to check.
+                       $m = 12;
+               }
+               if( $d <= 0 ) {
+                       $d = 1;
+               }
+               // check if the date "looks safe". If not, we do deeper check
+               if( !( $d <= 28 || ( $m != 2 && $d <= 30 ) ) ) {
+                       $max = cal_days_in_month( CAL_GREGORIAN, $m, $y );
+                       // We just put it as the last day in month, won't 
bother further
+                       if( $d > $max ) {
+                               $d = $max;
+                       }
+               }
+               // This is a bit weird since xsd:dateTime requires >=4 digit 
always,
+               // and leading 0 is not allowed for 5 digits
+               // But sprintf counts - as digit
+               // See: http://www.w3.org/TR/xmlschema-2/#dateTime
+               return sprintf( "%s%04d-%02d-%02dT%s", ($y < 0)? "-":"", abs( 
$y ), $m, $d, $time );
+       }
+
+       /**
         * Adds specific value
         *
         * @param EasyRdf_Resource $target
@@ -700,11 +791,12 @@
         */
        private function addStatementForTime( EasyRdf_Resource $target, 
$propertyValueQName, $dataType,
                        TimeValue $value, $simpleValue = false ) {
-               // TODO: we may want to deal with Julian dates here? //FIXME: 
EasyRdf_Literal_DateTime may fail hard on non-iso dates! Needs error handling / 
fallback.
-               $target->addLiteral( $propertyValueQName, new 
\EasyRdf_Literal_DateTime( $value->getTime() ) );
+               // Since TimeValue class says the date is always stored as 
proleptic gregorian,
+               // we don't worry about Julian dates here
+               $this->addValueToNode( $target, $propertyValueQName, 
'xsd:dateTime', $value->getTime() );
                if ( !$simpleValue && $this->shouldProduce( 
RdfProducer::PRODUCE_FULL_VALUES ) ) { //FIXME: register separate generators 
for different output flavors.
                        $this->addExpandedValue( $target, $propertyValueQName, 
$value,
-                                       array(  'time' => 'xsd:dateTime', 
//FIXME: only true for gregorian!
+                                       array(  'time' => 'xsd:dateTime',
                                                        // TODO: eventually use 
identifier here
                                                        'precision' => 
'xsd:integer',
                                                        'timezone' => 
'xsd:integer',
@@ -773,7 +865,7 @@
         *
         * @param EntityLookup $entityLookup
         */
-       public function resolvedMentionedEntities( EntityLookup $entityLookup ) 
{ //FIXME: needs test
+       public function resolveMentionedEntities( EntityLookup $entityLookup ) 
{ //FIXME: needs test
                // @todo inject a DispatchingEntityIdParser
                $idParser = new BasicEntityIdParser();
 
diff --git a/repo/includes/rdf/RdfProducer.php 
b/repo/includes/rdf/RdfProducer.php
index e9660c8..24d8474 100644
--- a/repo/includes/rdf/RdfProducer.php
+++ b/repo/includes/rdf/RdfProducer.php
@@ -7,15 +7,28 @@
  */
 interface RdfProducer {
 
-       //FIXME: documentation needed
+       // Produce "truthy" statements, i.e. best ranked
+       // entity-property-value without qualifiers or expanded values
        const PRODUCE_TRUTHY_STATEMENTS = 1;
+       // Produce all statements
        const PRODUCE_ALL_STATEMENTS    = 2;
+       // Produce qualifiers for statements
+       // Should be used together with PRODUCE_ALL_STATEMENTS.
        const PRODUCE_QUALIFIERS        = 4;
+       // Produce references for statements
+       // Should be used together with PRODUCE_ALL_STATEMENTS.
        const PRODUCE_REFERENCES        = 8;
+       // Produce links and badges
        const PRODUCE_SITELINKS         = 16;
+       // Add entity definitions for properties used in the dump.
        const PRODUCE_PROPERTIES        = 32;
+       // Produce full expanded values as nodes.
+       // Should be used together with PRODUCE_ALL_STATEMENTS.
        const PRODUCE_FULL_VALUES       = 64;
+       // Produce metadata header containing software version info and 
copyright
        const PRODUCE_VERSION_INFO      = 128;
+       // Produce definitions for all entities used in the dump
+       const PRODUCE_RESOLVED_ENTITIES = 256;
 
-       const PRODUCE_ALL = 0xFF;
+       const PRODUCE_ALL = 0xFFFF;
 }
\ No newline at end of file
diff --git a/repo/includes/rdf/RdfSerializer.php 
b/repo/includes/rdf/RdfSerializer.php
index a3055bb..ddb108b 100644
--- a/repo/includes/rdf/RdfSerializer.php
+++ b/repo/includes/rdf/RdfSerializer.php
@@ -137,7 +137,7 @@
 
                $builder->addEntity( $entityRevision->getEntity() );
 
-               $builder->resolvedMentionedEntities( $this->entityLookup ); 
//TODO: optional
+               $builder->resolveMentionedEntities( $this->entityLookup ); 
//TODO: optional
 
                $graph = $builder->getGraph();
                return $graph;
diff --git a/repo/tests/phpunit/data/rdf/Q4.json 
b/repo/tests/phpunit/data/rdf/Q4.json
index 15032b1..1fcb2f8 100644
--- a/repo/tests/phpunit/data/rdf/Q4.json
+++ b/repo/tests/phpunit/data/rdf/Q4.json
@@ -75,7 +75,7 @@
                             "latitude": 12.345,
                             "longitude": 67.89,
                             "altitude": null,
-                            "precision": null,
+                            "precision": 0.01,
                             "globe": "http:\/\/www.wikidata.org\/entity\/Q2"
                         },
                         "type": "globecoordinate"
@@ -207,4 +207,4 @@
             }
         ]
     }
-}
\ No newline at end of file
+}
diff --git a/repo/tests/phpunit/data/rdf/Q4_all_statements.nt 
b/repo/tests/phpunit/data/rdf/Q4_all_statements.nt
index 60c38a6..5bf09be 100644
--- a/repo/tests/phpunit/data/rdf/Q4_all_statements.nt
+++ b/repo/tests/phpunit/data/rdf/Q4_all_statements.nt
@@ -41,7 +41,7 @@
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://acme.test/value/P7> "simplestring" .
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
-<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 
<http://acme.test/statement/TEST-Statement-9-2669d541dfd2d6cc0105927bff02bbe0eec0e921>
 <http://acme.test/value/P9> <http://url.acme.test/> .
diff --git a/repo/tests/phpunit/data/rdf/Q4_claims.nt 
b/repo/tests/phpunit/data/rdf/Q4_claims.nt
index 4b1c616..909bea5 100644
--- a/repo/tests/phpunit/data/rdf/Q4_claims.nt
+++ b/repo/tests/phpunit/data/rdf/Q4_claims.nt
@@ -18,7 +18,7 @@
 <http://acme.test/Q4> <http://acme.test/assert/P5> 
<http://www.wikidata.org/ontology-0.0.1#Somevalue> .
 <http://acme.test/Q4> <http://acme.test/assert/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/Q4> <http://acme.test/assert/P7> "simplestring" .
-<http://acme.test/Q4> <http://acme.test/assert/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/Q4> <http://acme.test/assert/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/Q4> <http://acme.test/assert/P9> <http://url.acme.test/> .
 <http://acme.test/Q4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Item> .
 
<http://acme.test/statement/TEST-Statement-2-423614cd831ed4e8da1138c9229cb65cf96f9366>
 <http://acme.test/value/P2> <http://acme.test/Q42> .
@@ -33,7 +33,7 @@
 
<http://acme.test/statement/TEST-Statement-3-b181ddac61642fe80bbf8e4a8eaa1da425cb0ac9>
 <http://acme.test/value/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
 
<http://acme.test/statement/TEST-Statement-3-b181ddac61642fe80bbf8e4a8eaa1da425cb0ac9>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-3-b181ddac61642fe80bbf8e4a8eaa1da425cb0ac9>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
-<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://acme.test/value/P4-value> 
<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> .
+<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://acme.test/value/P4-value> 
<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> .
 
<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://acme.test/value/P4> "Point(12.345 
67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
 
<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
@@ -54,7 +54,7 @@
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8-value> 
<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> .
-<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 
<http://acme.test/statement/TEST-Statement-9-2669d541dfd2d6cc0105927bff02bbe0eec0e921>
 <http://acme.test/value/P9> <http://url.acme.test/> .
@@ -66,11 +66,11 @@
 <http://data.acme.test/Q4> <http://schema.org/softwareVersion> "0.0.1" .
 <http://data.acme.test/Q4> <http://schema.org/version> 
"42"^^<http://www.w3.org/2001/XMLSchema#integer> .
 <http://data.acme.test/Q4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://schema.org/Dataset> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
""^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"0.01"^^<http://www.w3.org/2001/XMLSchema#decimal> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#Amount> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#LowerBound> 
"+19.766999999999999459987520822323858737945556640625"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
@@ -79,5 +79,5 @@
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#CalendarModel> 
<http://calendar.acme.test/> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"9"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Timezone> 
"0"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/repo/tests/phpunit/data/rdf/Q4_props.nt 
b/repo/tests/phpunit/data/rdf/Q4_props.nt
index 60c38a6..5bf09be 100644
--- a/repo/tests/phpunit/data/rdf/Q4_props.nt
+++ b/repo/tests/phpunit/data/rdf/Q4_props.nt
@@ -41,7 +41,7 @@
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://acme.test/value/P7> "simplestring" .
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
-<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 
<http://acme.test/statement/TEST-Statement-9-2669d541dfd2d6cc0105927bff02bbe0eec0e921>
 <http://acme.test/value/P9> <http://url.acme.test/> .
diff --git a/repo/tests/phpunit/data/rdf/Q4_truthy_statements.nt 
b/repo/tests/phpunit/data/rdf/Q4_truthy_statements.nt
index c0341ba..030de15 100644
--- a/repo/tests/phpunit/data/rdf/Q4_truthy_statements.nt
+++ b/repo/tests/phpunit/data/rdf/Q4_truthy_statements.nt
@@ -6,7 +6,7 @@
 <http://acme.test/Q4> <http://acme.test/assert/P5> 
<http://www.wikidata.org/ontology-0.0.1#Somevalue> .
 <http://acme.test/Q4> <http://acme.test/assert/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/Q4> <http://acme.test/assert/P7> "simplestring" .
-<http://acme.test/Q4> <http://acme.test/assert/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/Q4> <http://acme.test/assert/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/Q4> <http://acme.test/assert/P9> <http://url.acme.test/> .
 <http://acme.test/Q4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Item> .
 <http://data.acme.test/Q4> <http://schema.org/about> <http://acme.test/Q4> .
diff --git a/repo/tests/phpunit/data/rdf/Q4_values.nt 
b/repo/tests/phpunit/data/rdf/Q4_values.nt
index 3b923a5..42cae78 100644
--- a/repo/tests/phpunit/data/rdf/Q4_values.nt
+++ b/repo/tests/phpunit/data/rdf/Q4_values.nt
@@ -23,7 +23,7 @@
 
<http://acme.test/statement/TEST-Statement-3-b181ddac61642fe80bbf8e4a8eaa1da425cb0ac9>
 <http://acme.test/value/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
 
<http://acme.test/statement/TEST-Statement-3-b181ddac61642fe80bbf8e4a8eaa1da425cb0ac9>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-3-b181ddac61642fe80bbf8e4a8eaa1da425cb0ac9>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
-<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://acme.test/value/P4-value> 
<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> .
+<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://acme.test/value/P4-value> 
<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> .
 
<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://acme.test/value/P4> "Point(12.345 
67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
 
<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-4-8749fa158a249e1befa6ed077f648c56197a2b2d>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
@@ -44,7 +44,7 @@
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-7-6063d202e584b79a2e9f89ab92b51e7f22ef9886>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8-value> 
<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> .
-<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://acme.test/value/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
 
<http://acme.test/statement/TEST-Statement-8-5dd0f6624a7545401bc306a068ac1bbe8148bfac>
 <http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 
<http://acme.test/statement/TEST-Statement-9-2669d541dfd2d6cc0105927bff02bbe0eec0e921>
 <http://acme.test/value/P9> <http://url.acme.test/> .
@@ -54,11 +54,11 @@
 <http://data.acme.test/Q4> <http://schema.org/dateModified> 
"2013-10-04T03:31:05Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://data.acme.test/Q4> <http://schema.org/version> 
"42"^^<http://www.w3.org/2001/XMLSchema#integer> .
 <http://data.acme.test/Q4> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://schema.org/Dataset> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
""^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/974afffbe8c12ab5579f4b521ae2bd5d> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"0.01"^^<http://www.w3.org/2001/XMLSchema#decimal> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#Amount> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#LowerBound> 
"+19.766999999999999459987520822323858737945556640625"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
@@ -67,5 +67,5 @@
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#CalendarModel> 
<http://calendar.acme.test/> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"9"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Timezone> 
"0"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/repo/tests/phpunit/data/rdf/Q6.json 
b/repo/tests/phpunit/data/rdf/Q6.json
index 8bb2e9c..fac5b01 100644
--- a/repo/tests/phpunit/data/rdf/Q6.json
+++ b/repo/tests/phpunit/data/rdf/Q6.json
@@ -71,7 +71,7 @@
                                     "latitude": 12.345,
                                     "longitude": 67.89,
                                     "altitude": null,
-                                    "precision": null,
+                                    "precision": 0.1,
                                     "globe": 
"http:\/\/www.wikidata.org\/entity\/Q2"
                                 },
                                 "type": "globecoordinate"
@@ -187,4 +187,4 @@
             }
         ]
     }
-}
\ No newline at end of file
+}
diff --git a/repo/tests/phpunit/data/rdf/Q6_no_qualifiers.nt 
b/repo/tests/phpunit/data/rdf/Q6_no_qualifiers.nt
index 5dedf99..7d8812b 100644
--- a/repo/tests/phpunit/data/rdf/Q6_no_qualifiers.nt
+++ b/repo/tests/phpunit/data/rdf/Q6_no_qualifiers.nt
@@ -1,4 +1,3 @@
-
 <http://acme.test/Q6> <http://acme.test/P7> 
<http://acme.test/statement/TEST-Qualifiers> .
 <http://acme.test/Q6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Item> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/value/P7> 
"string" .
@@ -7,4 +6,4 @@
 <http://data.acme.test/Q6> <http://schema.org/about> <http://acme.test/Q6> .
 <http://data.acme.test/Q6> <http://schema.org/dateModified> 
"2013-10-04T03:31:05Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://data.acme.test/Q6> <http://schema.org/version> 
"42"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://data.acme.test/Q6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://schema.org/Dataset> .
\ No newline at end of file
+<http://data.acme.test/Q6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://schema.org/Dataset> .
diff --git a/repo/tests/phpunit/data/rdf/Q6_qualifiers.nt 
b/repo/tests/phpunit/data/rdf/Q6_qualifiers.nt
index 8c053bd..70442fa 100644
--- a/repo/tests/phpunit/data/rdf/Q6_qualifiers.nt
+++ b/repo/tests/phpunit/data/rdf/Q6_qualifiers.nt
@@ -5,7 +5,7 @@
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P2> 
<http://acme.test/Q666> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P3> 
<http://www.wikidata.org/ontology-0.0.1#Novalue> .
-<http://acme.test/statement/TEST-Qualifiers> 
<http://acme.test/qualifier/P4-value> 
<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> .
+<http://acme.test/statement/TEST-Qualifiers> 
<http://acme.test/qualifier/P4-value> 
<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P4> 
"Point(12.345 67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P5> 
"\u0431\u0440\u0435\u0434"@ru .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P5> 
"\u043F\u0440\u0435\u0432\u0435\u0434"@ru .
@@ -14,7 +14,7 @@
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P7> 
"simplestring" .
 <http://acme.test/statement/TEST-Qualifiers> 
<http://acme.test/qualifier/P8-value> 
<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> .
-<http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P9> 
<http://url.acme.test/> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/value/P7> 
"string" .
 <http://acme.test/statement/TEST-Qualifiers> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
@@ -25,11 +25,11 @@
 <http://data.acme.test/Q6> <http://schema.org/softwareVersion> "0.0.1" .
 <http://data.acme.test/Q6> <http://schema.org/version> 
"42"^^<http://www.w3.org/2001/XMLSchema#integer> .
 <http://data.acme.test/Q6> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://schema.org/Dataset> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
""^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"0.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#Amount> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#LowerBound> 
"+19.766999999999999459987520822323858737945556640625"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
@@ -38,5 +38,5 @@
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#CalendarModel> 
<http://calendar.acme.test/> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"9"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Timezone> 
"0"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/repo/tests/phpunit/data/rdf/Q6_with_qualifiers.nt 
b/repo/tests/phpunit/data/rdf/Q6_with_qualifiers.nt
index 1a5b946..16fdd5b 100644
--- a/repo/tests/phpunit/data/rdf/Q6_with_qualifiers.nt
+++ b/repo/tests/phpunit/data/rdf/Q6_with_qualifiers.nt
@@ -10,7 +10,7 @@
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P5> 
<http://www.wikidata.org/ontology-0.0.1#Somevalue> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P7> 
"simplestring" .
-<http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/qualifier/P9> 
<http://url.acme.test/> .
 <http://acme.test/statement/TEST-Qualifiers> <http://acme.test/value/P7> 
"string" .
 <http://acme.test/statement/TEST-Qualifiers> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
diff --git a/repo/tests/phpunit/data/rdf/Q7.json 
b/repo/tests/phpunit/data/rdf/Q7.json
index 324b294..c2b2d29 100644
--- a/repo/tests/phpunit/data/rdf/Q7.json
+++ b/repo/tests/phpunit/data/rdf/Q7.json
@@ -71,7 +71,7 @@
                                             "latitude": 12.345,
                                             "longitude": 67.89,
                                             "altitude": null,
-                                            "precision": null,
+                                            "precision": 0.1,
                                             "globe": 
"http:\/\/www.wikidata.org\/entity\/Q2"
                                         },
                                         "type": "globecoordinate"
@@ -246,7 +246,7 @@
                                             "latitude": 12.345,
                                             "longitude": 67.89,
                                             "altitude": null,
-                                            "precision": null,
+                                            "precision": 0.1,
                                             "globe": 
"http:\/\/www.wikidata.org\/entity\/Q2"
                                         },
                                         "type": "globecoordinate"
@@ -355,4 +355,4 @@
             }
         ]
     }
-}
\ No newline at end of file
+}
diff --git a/repo/tests/phpunit/data/rdf/Q7_references.nt 
b/repo/tests/phpunit/data/rdf/Q7_references.nt
index 27c8518..0d5d1a8 100644
--- a/repo/tests/phpunit/data/rdf/Q7_references.nt
+++ b/repo/tests/phpunit/data/rdf/Q7_references.nt
@@ -3,29 +3,29 @@
 <http://acme.test/Q7> <http://acme.test/assert/P7> "string" .
 <http://acme.test/Q7> <http://acme.test/assert/P7> "string2" .
 <http://acme.test/Q7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Item> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P2> <http://acme.test/Q42> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P2> <http://acme.test/Q666> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P3> <http://www.wikidata.org/ontology-0.0.1#Novalue> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P4-value> 
<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P4> "Point(12.345 
67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P5> "\u0431\u0440\u0435\u0434"@ru .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P5> "\u043F\u0440\u0435\u0432\u0435\u0434"@ru .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P5> <http://www.wikidata.org/ontology-0.0.1#Somevalue> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P6-value> 
<http://acme.test/value/1e09d673624819aacd170165aae555a1> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P7> "simplestring" .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P8-value> 
<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P9> <http://url.acme.test/> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Reference> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P2> <http://acme.test/Q42> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P2> <http://acme.test/Q666> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P3> <http://www.wikidata.org/ontology-0.0.1#Novalue> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P4-value> 
<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P4> "Point(12.345 
67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P5> "\u0431\u0440\u0435\u0434"@ru .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P5> "\u043F\u0440\u0435\u0432\u0435\u0434"@ru .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P5> <http://www.wikidata.org/ontology-0.0.1#Somevalue> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P6-value> 
<http://acme.test/value/1e09d673624819aacd170165aae555a1> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P7> "simplestring" .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P8-value> 
<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P9> <http://url.acme.test/> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Reference> .
 <http://acme.test/statement/TEST-References-2> <http://acme.test/value/P7> 
"string2" .
 <http://acme.test/statement/TEST-References-2> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
-<http://acme.test/statement/TEST-References-2> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> .
+<http://acme.test/statement/TEST-References-2> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> .
 <http://acme.test/statement/TEST-References-2> 
<http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 <http://acme.test/statement/TEST-References> <http://acme.test/value/P7> 
"string" .
 <http://acme.test/statement/TEST-References> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
-<http://acme.test/statement/TEST-References> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> .
+<http://acme.test/statement/TEST-References> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> .
 <http://acme.test/statement/TEST-References> 
<http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 <http://data.acme.test/Q7> <http://creativecommons.org/ns#license> 
<http://creativecommons.org/publicdomain/zero/1.0/> .
 <http://data.acme.test/Q7> <http://schema.org/about> <http://acme.test/Q7> .
@@ -33,11 +33,11 @@
 <http://data.acme.test/Q7> <http://schema.org/softwareVersion> "0.0.1" .
 <http://data.acme.test/Q7> <http://schema.org/version> 
"42"^^<http://www.w3.org/2001/XMLSchema#integer> .
 <http://data.acme.test/Q7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://schema.org/Dataset> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
-<http://acme.test/value/a490f3ae6258459a479723fa2f0d8141> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
""^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Globe> 
<http://www.wikidata.org/entity/Q2> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Latitude> 
"12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Longitude> 
"67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> .
+<http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"0.1"^^<http://www.w3.org/2001/XMLSchema#decimal> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#Amount> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
 <http://acme.test/value/1e09d673624819aacd170165aae555a1> 
<http://www.wikidata.org/ontology-0.0.1#LowerBound> 
"+19.766999999999999459987520822323858737945556640625"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
@@ -46,5 +46,5 @@
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Value> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#CalendarModel> 
<http://calendar.acme.test/> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Precision> 
"9"^^<http://www.w3.org/2001/XMLSchema#integer> .
-<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Time> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
 <http://acme.test/value/c7499b57a1a474e6a89f4c3b42ca01e7> 
<http://www.wikidata.org/ontology-0.0.1#Timezone> 
"0"^^<http://www.w3.org/2001/XMLSchema#integer> .
diff --git a/repo/tests/phpunit/data/rdf/Q7_refs.nt 
b/repo/tests/phpunit/data/rdf/Q7_refs.nt
index 638279f..71f7833 100644
--- a/repo/tests/phpunit/data/rdf/Q7_refs.nt
+++ b/repo/tests/phpunit/data/rdf/Q7_refs.nt
@@ -1,26 +1,26 @@
 <http://acme.test/Q7> <http://acme.test/P7> 
<http://acme.test/statement/TEST-References-2> .
 <http://acme.test/Q7> <http://acme.test/P7> 
<http://acme.test/statement/TEST-References> .
 <http://acme.test/Q7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Item> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P2> <http://acme.test/Q42> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P2> <http://acme.test/Q666> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P3> <http://www.wikidata.org/ontology-0.0.1#Novalue> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P4> "Point(12.345 
67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P5> "\u0431\u0440\u0435\u0434"@ru .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P5> "\u043F\u0440\u0435\u0432\u0435\u0434"@ru .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P5> <http://www.wikidata.org/ontology-0.0.1#Somevalue> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P7> "simplestring" .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P8> 
"-00000000200-00-00T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://acme.test/value/P9> <http://url.acme.test/> .
-<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Reference> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P2> <http://acme.test/Q42> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P2> <http://acme.test/Q666> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P3> 
<http://commons.wikimedia.org/wiki/Special:FilePath/Universe.svg> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P3> <http://www.wikidata.org/ontology-0.0.1#Novalue> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P4> "Point(12.345 
67.89)"^^<http://www.opengis.net/ont/geosparql#wktLiteral> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P5> "\u0431\u0440\u0435\u0434"@ru .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P5> "\u043F\u0440\u0435\u0432\u0435\u0434"@ru .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P5> <http://www.wikidata.org/ontology-0.0.1#Somevalue> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P6> 
"+19.768000000000000682121026329696178436279296875"^^<http://www.w3.org/2001/XMLSchema#decimal>
 .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P7> "simplestring" .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P8> 
"-0200-01-01T00:00:00Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://acme.test/value/P9> <http://url.acme.test/> .
+<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Reference> .
 <http://acme.test/statement/TEST-References-2> <http://acme.test/value/P7> 
"string2" .
 <http://acme.test/statement/TEST-References-2> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
-<http://acme.test/statement/TEST-References-2> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> .
+<http://acme.test/statement/TEST-References-2> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> .
 <http://acme.test/statement/TEST-References-2> 
<http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 <http://acme.test/statement/TEST-References> <http://acme.test/value/P7> 
"string" .
 <http://acme.test/statement/TEST-References> 
<http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
<http://www.wikidata.org/ontology-0.0.1#Statement> .
-<http://acme.test/statement/TEST-References> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/a9059ae62c138ba7535ece019f82fb2e1fb44d13> .
+<http://acme.test/statement/TEST-References> 
<http://www.w3.org/ns/prov#wasDerivedFrom> 
<http://acme.test/reference/6428eef99e9afe3c0a893253456adba95f7bd920> .
 <http://acme.test/statement/TEST-References> 
<http://www.wikidata.org/ontology-0.0.1#Rank> 
<http://www.wikidata.org/ontology-0.0.1#NormalRank> .
 <http://data.acme.test/Q7> <http://schema.org/about> <http://acme.test/Q7> .
 <http://data.acme.test/Q7> <http://schema.org/dateModified> 
"2013-10-04T03:31:05Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
diff --git a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php 
b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
index 8676387..de10a5d 100644
--- a/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
+++ b/repo/tests/phpunit/includes/rdf/RdfBuilderTest.php
@@ -106,7 +106,7 @@
        /**
         * @return RdfBuilder
         */
-       private static function newRdfBuilder($produce = 
RdfProducer::PRODUCE_ALL) {
+       private static function newRdfBuilder( $produce ) {
                return new RdfBuilder(
                        self::getSiteList(),
                        self::URI_BASE,
@@ -207,7 +207,13 @@
         * @dataProvider getRdfTests
         */
        public function testRdfBuild( Entity $entity, array $correctData ) {
-               $builder = self::newRdfBuilder();
+               $builder = self::newRdfBuilder( 
RdfProducer::PRODUCE_ALL_STATEMENTS |
+                               RdfProducer::PRODUCE_TRUTHY_STATEMENTS |
+                               RdfProducer::PRODUCE_QUALIFIERS |
+                               RdfProducer::PRODUCE_REFERENCES |
+                               RdfProducer::PRODUCE_SITELINKS |
+                               RdfProducer::PRODUCE_VERSION_INFO |
+                               RdfProducer::PRODUCE_FULL_VALUES);
                $builder->addEntity( $entity );
                $builder->addEntityRevisionInfo( $entity->getId(), 42, 
"2014-11-04T03:11:05Z" );
                $this->assertEquals( $correctData, $this->getDataFromBuilder( 
$builder ) );
@@ -225,6 +231,7 @@
                        array( 'Q4', RdfProducer::PRODUCE_ALL_STATEMENTS | 
RdfProducer::PRODUCE_PROPERTIES, 'Q4_props' ),
                        array( 'Q4', RdfProducer::PRODUCE_ALL_STATEMENTS | 
RdfProducer::PRODUCE_FULL_VALUES, 'Q4_values' ),
                        array( 'Q1', RdfProducer::PRODUCE_VERSION_INFO, 
'Q1_info' ),
+                       // TODO: RdfProducer::PRODUCE_RESOLVED_ENTITIES
                );
 
                $testData = array();
@@ -247,7 +254,7 @@
        }
 
        public function testDumpHeader() {
-               $builder = self::newRdfBuilder();
+               $builder = self::newRdfBuilder( 
RdfProducer::PRODUCE_VERSION_INFO );
                $builder->addDumpHeader( 1426110695 );
                $data = $this->getDataFromBuilder( $builder );
                $this->assertEquals( $this->getSerializedData( 'dumpheader' ),  
$data);

-- 
To view, visit https://gerrit.wikimedia.org/r/196712
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I51d6377511b42eb9cf638af975e3a940550643e6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Smalyshev <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to