jenkins-bot has submitted this change and it was merged.

Change subject: Remove ClaimsTable
......................................................................


Remove ClaimsTable

As initial step we will just link snaks to their subject entities.
The claims table is thus not needed. Removing it since it was in
need of further work otherwise. Can revert this commit at a later
point when we need the functionality enabled by this table.

Change-Id: I1dc6101e38be494038999d6c9b7d80c8e1b6addd
---
M src/SQLStore/ClaimStore/ClaimInserter.php
D src/SQLStore/ClaimStore/ClaimsTable.php
M src/SQLStore/EntityRemover.php
M src/SQLStore/Factory.php
M src/SQLStore/Schema.php
M src/SQLStore/SnakStore/SnakInserter.php
M src/SQLStore/SnakStore/SnakRow.php
M src/SQLStore/SnakStore/SnakRowBuilder.php
M src/SQLStore/SnakStore/ValueSnakRow.php
M src/SQLStore/SnakStore/ValueSnakStore.php
M src/SQLStore/SnakStore/ValuelessSnakRow.php
M src/SQLStore/SnakStore/ValuelessSnakStore.php
M src/SQLStore/Writer.php
M tests/phpunit/SQLStore/ClaimStore/ClaimInserterTest.php
D tests/phpunit/SQLStore/ClaimStore/ClaimsTableTest.php
M tests/phpunit/SQLStore/EntityRemoverTest.php
M tests/phpunit/SQLStore/FactoryTest.php
M tests/phpunit/SQLStore/SnakStore/ValueSnakRowTest.php
M tests/phpunit/SQLStore/SnakStore/ValueSnakStoreTest.php
M tests/phpunit/SQLStore/SnakStore/ValuelessSnakRowTest.php
M tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
21 files changed, 26 insertions(+), 382 deletions(-)

Approvals:
  Denny Vrandecic: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/src/SQLStore/ClaimStore/ClaimInserter.php 
b/src/SQLStore/ClaimStore/ClaimInserter.php
index a6646ec..ac4bde3 100644
--- a/src/SQLStore/ClaimStore/ClaimInserter.php
+++ b/src/SQLStore/ClaimStore/ClaimInserter.php
@@ -21,12 +21,10 @@
  */
 class ClaimInserter {
 
-       protected $claimsTable;
        protected $snakInserter;
        protected $claimRowBuilder;
 
-       public function __construct( ClaimsTable $claimsTable, SnakInserter 
$snakInserter, ClaimRowBuilder $claimRowBuilder ) {
-               $this->claimsTable = $claimsTable;
+       public function __construct( SnakInserter $snakInserter, 
ClaimRowBuilder $claimRowBuilder ) {
                $this->snakInserter = $snakInserter;
                $this->claimRowBuilder = $claimRowBuilder;
        }
@@ -36,25 +34,19 @@
         * @param int $internalSubjectId
         */
        public function insertClaim( Claim $claim, $internalSubjectId ) {
-               $internalClaimId = $this->insertIntoClaimsTable( $claim, 
$internalSubjectId );
-               $this->insertSnaks( $claim, $internalClaimId, 
$internalSubjectId );
+               $this->insertSnaks( $claim, $internalSubjectId );
        }
 
-       protected function insertIntoClaimsTable( Claim $claim, 
$internalSubjectId ) {
-               $claimRow = $this->claimRowBuilder->newClaimRow( $claim, 
$internalSubjectId );
-               return $this->claimsTable->insertClaimRow( $claimRow );
-       }
-
-       protected function insertSnaks( Claim $claim, $internalClaimId, 
$internalSubjectId ) {
-               $this->insertSnak( $claim->getMainSnak(), SnakRole::MAIN_SNAK, 
$internalClaimId, $internalSubjectId );
+       protected function insertSnaks( Claim $claim, $internalSubjectId ) {
+               $this->insertSnak( $claim->getMainSnak(), SnakRole::MAIN_SNAK, 
$internalSubjectId );
 
                foreach ( $claim->getQualifiers() as $qualifier ) {
-                       $this->insertSnak( $qualifier, SnakRole::QUALIFIER, 
$internalClaimId, $internalSubjectId );
+                       $this->insertSnak( $qualifier, SnakRole::QUALIFIER, 
$internalSubjectId );
                }
        }
 
-       protected function insertSnak( Snak $snak, $snakRole, $internalClaimId, 
$internalSubjectId ) {
-               $this->snakInserter->insertSnak( $snak, $snakRole, 
$internalClaimId, $internalSubjectId );
+       protected function insertSnak( Snak $snak, $snakRole, 
$internalSubjectId ) {
+               $this->snakInserter->insertSnak( $snak, $snakRole, 
$internalSubjectId );
        }
 
 }
diff --git a/src/SQLStore/ClaimStore/ClaimsTable.php 
b/src/SQLStore/ClaimStore/ClaimsTable.php
deleted file mode 100644
index 700cb8c..0000000
--- a/src/SQLStore/ClaimStore/ClaimsTable.php
+++ /dev/null
@@ -1,68 +0,0 @@
-<?php
-
-namespace Wikibase\QueryEngine\SQLStore\ClaimStore;
-
-use InvalidArgumentException;
-use Wikibase\Database\QueryInterface;
-
-/**
- * Interface to the claims table.
- *
- * This is not a "claims store" since it does not store whole claims,
- * merely their id mapping and some other non-claim-value information.
- *
- * @since 0.1
- *
- * @file
- * @ingroup WikibaseSQLStore
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class ClaimsTable {
-
-       protected $queryInterface;
-       protected $tableName;
-
-       /**
-        * @param QueryInterface $queryInterface
-        * @param string $tableName
-        */
-       public function __construct( QueryInterface $queryInterface, $tableName 
) {
-               $this->queryInterface = $queryInterface;
-               $this->tableName = $tableName;
-       }
-
-       public function insertClaimRow( ClaimRow $claimRow ) {
-               if ( $claimRow->getInternalId() !== null ) {
-                       throw new InvalidArgumentException( 'Cannot insert a 
ClaimRow that already has an ID' );
-               }
-
-               $this->queryInterface->insert(
-                       $this->tableName,
-                       $this->getWriteValues( $claimRow )
-               );
-
-               return $this->queryInterface->getInsertId();
-       }
-
-       protected function getWriteValues( ClaimRow $claimRow ) {
-               return array(
-                       'guid' => $claimRow->getExternalGuid(),
-                       'subject_id' => $claimRow->getInternalSubjectId(),
-                       'property_id' => $claimRow->getInternalPropertyId(),
-                       'rank' => $claimRow->getRank(),
-                       'hash' => $claimRow->getHash(),
-               );
-       }
-
-       public function removeClaimsOfSubject( $internalSubjectId ) {
-               $this->queryInterface->delete(
-                       $this->tableName,
-                       array(
-                               'subject_id' => $internalSubjectId
-                       )
-               );
-       }
-
-}
diff --git a/src/SQLStore/EntityRemover.php b/src/SQLStore/EntityRemover.php
index 1cf1877..ee3ca3b 100644
--- a/src/SQLStore/EntityRemover.php
+++ b/src/SQLStore/EntityRemover.php
@@ -4,8 +4,6 @@
 
 use Wikibase\Entity;
 use Wikibase\EntityId;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimRemover;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable;
 use Wikibase\QueryEngine\SQLStore\SnakStore\SnakRemover;
 
 /**
@@ -21,19 +19,16 @@
  */
 class EntityRemover {
 
-       private $claimsTable;
        private $idFinder;
        private $snakRemover;
 
        /**
         * @since 0.1
         *
-        * @param ClaimsTable $claimsTable
         * @param SnakRemover $snakRemover
         * @param InternalEntityIdFinder $idFinder
         */
-       public function __construct( ClaimsTable $claimsTable, SnakRemover 
$snakRemover, InternalEntityIdFinder $idFinder ) {
-               $this->claimsTable = $claimsTable;
+       public function __construct( SnakRemover $snakRemover, 
InternalEntityIdFinder $idFinder ) {
                $this->idFinder = $idFinder;
                $this->snakRemover = $snakRemover;
        }
@@ -46,7 +41,6 @@
        public function removeEntity( Entity $entity ) {
                $internalSubjectId = $this->getInternalId( $entity->getId() );
 
-               $this->claimsTable->removeClaimsOfSubject( $internalSubjectId );
                $this->snakRemover->removeSnaksOfSubject( $internalSubjectId );
 
                // TODO: obtain and remove virtual claims
diff --git a/src/SQLStore/Factory.php b/src/SQLStore/Factory.php
index 64cfa61..43ea71c 100644
--- a/src/SQLStore/Factory.php
+++ b/src/SQLStore/Factory.php
@@ -6,7 +6,6 @@
 use Wikibase\Database\TableBuilder;
 use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimInserter;
 use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimRowBuilder;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable;
 use Wikibase\QueryEngine\SQLStore\Engine\DescriptionMatchFinder;
 use Wikibase\QueryEngine\SQLStore\SnakStore\SnakInserter;
 use Wikibase\QueryEngine\SQLStore\SnakStore\SnakRemover;
@@ -73,7 +72,6 @@
 
        public function newEntityRemover() {
                return new EntityRemover(
-                       $this->newClaimsTable(),
                        $this->newSnakRemover(),
                        $this->getInternalEntityIdFinder()
                );
@@ -92,16 +90,8 @@
 
        public function newClaimInserter() {
                return new ClaimInserter(
-                       $this->newClaimsTable(),
                        $this->newSnakInserter(),
                        new ClaimRowBuilder( $this->getInternalEntityIdFinder() 
)
-               );
-       }
-
-       public function newClaimsTable() {
-               return new ClaimsTable(
-                       $this->queryInterface,
-                       $this->getSchema()->getClaimsTable()->getName()
                );
        }
 
diff --git a/src/SQLStore/Schema.php b/src/SQLStore/Schema.php
index 4b58259..06b8c59 100644
--- a/src/SQLStore/Schema.php
+++ b/src/SQLStore/Schema.php
@@ -182,16 +182,6 @@
         */
        private function getPropertySnakFields() {
                return array(
-                       // Internal claim id
-                       new FieldDefinition(
-                               'claim_id',
-                               FieldDefinition::TYPE_INTEGER,
-                               FieldDefinition::NOT_NULL,
-                               FieldDefinition::NO_DEFAULT,
-                               FieldDefinition::ATTRIB_UNSIGNED,
-                               FieldDefinition::NO_INDEX
-                       ),
-
                        // Internal subject id
                        new FieldDefinition(
                                'subject_id',
@@ -283,78 +273,6 @@
         *
         * @return TableDefinition
         */
-       public function getClaimsTable() {
-               return new TableDefinition(
-                       $this->config->getTablePrefix() . 'claims',
-                       array(
-                                // Internal id
-                                new FieldDefinition(
-                                        'id',
-                                        FieldDefinition::TYPE_INTEGER,
-                                        FieldDefinition::NOT_NULL,
-                                        FieldDefinition::NO_DEFAULT,
-                                        FieldDefinition::ATTRIB_UNSIGNED,
-                                        FieldDefinition::INDEX_PRIMARY
-                                ),
-
-                                // External id
-                                new FieldDefinition(
-                                        'guid',
-                                        FieldDefinition::TYPE_TEXT,
-                                        FieldDefinition::NOT_NULL,
-                                        FieldDefinition::NO_DEFAULT,
-                                        FieldDefinition::ATTRIB_UNSIGNED,
-                                        FieldDefinition::INDEX
-                                ),
-
-                                // Internal id of the claims subject
-                                new FieldDefinition(
-                                        'subject_id',
-                                        FieldDefinition::TYPE_INTEGER,
-                                        FieldDefinition::NOT_NULL,
-                                        FieldDefinition::NO_DEFAULT,
-                                        FieldDefinition::ATTRIB_UNSIGNED,
-                                        FieldDefinition::INDEX
-                                ),
-
-                                // Internal id of the property of the main snak
-                                new FieldDefinition(
-                                        'property_id',
-                                        FieldDefinition::TYPE_INTEGER,
-                                        FieldDefinition::NOT_NULL,
-                                        FieldDefinition::NO_DEFAULT,
-                                        FieldDefinition::ATTRIB_UNSIGNED,
-                                        FieldDefinition::INDEX
-                                ),
-
-                                // Rank
-                                new FieldDefinition(
-                                        'rank',
-                                        FieldDefinition::TYPE_INTEGER,
-                                        FieldDefinition::NOT_NULL,
-                                        FieldDefinition::NO_DEFAULT,
-                                        FieldDefinition::ATTRIB_UNSIGNED,
-                                        FieldDefinition::INDEX
-                                ),
-
-                                // Hash
-                                new FieldDefinition(
-                                        'hash',
-                                        FieldDefinition::TYPE_TEXT,
-                                        FieldDefinition::NOT_NULL,
-                                        FieldDefinition::NO_DEFAULT,
-                                        FieldDefinition::NO_ATTRIB,
-                                        FieldDefinition::INDEX
-                                ),
-                       )
-               );
-       }
-
-       /**
-        * @since 0.1
-        *
-        * @return TableDefinition
-        */
        public function getValuelessSnaksTable() {
                return new TableDefinition(
                        $this->config->getTablePrefix() . 'valueless_snaks',
@@ -398,9 +316,6 @@
 
                // Id map with Wikibase EntityId to internal SQL store id
                $tables[] = $this->getEntitiesTable();
-
-               // Claim id table
-               $tables[] = $this->getClaimsTable();
 
                // Table for snaks without a value
                $tables[] = $this->getValuelessSnaksTable();
diff --git a/src/SQLStore/SnakStore/SnakInserter.php 
b/src/SQLStore/SnakStore/SnakInserter.php
index 2874da8..853c9cd 100644
--- a/src/SQLStore/SnakStore/SnakInserter.php
+++ b/src/SQLStore/SnakStore/SnakInserter.php
@@ -38,11 +38,10 @@
         *
         * @param Snak $snak
         * @param int $snakRole
-        * @param int $internalClaimId
         * @param int $internalSubjectId
         */
-       public function insertSnak( Snak $snak, $snakRole, $internalClaimId, 
$internalSubjectId ) {
-               $snakRow = $this->snakRowBuilder->newSnakRow( $snak, $snakRole, 
$internalClaimId, $internalSubjectId );
+       public function insertSnak( Snak $snak, $snakRole, $internalSubjectId ) 
{
+               $snakRow = $this->snakRowBuilder->newSnakRow( $snak, $snakRole, 
$internalSubjectId );
                $this->insertSnakRow( $snakRow );
        }
 
diff --git a/src/SQLStore/SnakStore/SnakRow.php 
b/src/SQLStore/SnakStore/SnakRow.php
index a498beb..62a045e 100644
--- a/src/SQLStore/SnakStore/SnakRow.php
+++ b/src/SQLStore/SnakStore/SnakRow.php
@@ -16,19 +16,16 @@
 abstract class SnakRow {
 
        protected $internalPropertyId;
-       protected $internalClaimId;
        protected $snakRole;
        protected $internalSubjectId;
 
        /**
         * @param int $internalPropertyId
-        * @param int $internalClaimId
         * @param int $snakRole
         * @param int $internalSubjectId
         */
-       public function __construct( $internalPropertyId, $internalClaimId, 
$snakRole, $internalSubjectId ) {
+       public function __construct( $internalPropertyId, $snakRole, 
$internalSubjectId ) {
                $this->internalPropertyId = $internalPropertyId;
-               $this->internalClaimId = $internalClaimId;
                $this->snakRole = $snakRole;
                $this->internalSubjectId = $internalSubjectId;
        }
@@ -38,13 +35,6 @@
         */
        public function getInternalPropertyId() {
                return $this->internalPropertyId;
-       }
-
-       /**
-        * @return int
-        */
-       public function getInternalClaimId() {
-               return $this->internalClaimId;
        }
 
        /**
diff --git a/src/SQLStore/SnakStore/SnakRowBuilder.php 
b/src/SQLStore/SnakStore/SnakRowBuilder.php
index e9969fa..edd44ba 100644
--- a/src/SQLStore/SnakStore/SnakRowBuilder.php
+++ b/src/SQLStore/SnakStore/SnakRowBuilder.php
@@ -34,42 +34,39 @@
         *
         * @param Snak $snak
         * @param int $snakRole
-        * @param int $internalClaimId
         * @param int $internalSubjectId
         *
         * @return SnakRow
         * @throws InvalidArgumentException
         */
-       public function newSnakRow( Snak $snak, $snakRole, $internalClaimId, 
$internalSubjectId ) {
+       public function newSnakRow( Snak $snak, $snakRole, $internalSubjectId ) 
{
                if ( $snak instanceof PropertyValueSnak ) {
-                       return $this->newValueSnakRow( $snak, $snakRole, 
$internalClaimId, $internalSubjectId );
+                       return $this->newValueSnakRow( $snak, $snakRole, 
$internalSubjectId );
                }
 
                if ( $snak instanceof PropertySomeValueSnak || $snak instanceof 
PropertyNoValueSnak ) {
-                       return $this->newValuelessSnakRow( $snak, $snakRole, 
$internalClaimId, $internalSubjectId );
+                       return $this->newValuelessSnakRow( $snak, $snakRole, 
$internalSubjectId );
                }
 
                throw new InvalidArgumentException( 'Got a snak type no 
supported by the SnakRowBuilder' );
        }
 
-       protected function newValueSnakRow( PropertyValueSnak $snak, $snakRole, 
$internalClaimId, $internalSubjectId ) {
+       protected function newValueSnakRow( PropertyValueSnak $snak, $snakRole, 
$internalSubjectId ) {
                return new ValueSnakRow(
                        $snak->getDataValue(),
                        $this->getInternalIdFor( $snak->getPropertyId() ),
-                       $internalClaimId,
                        $snakRole,
                        $internalSubjectId
                );
        }
 
-       protected function newValuelessSnakRow( Snak $snak, $snakRole, 
$internalClaimId, $internalSubjectId ) {
+       protected function newValuelessSnakRow( Snak $snak, $snakRole, 
$internalSubjectId ) {
                $internalSnakType = $snak instanceof PropertySomeValueSnak
                        ? ValuelessSnakRow::TYPE_SOME_VALUE : 
ValuelessSnakRow::TYPE_NO_VALUE;
 
                return new ValuelessSnakRow(
                        $internalSnakType,
                        $this->getInternalIdFor( $snak->getPropertyId() ),
-                       $internalClaimId,
                        $snakRole,
                        $internalSubjectId
                );
diff --git a/src/SQLStore/SnakStore/ValueSnakRow.php 
b/src/SQLStore/SnakStore/ValueSnakRow.php
index 5dacb46..a8e22f4 100644
--- a/src/SQLStore/SnakStore/ValueSnakRow.php
+++ b/src/SQLStore/SnakStore/ValueSnakRow.php
@@ -35,12 +35,11 @@
        /**
         * @param DataValue $value
         * @param int $internalPropertyId
-        * @param int $internalClaimId
         * @param int $snakRole
         * @param $internalSubjectId
         */
-       public function __construct( DataValue $value, $internalPropertyId, 
$internalClaimId, $snakRole, $internalSubjectId ) {
-               parent::__construct( $internalPropertyId, $internalClaimId, 
$snakRole, $internalSubjectId );
+       public function __construct( DataValue $value, $internalPropertyId, 
$snakRole, $internalSubjectId ) {
+               parent::__construct( $internalPropertyId, $snakRole, 
$internalSubjectId );
 
                $this->value = $value;
        }
diff --git a/src/SQLStore/SnakStore/ValueSnakStore.php 
b/src/SQLStore/SnakStore/ValueSnakStore.php
index 4f3e80e..3ec08dc 100644
--- a/src/SQLStore/SnakStore/ValueSnakStore.php
+++ b/src/SQLStore/SnakStore/ValueSnakStore.php
@@ -84,7 +84,6 @@
 
                $insertValues = array_merge(
                        array(
-                               'claim_id' => $snakRow->getInternalClaimId(),
                                'property_id' => 
$snakRow->getInternalPropertyId(),
                                'subject_id' => 
$snakRow->getInternalSubjectId(),
                        ),
diff --git a/src/SQLStore/SnakStore/ValuelessSnakRow.php 
b/src/SQLStore/SnakStore/ValuelessSnakRow.php
index 022ee87..12f4e78 100644
--- a/src/SQLStore/SnakStore/ValuelessSnakRow.php
+++ b/src/SQLStore/SnakStore/ValuelessSnakRow.php
@@ -38,18 +38,17 @@
        /**
         * @param int $internalSnakType
         * @param int $internalPropertyId
-        * @param int $internalClaimId
         * @param int $snakRole
         * @param int $internalSubjectId
         *
         * @throws InvalidArgumentException
         */
-       public function __construct( $internalSnakType, $internalPropertyId, 
$internalClaimId, $snakRole, $internalSubjectId ) {
+       public function __construct( $internalSnakType, $internalPropertyId, 
$snakRole, $internalSubjectId ) {
                if ( !in_array( $internalSnakType, array( self::TYPE_NO_VALUE, 
self::TYPE_SOME_VALUE ), true ) ) {
                        throw new InvalidArgumentException( 'Invalid internal 
snak type provided' );
                }
 
-               parent::__construct( $internalPropertyId, $internalClaimId, 
$snakRole, $internalSubjectId );
+               parent::__construct( $internalPropertyId, $snakRole, 
$internalSubjectId );
 
                $this->internalSnakType = $internalSnakType;
        }
diff --git a/src/SQLStore/SnakStore/ValuelessSnakStore.php 
b/src/SQLStore/SnakStore/ValuelessSnakStore.php
index 8f57013..57c3315 100644
--- a/src/SQLStore/SnakStore/ValuelessSnakStore.php
+++ b/src/SQLStore/SnakStore/ValuelessSnakStore.php
@@ -55,7 +55,6 @@
                $this->queryInterface->insert(
                        $this->tableName,
                        array(
-                               'claim_id' => $snakRow->getInternalClaimId(),
                                'property_id' => 
$snakRow->getInternalPropertyId(),
                                'subject_id' => 
$snakRow->getInternalSubjectId(),
                                'snak_type' => $snakRow->getInternalSnakType(),
diff --git a/src/SQLStore/Writer.php b/src/SQLStore/Writer.php
index e0720f5..183cdf7 100644
--- a/src/SQLStore/Writer.php
+++ b/src/SQLStore/Writer.php
@@ -3,20 +3,9 @@
 namespace Wikibase\QueryEngine\SQLStore;
 
 use Wikibase\Claim;
-use Wikibase\Database\QueryInterface;
 use Wikibase\Entity;
-use Wikibase\EntityId;
 use Wikibase\QueryEngine\QueryStoreWriter;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimInserter;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimRowBuilder;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable;
-use Wikibase\QueryEngine\SQLStore\SnakStore\SnakInserter;
-use Wikibase\QueryEngine\SQLStore\SnakStore\SnakRowBuilder;
-use Wikibase\QueryEngine\SQLStore\SnakStore\SnakStore;
-use Wikibase\QueryEngine\SQLStore\SnakStore\ValueSnakStore;
 use Wikibase\QueryEngine\SQLStore\SnakStore\ValuelessSnakRow;
-use Wikibase\QueryEngine\SQLStore\SnakStore\ValuelessSnakStore;
-use Wikibase\SnakRole;
 
 /**
  * Class responsible for writing information to the SQLStore.
diff --git a/tests/phpunit/SQLStore/ClaimStore/ClaimInserterTest.php 
b/tests/phpunit/SQLStore/ClaimStore/ClaimInserterTest.php
index 6313886..91e4e1b 100644
--- a/tests/phpunit/SQLStore/ClaimStore/ClaimInserterTest.php
+++ b/tests/phpunit/SQLStore/ClaimStore/ClaimInserterTest.php
@@ -79,11 +79,6 @@
         * @dataProvider claimProvider
         */
        public function testInsertClaim( Claim $claim ) {
-               $claimTable = $this->getMockBuilder( 
'Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable' )
-                       ->disableOriginalConstructor()->getMock();
-
-               $claimTable->expects( $this->once() )->method( 'insertClaimRow' 
);
-
                $snakInserter = $this->getMockBuilder( 
'Wikibase\QueryEngine\SQLStore\SnakStore\SnakInserter' )
                        ->disableOriginalConstructor()->getMock();
 
@@ -96,7 +91,7 @@
 
                $claimRowBuilder = new ClaimRowBuilder( $idFinder );
 
-               $claimInserter = new ClaimInserter( $claimTable, $snakInserter, 
$claimRowBuilder );
+               $claimInserter = new ClaimInserter( $snakInserter, 
$claimRowBuilder );
 
                $claimInserter->insertClaim( $claim, new EntityId( 'item', 1 ) 
);
        }
diff --git a/tests/phpunit/SQLStore/ClaimStore/ClaimsTableTest.php 
b/tests/phpunit/SQLStore/ClaimStore/ClaimsTableTest.php
deleted file mode 100644
index aa85e8b..0000000
--- a/tests/phpunit/SQLStore/ClaimStore/ClaimsTableTest.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<?php
-
-namespace Wikibase\QueryEngine\Tests\SQLStore\ClaimStore;
-
-use Wikibase\Database\QueryInterface;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimRow;
-use Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable;
-use Wikibase\Statement;
-
-/**
- * @covers  Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable
- *
- * @file
- * @since 0.1
- *
- * @ingroup WikibaseQueryEngineTest
- *
- * @group Wikibase
- * @group WikibaseQueryEngine
- *
- * @licence GNU GPL v2+
- * @author Jeroen De Dauw < [email protected] >
- */
-class ClaimsTableTest extends \PHPUnit_Framework_TestCase {
-
-       protected function getInstance( QueryInterface $queryInterface ) {
-               return new ClaimsTable( $queryInterface, 'test_claims' );
-       }
-
-       public function claimRowProvider() {
-               $argLists = array();
-
-               $argLists[] = array( new ClaimRow(
-                       null,
-                       'foo-bar-guid',
-                       2,
-                       3,
-                       Statement::RANK_NORMAL,
-                       sha1( 'NyanData' )
-               ) );
-
-               $argLists[] = array( new ClaimRow(
-                       null,
-                       'foo-bar-baz-guid',
-                       31337,
-                       7201010,
-                       Statement::RANK_PREFERRED,
-                       sha1( 'danweeds' )
-               ) );
-
-               return $argLists;
-       }
-
-       /**
-        * @dataProvider claimRowProvider
-        */
-       public function testInsertClaimRow( ClaimRow $claimRow ) {
-               $queryInterface = $this->getMock( 
'Wikibase\Database\QueryInterface' );
-               $queryInterface->expects( $this->once() )
-                       ->method( 'getInsertId' )
-                       ->will( $this->returnValue( 42 ) );
-
-               $table = $this->getInstance( $queryInterface );
-
-               $queryInterface->expects( $this->once() )
-                       ->method( 'insert' )
-                       ->with(
-                               $this->equalTo( 'test_claims' )
-                       );
-
-               $insertionId = $table->insertClaimRow( $claimRow );
-               $this->assertInternalType( 'int', $insertionId );
-               $this->assertEquals( 42, $insertionId );
-       }
-
-       public function testInsertRowWithId() {
-               $claimRow = new ClaimRow(
-                       42,
-                       'foo-bar-baz-guid',
-                       31337,
-                       7201010,
-                       Statement::RANK_PREFERRED,
-                       sha1( 'danweeds' )
-               );
-
-               $table = $this->getInstance( $this->getMock( 
'Wikibase\Database\QueryInterface' ) );
-
-               $this->setExpectedException( 'InvalidArgumentException' );
-               $table->insertClaimRow( $claimRow );
-       }
-
-       public function testRemoveClaimsOfSubject() {
-               $tableName = 'test_claims';
-               $subjectId = 1234;
-
-               $queryInterface = $this->getMock( 
'Wikibase\Database\QueryInterface' );
-               $queryInterface->expects( $this->once() )
-                       ->method( 'delete' )
-                       ->with(
-                               $this->equalTo( $tableName ),
-                               $this->equalTo( array( 'subject_id' => 
$subjectId ) )
-                       );
-
-               $table = new ClaimsTable( $queryInterface, $tableName );
-
-               $table->removeClaimsOfSubject( $subjectId );
-       }
-
-}
diff --git a/tests/phpunit/SQLStore/EntityRemoverTest.php 
b/tests/phpunit/SQLStore/EntityRemoverTest.php
index 45374ac..598741a 100644
--- a/tests/phpunit/SQLStore/EntityRemoverTest.php
+++ b/tests/phpunit/SQLStore/EntityRemoverTest.php
@@ -34,15 +34,6 @@
        public function testRemoveEntity( Entity $entity ) {
                $internalSubjectId = 9001;
 
-               $claimTable = $this
-                       ->getMockBuilder( 
'Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable' )
-                       ->disableOriginalConstructor()
-                       ->getMock();
-
-               $claimTable->expects( $this->once() )
-                       ->method( 'removeClaimsOfSubject' )
-                       ->with( $this->equalTo( $internalSubjectId ) );
-
                $snakRemover = $this->getMockBuilder( 
'Wikibase\QueryEngine\SQLStore\SnakStore\SnakRemover' )
                        ->disableOriginalConstructor()
                        ->getMock();
@@ -60,7 +51,7 @@
                        )
                        ->will( $this->returnValue( $internalSubjectId ) );
 
-               $remover = new EntityRemover( $claimTable, $snakRemover, 
$idFinder );
+               $remover = new EntityRemover( $snakRemover, $idFinder );
 
                $remover->removeEntity( $entity );
        }
diff --git a/tests/phpunit/SQLStore/FactoryTest.php 
b/tests/phpunit/SQLStore/FactoryTest.php
index 0b47dcd..d70e841 100644
--- a/tests/phpunit/SQLStore/FactoryTest.php
+++ b/tests/phpunit/SQLStore/FactoryTest.php
@@ -63,13 +63,6 @@
                );
        }
 
-       public function testNewClaimsTableReturnType() {
-               $this->assertInstanceOf(
-                       'Wikibase\QueryEngine\SQLStore\ClaimStore\ClaimsTable',
-                       $this->newInstance()->newClaimsTable()
-               );
-       }
-
        public function testGetTableBuilderReturnType() {
                $this->assertInstanceOf(
                        'Wikibase\Database\TableBuilder',
diff --git a/tests/phpunit/SQLStore/SnakStore/ValueSnakRowTest.php 
b/tests/phpunit/SQLStore/SnakStore/ValueSnakRowTest.php
index 424a303..cd37b44 100644
--- a/tests/phpunit/SQLStore/SnakStore/ValueSnakRowTest.php
+++ b/tests/phpunit/SQLStore/SnakStore/ValueSnakRowTest.php
@@ -30,7 +30,6 @@
                $argLists[] = array(
                        new StringValue( 'foobar baz' ),
                        2,
-                       3,
                        SnakRole::QUALIFIER,
                        4
                );
@@ -38,7 +37,6 @@
                $argLists[] = array(
                        new MonolingualTextValue( 'en', 'foobar baz' ),
                        9001,
-                       9002,
                        SnakRole::QUALIFIER,
                        9003
                );
@@ -49,12 +47,11 @@
        /**
         * @dataProvider constructorProvider
         */
-       public function testConstructor( DataValue $value, $internalPropertyId, 
$internalClaimId, $snakRole, $internalSubjectId ) {
-               $snakRow = new ValueSnakRow( $value, $internalPropertyId, 
$internalClaimId, $snakRole, $internalSubjectId );
+       public function testConstructor( DataValue $value, $internalPropertyId, 
$snakRole, $internalSubjectId ) {
+               $snakRow = new ValueSnakRow( $value, $internalPropertyId, 
$snakRole, $internalSubjectId );
 
                $this->assertTrue( $value->equals( $snakRow->getValue() ) );
                $this->assertEquals( $internalPropertyId, 
$snakRow->getInternalPropertyId() );
-               $this->assertEquals( $internalClaimId, 
$snakRow->getInternalClaimId() );
                $this->assertEquals( $snakRole, $snakRow->getSnakRole() );
                $this->assertEquals( $internalSubjectId, 
$snakRow->getInternalSubjectId() );
        }
diff --git a/tests/phpunit/SQLStore/SnakStore/ValueSnakStoreTest.php 
b/tests/phpunit/SQLStore/SnakStore/ValueSnakStoreTest.php
index 7133273..0a5d344 100644
--- a/tests/phpunit/SQLStore/SnakStore/ValueSnakStoreTest.php
+++ b/tests/phpunit/SQLStore/SnakStore/ValueSnakStoreTest.php
@@ -59,7 +59,6 @@
                $argLists[] = array( new ValueSnakRow(
                        new StringValue( 'nyan' ),
                        1,
-                       1,
                        SnakRole::MAIN_SNAK,
                        0
                ) );
@@ -74,7 +73,6 @@
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_NO_VALUE,
                        1,
-                       1,
                        SnakRole::QUALIFIER,
                        1
                ) );
@@ -82,14 +80,12 @@
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_NO_VALUE,
                        1,
-                       1,
                        SnakRole::MAIN_SNAK,
                        1
                ) );
 
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_SOME_VALUE,
-                       1,
                        1,
                        SnakRole::QUALIFIER,
                        1
@@ -98,14 +94,12 @@
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_SOME_VALUE,
                        1,
-                       1,
                        SnakRole::MAIN_SNAK,
                        1
                ) );
 
                $argLists[] = array( new ValueSnakRow(
                        new StringValue( 'nyan' ),
-                       1,
                        1,
                        SnakRole::QUALIFIER,
                        0
@@ -129,7 +123,6 @@
                                $this->equalTo(
                                        array_merge(
                                                array(
-                                                       'claim_id' => 
$snakRow->getInternalClaimId(),
                                                        'property_id' => 
$snakRow->getInternalPropertyId(),
                                                        'subject_id' => 
$snakRow->getInternalSubjectId(),
                                                ),
diff --git a/tests/phpunit/SQLStore/SnakStore/ValuelessSnakRowTest.php 
b/tests/phpunit/SQLStore/SnakStore/ValuelessSnakRowTest.php
index 34df3ee..285f82f 100644
--- a/tests/phpunit/SQLStore/SnakStore/ValuelessSnakRowTest.php
+++ b/tests/phpunit/SQLStore/SnakStore/ValuelessSnakRowTest.php
@@ -27,7 +27,6 @@
                $argLists[] = array(
                        ValuelessSnakRow::TYPE_NO_VALUE,
                        9001,
-                       31337,
                        SnakRole::MAIN_SNAK,
                        321
                );
@@ -35,7 +34,6 @@
                $argLists[] = array(
                        ValuelessSnakRow::TYPE_SOME_VALUE,
                        9002,
-                       1337,
                        SnakRole::QUALIFIER,
                        123
                );
@@ -46,11 +44,10 @@
        /**
         * @dataProvider constructorProvider
         */
-       public function testConstructor( $internalSnakType, 
$internalPropertyId, $internalClaimId, $snakRole, $internalSubjectId ) {
-               $snakRow = new ValuelessSnakRow( $internalSnakType, 
$internalPropertyId, $internalClaimId, $snakRole, $internalSubjectId );
+       public function testConstructor( $internalSnakType, 
$internalPropertyId, $snakRole, $internalSubjectId ) {
+               $snakRow = new ValuelessSnakRow( $internalSnakType, 
$internalPropertyId, $snakRole, $internalSubjectId );
 
                $this->assertEquals( $internalPropertyId, 
$snakRow->getInternalPropertyId() );
-               $this->assertEquals( $internalClaimId, 
$snakRow->getInternalClaimId() );
                $this->assertEquals( $snakRole, $snakRow->getSnakRole() );
                $this->assertEquals( $internalSnakType, 
$snakRow->getInternalSnakType() );
                $this->assertEquals( $internalSubjectId, 
$snakRow->getInternalSubjectId() );
diff --git a/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php 
b/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
index 7c8d518..ba85875 100644
--- a/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
+++ b/tests/phpunit/SQLStore/SnakStore/ValuelessSnakStoreTest.php
@@ -43,14 +43,12 @@
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_NO_VALUE,
                        1,
-                       1,
                        SnakRole::QUALIFIER,
                        1
                ) );
 
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_NO_VALUE,
-                       1,
                        1,
                        SnakRole::MAIN_SNAK,
                        1
@@ -59,14 +57,12 @@
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_SOME_VALUE,
                        1,
-                       1,
                        SnakRole::QUALIFIER,
                        1
                ) );
 
                $argLists[] = array( new ValuelessSnakRow(
                        ValuelessSnakRow::TYPE_SOME_VALUE,
-                       1,
                        1,
                        SnakRole::MAIN_SNAK,
                        1
@@ -81,14 +77,12 @@
                $argLists[] = array( new ValueSnakRow(
                        new StringValue( 'nyan' ),
                        1,
-                       1,
                        SnakRole::QUALIFIER,
                        0
                ) );
 
                $argLists[] = array( new ValueSnakRow(
                        new StringValue( 'nyan' ),
-                       1,
                        1,
                        SnakRole::MAIN_SNAK,
                        0
@@ -109,7 +103,6 @@
                                $this->equalTo( 'snaks_of_doom' ),
                                $this->equalTo(
                                        array(
-                                               'claim_id' => 
$snakRow->getInternalClaimId(),
                                                'property_id' => 
$snakRow->getInternalPropertyId(),
                                                'subject_id' => 
$snakRow->getInternalSubjectId(),
                                                'snak_type' => 
$snakRow->getInternalSnakType(),

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I1dc6101e38be494038999d6c9b7d80c8e1b6addd
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikibaseQueryEngine
Gerrit-Branch: master
Gerrit-Owner: Jeroen De Dauw <[email protected]>
Gerrit-Reviewer: Denny Vrandecic <[email protected]>
Gerrit-Reviewer: jenkins-bot

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

Reply via email to