Stores terms of Wikibase entities to facilitate
- lookup of EntityIds given a term
- lookup of term(s) given an EntityId
- storing a Fingerprint for an EntityId
- removing all terms associated with an EntityId
- PHP 5.5 or later (PHP 7 and HHVM are supported)
- php5-sqlite (only needed for running the tests)
To add this package as a local, per-project dependency to your project, simply add a
dependency on queryr/term-store
to your project's composer.json
file.
Here is a minimal example of a composer.json
file that just defines a dependency on
TermStore 1.x:
{
"require": {
"queryr/term-store": "~1.0"
}
}
If you are curious what the database schema is, look at src/TermStoreInstaller.php
.
All services are constructed via the TermStoreFactory
class:
use Queryr\TermStore\TermStoreFactory;
$factory = new TermStoreFactory(
$dbalConnection,
new TermStoreConfig( /* optional config */ )
);
$dbalConnection
is a Connection
object from Doctrine DBAL.
$writer = $factory->newTermStoreWriter();
$writer->storeEntityFingerprint( $entityId, $fingerprint );
$writer->dropTermsForId( $entityId );
$idLookup = $factory->newEntityIdLookup();
$idLookup->getItemIdByLabel( $languageCode, $labelText );
$idLookup->getItemIdByText( $languageCode, $termText );
$idLookup->getIdByLabel( $languageCode, $labelText );
See the EntityIdLookup
interface for all methods and their documentation.
$labelLookup = $factory->newLabelLookup();
$labelLookup->getLabelByIdAndLanguage( $entityId, $languageCode );
See the LabelLookup
interface for documentation.
For tests only
composer test
For style checks only
composer cs
For a full CI run
composer ci
- Bumped minimum PHP version to 7.1
- Added scalar and return type hints
- Installation with Wikibase DataModel 6.x is now allowed
- Installation with Wikibase DataModel 5.x is now allowed
- Added
newLabelLookup
toTermStoreFactory
- Improved documentation
- Installation with Wikibase DataModel 4.x is now allowed
- Installation with Wikibase DataModel 3.x is now allowed
- Changed minimum Wikibase DataModel version to 2.5
- Added ci command that runs PHPUnit, PHPCS, PHPMD and covers tags validation
- Added TravisCI and ScrutinizerCI integration
- Installation with Wikibase DataModel 2.x is now allowed
- Improved performance of
TermStore::storeEntityFingerprint
via usage of a transaction
- Added
TermStoreFactory
. Service construction should now happen via this factory - Added
EntityIdLookup
, which is now implemented byTermStore
- Added
getItemIdByLabel
,getPropertyIdByLabel
,getItemIdByText
andgetPropertyIdByText
toTermStore
- Initial release