Download the PHP package ppp/wikibase-entity-store without Composer
On this page you can find all versions of the php package ppp/wikibase-entity-store. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ppp/wikibase-entity-store
More information about ppp/wikibase-entity-store
Files in ppp/wikibase-entity-store
Package wikibase-entity-store
Short Description A small library to store Wikibase entities
License GPL-2.0+
Homepage https://github.com/ProjetPP/WikibaseEntityStore
Informations about the package wikibase-entity-store
WikibaseEntityStore
On Packagist:
WikibaseEntityStore is a small library that provides an unified interface to interact with Wikibase entities.
It currently has two backends:
- An API based backend, slow but very easy to deploy
- A MongoDB based backend, faster but requires to maintain a local copy of Wikibase content
Installation
Use one of the below methods:
1 - Use composer to install the library and all its dependencies using the master branch:
composer require "ppp/wikibase-entity-store":dev-master"
2 - Create a composer.json file that just defines a dependency on version 1.0 of this package, and run 'composer install' in the directory:
Usage
Features
The entity storage system is based on the abstract class EntityStore that provides different services to manipulate entities.
These services are:
Backends
API Backend
The API backend is the most easy to use one. It uses the API of a Wikibase instance and WikidataQuery if you use this EntityStore as a backend for Wikidata data and you want query support.
The configuration file looks like:
Replace http://www.wikidata.org/w/api.php
with the URL of your WediaWiki API if you want to use your store with an other Wikibase instance than Wikidata.
The parameter wikidataquery-url
is optional and may be unset if you don't want query support using Wikidata content.
Without configuration file:
MongoDB Backend
The MongoDB backend uses a MongoDB database. Requires doctrine/mongodb.
The configuration file looks like:
server
should be a MongoDB server connection string and database
the name of the database to use.
Without configuration file:
You can fill the MongoDB database from Wikidata JSON dumps using this script:
php entitystore import-json-dump MY_JSON_DUMP MY_CONFIGURATION_FILE
Or from incremental XML dumps using this script:
php entitystore import-incremental-xml-dump MY_XML_DUMP MY_CONFIGURATION_FILE
InMemory backend
Backend based on an array of EntityDocuments. Useful for tests.
Options
The different backends support a shared set of options. These options are:
- string[]
languages
: Allows to filter the set of internationalized values. Default value:null
(a.k.a. all languages). - bool
languagefallback
: Apply language fallback system to languages defined using languages option. Default value:false
.
They can be injected in the configuration:
They can be also passed as last parameter of EntityStore
constructors:
Cache support
It is possible, in order to get far better performances, to add a cache layer on top of EntityStore:
Adds to the configuration file a cache
section.
Example with a two layers cache. The first one is a PHP array and the second one a Memcached instance on localhost:11211
.
Without configuration file:
Release notes
0.3.1 (2016-01-11)
- Adds support of WikibaseDataModel 5.0 and 6.0 and Number 0.7
0.3.0 (2016-01-11)
- Update to WikibaseDataModel 4.0, WikibaseDataModelServices 3.2 and MediaWikiApiBase 2.0
- Change encoding of label indexes in MongoDB
0.1.0 (2015-04-21)
Initial release with these features:
- Retrieve entities from ids or terms
- Import Wikidata JSON full dumps and incremental XML dumps
- Beginning of support of simple queries
- API and MongoDB backends
- Basic cache system
All versions of wikibase-entity-store with dependencies
wikibase/data-model Version ~4.3|~5.0|~6.0
wikibase/data-model-services Version ~3.2
wikibase/data-model-serialization Version ~2.0
data-values/data-values Version ~1.0
data-values/common Version ~0.3.0
data-values/geo Version ~1.0
data-values/number Version ~0.6.0|~0.7.0
data-values/time Version ~0.8.0
data-values/validators Version ~0.1.0
data-values/serialization Version ~1.0
addwiki/mediawiki-api-base Version ~2.0
doctrine/cache Version ~1.4
psr/log Version ~1.0
symfony/config Version ~3.0
ask/ask Version ~1.0
ask/serialization Version ~1.0
ppp/wikidataquery-api Version ~1.3