jenkins-bot has submitted this change and it was merged. Change subject: Track redirect revision info in RDF wdata ......................................................................
Track redirect revision info in RDF wdata This is a slightly refactored version of If32318d6e8f9 Bug: T100463 Change-Id: Ibe93c875e2d7ce5013c3c7004bed2bd4afa49c34 --- M lib/includes/store/EntityRevision.php A lib/includes/store/RedirectRevision.php A lib/includes/store/RevisionInfo.php M lib/includes/store/UnresolvedRedirectException.php M lib/includes/store/sql/WikiPageEntityRevisionLookup.php M lib/tests/phpunit/EntityRevisionLookupTest.php M lib/tests/phpunit/MockRepository.php M lib/tests/phpunit/MockRepositoryTest.php M repo/includes/Dumpers/RdfDumpGenerator.php M repo/includes/LinkedData/EntityDataRequestHandler.php M repo/includes/LinkedData/EntityDataSerializationService.php M repo/includes/rdf/RdfBuilder.php M repo/tests/phpunit/data/rdf/Q7_Q9_dedup.nt M repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php 14 files changed, 254 insertions(+), 60 deletions(-) Approvals: Smalyshev: Looks good to me, approved jenkins-bot: Verified diff --git a/lib/includes/store/EntityRevision.php b/lib/includes/store/EntityRevision.php index c49a791..955ae53 100644 --- a/lib/includes/store/EntityRevision.php +++ b/lib/includes/store/EntityRevision.php @@ -13,7 +13,7 @@ * @licence GNU GPL v2+ * @author Daniel Kinzler */ -class EntityRevision { +class EntityRevision implements RevisionInfo { /** * @var EntityDocument diff --git a/lib/includes/store/RedirectRevision.php b/lib/includes/store/RedirectRevision.php new file mode 100644 index 0000000..aa518cb --- /dev/null +++ b/lib/includes/store/RedirectRevision.php @@ -0,0 +1,79 @@ +<?php + +namespace Wikibase; + +use InvalidArgumentException; +use Wikibase\Lib\Store\EntityRedirect; + +/** + * Represents a revision of a Wikibase redirect. + * + * @since 0.5 + * + * @licence GNU GPL v2+ + * @author Daniel Kinzler + */ +class RedirectRevision implements RevisionInfo { + + /** + * @var EntityRedirect + */ + private $redirect; + + /** + * @var int + */ + private $revisionId; + + /** + * @var string + */ + private $mwTimestamp; + + /** + * @param EntityRedirect $redirect + * @param int $revisionId Revision ID or 0 for none + * @param string $mwTimestamp in MediaWiki format or an empty string for none + * + * @throws InvalidArgumentException + */ + public function __construct( EntityRedirect $redirect, $revisionId = 0, $mwTimestamp = '' ) { + if ( !is_int( $revisionId ) || $revisionId < 0 ) { + throw new InvalidArgumentException( 'Revision ID must be a non-negative integer.' ); + } + + if ( $mwTimestamp !== '' && !preg_match( '/^\d{14}$/', $mwTimestamp ) ) { + throw new InvalidArgumentException( 'Timestamp must be a string of 14 digits or empty.' ); + } + + $this->redirect = $redirect; + $this->revisionId = $revisionId; + $this->mwTimestamp = $mwTimestamp; + } + + /** + * @return EntityRedirect + */ + public function getRedirect() { + return $this->redirect; + } + + /** + * @see Revision::getId + * + * @return int + */ + public function getRevisionId() { + return $this->revisionId; + } + + /** + * @see Revision::getTimestamp + * + * @return string in MediaWiki format or an empty string + */ + public function getTimestamp() { + return $this->mwTimestamp; + } + +} diff --git a/lib/includes/store/RevisionInfo.php b/lib/includes/store/RevisionInfo.php new file mode 100644 index 0000000..327283b --- /dev/null +++ b/lib/includes/store/RevisionInfo.php @@ -0,0 +1,29 @@ +<?php + +namespace Wikibase; + +/** + * Interface for value objects that hold basic revision info. + * + * @since 0.5 + * + * @licence GNU GPL v2+ + * @author Daniel Kinzler + */ +interface RevisionInfo { + + /** + * @see Revision::getId + * + * @return int + */ + public function getRevisionId(); + + /** + * @see Revision::getTimestamp + * + * @return string in MediaWiki format or an empty string + */ + public function getTimestamp(); + +} diff --git a/lib/includes/store/UnresolvedRedirectException.php b/lib/includes/store/UnresolvedRedirectException.php index 7478d37..f8eb87d 100644 --- a/lib/includes/store/UnresolvedRedirectException.php +++ b/lib/includes/store/UnresolvedRedirectException.php @@ -2,7 +2,6 @@ namespace Wikibase\Lib\Store; -use Exception; use Wikibase\DataModel\Entity\EntityId; /** @@ -20,19 +19,26 @@ private $redirectTargetId; /** - * @param EntityId $redirectTargetId The ID of the target Entity of the redirect - * @param string|null $message - * @param int $code - * @param Exception|null $previous + * @var int */ - public function __construct( EntityId $redirectTargetId, $message = null, $code = 0, Exception $previous = null ) { - if ( $message === null ) { - $message = "Unresolved redirect to " . $redirectTargetId->getSerialization(); - } + private $revisionId; - parent::__construct( $message, $code, $previous ); + /** + * @var string + */ + private $revisionTimestamp; + + /** + * @param EntityId $redirectTargetId The ID of the target Entity of the redirect + * @param int $revisionId + * @param string $revisionTimestamp + */ + public function __construct( EntityId $redirectTargetId, $revisionId = 0, $revisionTimestamp = '' ) { + parent::__construct( "Unresolved redirect to " . $redirectTargetId->getSerialization() ); $this->redirectTargetId = $redirectTargetId; + $this->revisionId = $revisionId; + $this->revisionTimestamp = $revisionTimestamp; } /** @@ -44,4 +50,18 @@ return $this->redirectTargetId; } + /** + * @return int + */ + public function getRevisionId() { + return $this->revisionId; + } + + /** + * @return string + */ + public function getRevisionTimestamp() { + return $this->revisionTimestamp; + } + } diff --git a/lib/includes/store/sql/WikiPageEntityRevisionLookup.php b/lib/includes/store/sql/WikiPageEntityRevisionLookup.php index 9bbbf54..e12ff47 100644 --- a/lib/includes/store/sql/WikiPageEntityRevisionLookup.php +++ b/lib/includes/store/sql/WikiPageEntityRevisionLookup.php @@ -84,8 +84,7 @@ list( $entityRevision, $redirect ) = $this->loadEntity( $row ); if ( $redirect !== null ) { - // TODO: Optionally follow redirects. Doesn't make sense if a revision ID is given. - throw new UnresolvedRedirectException( $redirect->getTargetId() ); + throw new UnresolvedRedirectException( $redirect->getTargetId(), (int)$row->rev_id, $row->rev_timestamp ); } if ( $entityRevision === null ) { diff --git a/lib/tests/phpunit/EntityRevisionLookupTest.php b/lib/tests/phpunit/EntityRevisionLookupTest.php index b3185a8..23a6286 100644 --- a/lib/tests/phpunit/EntityRevisionLookupTest.php +++ b/lib/tests/phpunit/EntityRevisionLookupTest.php @@ -172,6 +172,8 @@ $this->fail( 'Expected an UnresolvedRedirectException exception when looking up a redirect.' ); } catch ( UnresolvedRedirectException $ex ) { $this->assertEquals( $expectedRedirect, $ex->getRedirectTargetId() ); + $this->assertGreaterThan( 0, $ex->getRevisionId() ); + $this->assertNotEmpty( $ex->getRevisionTimestamp() ); } } diff --git a/lib/tests/phpunit/MockRepository.php b/lib/tests/phpunit/MockRepository.php index b24d79d..3ff06c3 100644 --- a/lib/tests/phpunit/MockRepository.php +++ b/lib/tests/phpunit/MockRepository.php @@ -30,6 +30,7 @@ use Wikibase\Lib\Store\SiteLinkConflictLookup; use Wikibase\Lib\Store\StorageException; use Wikibase\Lib\Store\UnresolvedRedirectException; +use Wikibase\RedirectRevision; /** * Mock repository for use in tests. @@ -68,7 +69,7 @@ /** * Entity id serialization => EntityRedirect * - * @var EntityRedirect[] + * @var RedirectRevision[] */ private $redirects = array(); @@ -125,7 +126,12 @@ $key = $entityId->getSerialization(); if ( isset( $this->redirects[$key] ) ) { - throw new UnresolvedRedirectException( $this->redirects[$key]->getTargetId() ); + $redirRev = $this->redirects[$key]; + throw new UnresolvedRedirectException( + $redirRev->getRedirect()->getTargetId(), + $redirRev->getRevisionId(), + $redirRev->getTimestamp() + ); } if ( empty( $this->entities[$key] ) ) { @@ -357,15 +363,28 @@ * in the mock repository, it is replaced with the redirect. * * @param EntityRedirect $redirect + * @param int $revisionId + * @param string|int $timestamp */ - public function putRedirect( EntityRedirect $redirect ) { + public function putRedirect( EntityRedirect $redirect, $revisionId = 0, $timestamp = 0 ) { $key = $redirect->getEntityId()->getSerialization(); if ( isset( $this->entities[$key] ) ) { $this->removeEntity( $redirect->getEntityId() ); } - $this->redirects[$key] = $redirect; + if ( $revisionId === 0 ) { + $revisionId = ++$this->maxRevisionId; + } + + $this->maxEntityId = max( $this->maxEntityId, $redirect->getTargetId()->getNumericId() ); + $this->maxRevisionId = max( $this->maxRevisionId, $revisionId ); + + $this->redirects[$key] = new RedirectRevision( + unserialize( serialize( $redirect ) ), + $revisionId, + wfTimestamp( TS_MW, $timestamp ) + ); } /** @@ -823,7 +842,8 @@ public function getRedirectIds( EntityId $targetId ) { $redirects = array(); - foreach ( $this->redirects as $redir ) { + foreach ( $this->redirects as $redirRev ) { + $redir = $redirRev->getRedirect(); if ( $redir->getTargetId()->equals( $targetId ) ) { $redirects[] = $redir->getEntityId(); } @@ -847,7 +867,7 @@ $key = $entityId->getSerialization(); if ( isset( $this->redirects[$key] ) ) { - return $this->redirects[$key]->getTargetId(); + return $this->redirects[$key]->getRedirect()->getTargetId(); } if ( isset( $this->entities[$key] ) ) { diff --git a/lib/tests/phpunit/MockRepositoryTest.php b/lib/tests/phpunit/MockRepositoryTest.php index cd79977..9b0b74f 100644 --- a/lib/tests/phpunit/MockRepositoryTest.php +++ b/lib/tests/phpunit/MockRepositoryTest.php @@ -11,6 +11,7 @@ use Wikibase\DataModel\Entity\PropertyId; use Wikibase\DataModel\SiteLink; use Wikibase\Lib\Store\EntityRedirect; +use Wikibase\Lib\Store\UnresolvedRedirectException; /** * @covers Wikibase\Test\MockRepository @@ -618,6 +619,31 @@ $this->assertFalse( $this->repo->hasEntity( $item->getId() ) ); } + public function testPutRedirect( ) { + $redirect = new EntityRedirect( new ItemId( 'Q11' ), new ItemId( 'Q1' ) ); + $this->repo->putRedirect( $redirect ); + + try { + $this->repo->getEntityRevision( new ItemId( 'Q11' ) ); + $this->fail( 'getEntityRevision() should fail for redirects' ); + } catch ( UnresolvedRedirectException $ex ) { + $this->assertEquals( 'Q1', $ex->getRedirectTargetId()->getSerialization() ); + $this->assertGreaterThan( 0, $ex->getRevisionId() ); + $this->assertNotEmpty( $ex->getRevisionTimestamp() ); + } + + $this->repo->putRedirect( $redirect, 117, '20150505000000' ); + + try { + $this->repo->getEntityRevision( new ItemId( 'Q11' ) ); + $this->fail( 'getEntityRevision() should fail for redirects' ); + } catch ( UnresolvedRedirectException $ex ) { + $this->assertEquals( 'Q1', $ex->getRedirectTargetId()->getSerialization() ); + $this->assertEquals( 117, $ex->getRevisionId() ); + $this->assertEquals( '20150505000000', $ex->getRevisionTimestamp() ); + } + } + public function testDeleteRedirect( ) { $redirect = new EntityRedirect( new ItemId( 'Q11' ), new ItemId( 'Q1' ) ); $this->repo->putRedirect( $redirect ); diff --git a/repo/includes/Dumpers/RdfDumpGenerator.php b/repo/includes/Dumpers/RdfDumpGenerator.php index d2aebf2..cb7e8e0 100644 --- a/repo/includes/Dumpers/RdfDumpGenerator.php +++ b/repo/includes/Dumpers/RdfDumpGenerator.php @@ -114,6 +114,14 @@ } catch ( MWContentSerializationException $ex ) { throw new StorageException( 'Deserialization error for ' . $entityId->getSerialization() ); } catch ( UnresolvedRedirectException $e ) { + if ( $e->getRevisionId() > 0 ) { + $this->rdfBuilder->addEntityRevisionInfo( + $entityId, + $e->getRevisionId(), + $e->getRevisionTimestamp() + ); + } + $this->rdfBuilder->addEntityRedirect( $entityId, $e->getRedirectTargetId() diff --git a/repo/includes/LinkedData/EntityDataRequestHandler.php b/repo/includes/LinkedData/EntityDataRequestHandler.php index 8c625bd..816f17c 100644 --- a/repo/includes/LinkedData/EntityDataRequestHandler.php +++ b/repo/includes/LinkedData/EntityDataRequestHandler.php @@ -18,6 +18,8 @@ use Wikibase\Lib\Store\EntityTitleLookup; use Wikibase\Lib\Store\StorageException; use Wikibase\Lib\Store\UnresolvedRedirectException; +use Wikibase\Lib\Store\UnresolvedRedirectRevisionException; +use Wikibase\RedirectRevision; /** * Request handler implementing a linked data interface for Wikibase entities. @@ -340,7 +342,7 @@ * @param EntityId $id * @param int $revision The revision ID (use 0 for the current revision). * - * @return array list( EntityRevision, EntityRedirect|null ) + * @return array list( EntityRevision, RedirectRevision|null ) * @throws HttpError */ private function getEntityRevision( EntityId $id, $revision ) { @@ -350,7 +352,7 @@ $revision = EntityRevisionLookup::LATEST_FROM_SLAVE; } - $entityRedirect = null; + $redirectRevision = null; try { $entityRevision = $this->entityRevisionLookup->getEntityRevision( $id, $revision ); @@ -360,7 +362,10 @@ throw new HttpError( 404, wfMessage( 'wikibase-entitydata-not-found' )->params( $prefixedId ) ); } } catch ( UnresolvedRedirectException $ex ) { - $entityRedirect = new EntityRedirect( $id, $ex->getRedirectTargetId() ); + $redirectRevision = new RedirectRevision( + new EntityRedirect( $id, $ex->getRedirectTargetId() ), + $ex->getRevisionId(), $ex->getRevisionTimestamp() + ); if ( is_string( $revision ) ) { // If no specific revision is requested, resolve the redirect. @@ -381,7 +386,7 @@ throw new \HttpError( 500, $msg->params( $prefixedId, $revision ) ); } - return array( $entityRevision, $entityRedirect ); + return array( $entityRevision, $redirectRevision ); } /** @@ -418,8 +423,8 @@ $flavor = $request->getVal("flavor"); /** @var EntityRevision $entityRevision */ - /** @var EntityRedirect $followedRedirect */ - list( $entityRevision, $followedRedirect ) = $this->getEntityRevision( $id, $revision ); + /** @var RedirectRevision $followedRedirectRevision */ + list( $entityRevision, $followedRedirectRevision ) = $this->getEntityRevision( $id, $revision ); // handle If-Modified-Since $imsHeader = $request->getHeader( 'IF-MODIFIED-SINCE' ); @@ -433,7 +438,7 @@ } } - if ( $flavor === 'dump' || $revision > 0 ) { + if ( $flavor === 'dump' || $revision > 0 ) { // In dump mode and when fetching a specific revision, don't include incoming redirects. $incomingRedirects = array(); } else { @@ -444,7 +449,7 @@ list( $data, $contentType ) = $this->serializationService->getSerializedData( $format, $entityRevision, - $followedRedirect, + $followedRedirectRevision, $incomingRedirects, $flavor ); diff --git a/repo/includes/LinkedData/EntityDataSerializationService.php b/repo/includes/LinkedData/EntityDataSerializationService.php index f954be6..87d2d51 100644 --- a/repo/includes/LinkedData/EntityDataSerializationService.php +++ b/repo/includes/LinkedData/EntityDataSerializationService.php @@ -10,6 +10,7 @@ use MWException; use RequestContext; use SiteList; +use Wikibase\RedirectRevision; use Wikibase\Repo\Api\ResultBuilder; use Wikibase\DataModel\Entity\EntityId; use Wikibase\DataModel\SerializerFactory; @@ -193,7 +194,7 @@ * * @param string $format The name (mime type of file extension) of the format to use * @param EntityRevision $entityRevision The entity - * @param EntityRedirect|null $followedRedirect The redirect that led to the entity, or null + * @param RedirectRevision|null $followedRedirect The redirect that led to the entity, or null * @param EntityId[] $incomingRedirects Incoming redirects to include in the output * @param string|null $flavor The type of the output provided by serializer * @@ -203,7 +204,7 @@ public function getSerializedData( $format, EntityRevision $entityRevision, - EntityRedirect $followedRedirect = null, + RedirectRevision $followedRedirect = null, array $incomingRedirects = array(), $flavor = null ) { @@ -217,7 +218,8 @@ $serializer = $this->createApiSerializer( $formatName ); if( $serializer ) { - $data = $this->apiSerialize( $entityRevision, $followedRedirect, $incomingRedirects, $serializer ); + $redirect = ( $followedRedirect ? $followedRedirect->getRedirect() : null ); + $data = $this->apiSerialize( $entityRevision, $redirect, $incomingRedirects, $serializer ); $contentType = $serializer->getIsHtml() ? 'text/html' : $serializer->getMimeType(); } else { $rdfBuilder = $this->createRdfBuilder( $formatName, $flavor ); @@ -237,7 +239,7 @@ /** * @param EntityRevision $entityRevision - * @param EntityRedirect|null $followedRedirect a redirect leading to the entity for use in the output + * @param RedirectRevision|null $followedRedirect a redirect leading to the entity for use in the output * @param EntityId[] $incomingRedirects Incoming redirects to include in the output * @param RdfBuilder $rdfBuilder * @param string|null $flavor The type of the output provided by serializer @@ -246,20 +248,31 @@ */ private function rdfSerialize( EntityRevision $entityRevision, - EntityRedirect $followedRedirect = null, + RedirectRevision $followedRedirect = null, array $incomingRedirects, RdfBuilder $rdfBuilder, $flavor = null ) { $rdfBuilder->startDocument(); + $redir = null; if ( $followedRedirect ) { - $rdfBuilder->addEntityRedirect( $followedRedirect->getEntityId(), $followedRedirect->getTargetId() ); + $redir = $followedRedirect->getRedirect(); + $rdfBuilder->addEntityRedirect( $redir->getEntityId(), $redir->getTargetId() ); + + if ( $followedRedirect->getRevisionId() > 0 ) { + $rdfBuilder->addEntityRevisionInfo( + $redir->getEntityId(), + $followedRedirect->getRevisionId(), + $followedRedirect->getTimestamp() + ); + } } if ( $followedRedirect && $flavor === 'dump' ) { // For redirects, don't output the target entity data if the "dump" flavor is requested. // @todo: In this case, avoid loading the Entity all together. + // However we want to output the revisions for redirects } else { $rdfBuilder->addEntityRevisionInfo( $entityRevision->getEntity()->getId(), @@ -275,7 +288,7 @@ // For $flavor === 'dump' we don't need to output incoming redirects. $targetId = $entityRevision->getEntity()->getId(); - $this->addIncomingRedirects( $targetId, $followedRedirect, $incomingRedirects, $rdfBuilder ); + $this->addIncomingRedirects( $targetId, $redir, $incomingRedirects, $rdfBuilder ); } $rdfBuilder->finishDocument(); diff --git a/repo/includes/rdf/RdfBuilder.php b/repo/includes/rdf/RdfBuilder.php index b4bca0a..fb9200d 100644 --- a/repo/includes/rdf/RdfBuilder.php +++ b/repo/includes/rdf/RdfBuilder.php @@ -278,9 +278,20 @@ */ public function addEntityRevisionInfo( EntityId $entityId, $revision, $timestamp ) { $timestamp = wfTimestamp( TS_ISO_8601, $timestamp ); + $entityLName = $this->vocabulary->getEntityLName( $entityId ); $this->writer->about( RdfVocabulary::NS_DATA, $entityId ) - ->say( RdfVocabulary::NS_SCHEMA_ORG, 'version' )->value( $revision, 'xsd', 'integer' ) + ->a( RdfVocabulary::NS_SCHEMA_ORG, "Dataset" ) + ->say( RdfVocabulary::NS_SCHEMA_ORG, 'about' )->is( RdfVocabulary::NS_ENTITY, $entityLName ); + + if ( $this->shouldProduce( RdfProducer::PRODUCE_VERSION_INFO ) ) { + // Dumps don't need version/license info for each entity, since it is included in the dump header + $this->writer + ->say( RdfVocabulary::NS_CC, 'license' )->is( RdfVocabulary::LICENSE ) + ->say( RdfVocabulary::NS_SCHEMA_ORG, 'softwareVersion' )->value( RdfVocabulary::FORMAT_VERSION ); + } + + $this->writer->say( RdfVocabulary::NS_SCHEMA_ORG, 'version' )->value( $revision, 'xsd', 'integer' ) ->say( RdfVocabulary::NS_SCHEMA_ORG, 'dateModified' )->value( $timestamp, 'xsd', 'dateTime' ); } @@ -347,23 +358,9 @@ * @todo: extract into MetaDataRdfBuilder * * @param EntityDocument $entity - * @param bool $produceData Should we also produce Dataset node? */ - private function addEntityMetaData( EntityDocument $entity, $produceData = true ) { + private function addEntityMetaData( EntityDocument $entity ) { $entityLName = $this->vocabulary->getEntityLName( $entity->getId() ); - - if ( $produceData ) { - $this->writer->about( RdfVocabulary::NS_DATA, $entity->getId() ) - ->a( RdfVocabulary::NS_SCHEMA_ORG, "Dataset" ) - ->say( RdfVocabulary::NS_SCHEMA_ORG, 'about' )->is( RdfVocabulary::NS_ENTITY, $entityLName ); - - if ( $this->shouldProduce( RdfProducer::PRODUCE_VERSION_INFO ) ) { - // Dumps don't need version/license info for each entity, since it is included in the dump header - $this->writer - ->say( RdfVocabulary::NS_CC, 'license' )->is( RdfVocabulary::LICENSE ) - ->say( RdfVocabulary::NS_SCHEMA_ORG, 'softwareVersion' )->value( RdfVocabulary::FORMAT_VERSION ); - } - } $this->writer->about( RdfVocabulary::NS_ENTITY, $entityLName ) ->a( RdfVocabulary::NS_ONTOLOGY, $this->vocabulary->getEntityTypeName( $entity->getType() ) ); diff --git a/repo/tests/phpunit/data/rdf/Q7_Q9_dedup.nt b/repo/tests/phpunit/data/rdf/Q7_Q9_dedup.nt index 8be9141..fac1d48 100644 --- a/repo/tests/phpunit/data/rdf/Q7_Q9_dedup.nt +++ b/repo/tests/phpunit/data/rdf/Q7_Q9_dedup.nt @@ -59,14 +59,6 @@ <http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> <http://wikiba.se/ontology-beta#geoLatitude> "12.345"^^<http://www.w3.org/2001/XMLSchema#decimal> . <http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> <http://wikiba.se/ontology-beta#geoLongitude> "67.89"^^<http://www.w3.org/2001/XMLSchema#decimal> . <http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> <http://wikiba.se/ontology-beta#geoPrecision> "0.1"^^<http://www.w3.org/2001/XMLSchema#decimal> . -<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> . -<http://data.acme.test/Q7> <http://schema.org/softwareVersion> "0.0.1" . -<http://data.acme.test/Q7> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Dataset> . -<http://data.acme.test/Q9> <http://creativecommons.org/ns#license> <http://creativecommons.org/publicdomain/zero/1.0/> . -<http://data.acme.test/Q9> <http://schema.org/about> <http://acme.test/Q9> . -<http://data.acme.test/Q9> <http://schema.org/softwareVersion> "0.0.1" . -<http://data.acme.test/Q9> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Dataset> . <http://acme.test/value/1e09d673624819aacd170165aae555a1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#QuantityValue> . <http://acme.test/value/aad6b70bccf9875ba61d31c767b7f652> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#GlobecoordinateValue> . <http://acme.test/value/ba4fa68a0979e663277b08d93f93705c> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://wikiba.se/ontology-beta#TimeValue> . diff --git a/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php b/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php index 9eb986a..979111c 100644 --- a/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php +++ b/repo/tests/phpunit/includes/LinkedData/EntityDataSerializationServiceTest.php @@ -18,6 +18,7 @@ use Wikibase\Lib\Serializers\LibSerializerFactory; use Wikibase\Lib\Store\EntityLookup; use Wikibase\Lib\Store\EntityRedirect; +use Wikibase\RedirectRevision; use Wikibase\Repo\LinkedData\EntityDataFormatProvider; use Wikibase\Repo\LinkedData\EntityDataSerializationService; @@ -120,7 +121,10 @@ $mockRepo = $this->getMockRepository(); $entityRevQ42 = $mockRepo->getEntityRevision( new ItemId( 'Q42' ) ); $entityRevQ23 = $mockRepo->getEntityRevision( new ItemId( 'Q23' ) ); - $entityRedirQ2233 = new EntityRedirect( new ItemId( 'Q2233' ), new ItemId( 'Q23' ) ); + $entityRedirQ2233 = new RedirectRevision( + new EntityRedirect( new ItemId( 'Q2233' ), new ItemId( 'Q23' ) ), + 127, '20150505000000' + ); $q2233 = new ItemId( 'Q2233' ); $q222333 = new ItemId( 'Q222333' ); @@ -282,7 +286,7 @@ public function testGetSerializedData( $format, EntityRevision $entityRev, - EntityRedirect $followedRedirect = null, + RedirectRevision $followedRedirect = null, array $incomingRedirects, $flavor, array $expectedDataExpressions, -- To view, visit https://gerrit.wikimedia.org/r/223345 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibe93c875e2d7ce5013c3c7004bed2bd4afa49c34 Gerrit-PatchSet: 5 Gerrit-Project: mediawiki/extensions/Wikibase Gerrit-Branch: master Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Aude <aude.w...@gmail.com> Gerrit-Reviewer: Daniel Kinzler <daniel.kinz...@wikimedia.de> Gerrit-Reviewer: Smalyshev <smalys...@wikimedia.org> Gerrit-Reviewer: Thiemo Mättig (WMDE) <thiemo.maet...@wikimedia.de> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits