PHPackages                             wikibase/data-model-javascript - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wikibase/data-model-javascript

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wikibase/data-model-javascript
==============================

Wikibase datamodel implementation in JavaScript

3.1.0(8y ago)964.6k1[2 PRs](https://github.com/wmde/WikibaseDataModelJavascript/pulls)1GPL-2.0+JavaScript

Since Jun 18Pushed 1y ago23 watchersCompare

[ Source](https://github.com/wmde/WikibaseDataModelJavascript)[ Packagist](https://packagist.org/packages/wikibase/data-model-javascript)[ RSS](/packages/wikibase-data-model-javascript/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (10)Dependencies (1)Versions (19)Used By (1)

Wikibase DataModel JavaScript
=============================

[](#wikibase-datamodel-javascript)

**Wikibase DataModel JavaScript** is the JavaScript implementation of the basic [Wikibase DataModel](https://www.mediawiki.org/wiki/Wikibase/DataModel)at the heart of the [Wikibase software](http://wikiba.se/). As the [PHP implementation of the DataModel](https://github.com/wmde/WikibaseDataModel), this library only implements the basic Item and Property entity types, and the components they are made of.

Wikibase uses this library together with the [Wikibase Serialization JavaScript library](https://github.com/wmde/WikibaseSerializationJavaScript)to deserialize API responses from serialized JSON to actual DataModel objects. These objects can then be consumed and manipulated via convenient getter and setter methods, turned back into JSON via the corresponding serializer, and send back to the API.

[![Wikibase JavaScript Data Model UML diagram](https://camo.githubusercontent.com/814811576fa9e27f49dd5ba3688e61b2c7eff3d3502a5c62b17b1f1c48c71f34/68747470733a2f2f75706c6f61642e77696b696d656469612e6f72672f77696b6970656469612f636f6d6d6f6e732f7468756d622f632f63322f57696b69626173655f4a6176615363726970745f446174615f4d6f64656c5f312e302e7376672f36303070782d57696b69626173655f4a6176615363726970745f446174615f4d6f64656c5f312e302e7376672e706e67)](https://commons.wikimedia.org/wiki/File:Wikibase_JavaScript_Data_Model_1.0.svg)

Release notes
-------------

[](#release-notes)

### 6.1.0 (2019-10-24)

[](#610-2019-10-24)

- Bundle some very basic Typescript types

### 6.0.0 (2019-10-21)

[](#600-2019-10-21)

- Using CommonJS modules instead of global namespaces for all files

### 5.1.0 (2019-10-01)

[](#510-2019-10-01)

- Added `index.js` exporting all public data model parts

### 5.0.0 (2018-07-06)

[](#500-2018-07-06)

- Remove references to fingerprint from Entity:
    - Removed `Entity.getFingerprint`
    - Removed `Entity.setFingerprint`

### 4.1.0 (2018-06-25)

[](#410-2018-06-25)

- Added new FingerprintableEntity class
- Make Item and Property inherit from it

### 4.0.0 (2017-10-09)

[](#400-2017-10-09)

- Made the library a pure JavaScript library.
- Removed MediaWiki extension registration.
- Removed MediaWiki ResourceLoader module definitions.
- Removed WIKIBASE\_DATAMODEL\_JAVASCRIPT\_VERSION constant.
- Raised DataValues JavaScript library version requirement to 0.10.0.
- Removed all Claim collections:
    - Removed `ClaimGroup`
    - Removed `ClaimGroupSet`
    - Removed `ClaimList`
- Removed all move-related methods from SnakList:
    - Removed `SnakList.getValidMoveIndices`
    - Removed `SnakList.move`
    - Removed `SnakList.moveDown`
    - Removed `SnakList.moveUp`
    - Declared `SnakList.getFilteredSnakList` private
- Removed dysfunctional methods from all Entity classes:
    - Removed `Item.addStatement`
    - Removed `Item.removeStatement`
    - Removed `Property.addStatement`
    - Removed `Property.removeStatement`

### 3.1.0 (2017-09-04)

[](#310-2017-09-04)

- Added an optional `hash` constructor parameter and a `getHash` method to `Snak`, `PropertyValueSnak`, `PropertySomeValueSnak`, and `PropertyNoValueSnak`.
- Travis now runs the QUnit tests.

### 3.0.1 (2016-09-09)

[](#301-2016-09-09)

- Fix an issue with MediaWiki loading (init.php)

### 3.0.0 (2016-08-02)

[](#300-2016-08-02)

- Added `Set::toArray`.
- `Fingerprint::setLabel`, `setDescription` and `setAliases` remove the element when null or an empty Term or MultiTerm is given.
- Removed cloning from `MultiTerm.getTexts`.
- Turned EntityId into a simple wrapper around an opaque serialization string
    - Removed EntityId::getNumericId
    - Removed EntityId::getEntityType
    - Removed EntityId::getPrefixedId
    - Introduced EntityId::getSerialization
    - Removed `numeric-id` and `entity-type` fields from `toJSON` return value
    - Introduced `id` field to `toJSON` return value
    - Removed `numeric-id` and `entity-type` arguments from EntityId constructor
    - Introduced `id` argument to EntityId constructor
- Deprecated the `WIKIBASE_DATAMODEL_JAVASCRIPT_VERSION` PHP constant.
- The (optional) extension registration in `init.php` now depends on MediaWiki &gt;=1.25.

### 2.0.1 (2016-01-27)

[](#201-2016-01-27)

- Added compatibility with DataValues JavaScript 0.8.0.

### 2.0.0 (2016-01-12)

[](#200-2016-01-12)

#### Breaking changes

[](#breaking-changes)

- `Term` and `MultiTerm` do not accept empty language codes any more.
- Removed cloning from the following methods:
    - `GroupableCollection.toArray` and `List.toArray`
    - `Group.getItemContainer` and `setItemContainer`
- Removed `propertyId` parameter from `Claim.getQualifiers`.
- `SnakList.getFilteredSnakList` can not be called with `null` any more.

#### Other changes

[](#other-changes)

- Fixed possible performance issues due to cloning in `Group.equals` and the `List`, `Map`and `Set` constructors.

### 1.0.2 (2015-05-28)

[](#102-2015-05-28)

#### Enhancements

[](#enhancements)

- Adapt to DataValuesJavaScript 0.7.0.
- SnakList.merge() accepts null.
- Updated code documentation for being able to automatically generate a proper documentation using JSDuck.

### 1.0.1 (2014-11-05)

[](#101-2014-11-05)

- Using DataValues JavaScript 0.6.x.

### 1.0.0 (2014-11-05)

[](#100-2014-11-05)

#### Breaking changes

[](#breaking-changes-1)

- Removed wikibase.datamodel.Reference.setSnaks(). Generate new Reference objects when interacting with the API to reflect hash changes performed in the back-end.
- Removed wikibase.datamodel.Entity.equals().
- Removed wikibase.datamodel.Reference.setSnaks().
- wikibase.datamodel.Reference constructor does not accept Snak object(s) any more.
- An entity cannot be constructed by passing internal object representation to Entity constructor anymore; Use entity specific constructors instead.
- Removed useless Entity.isNew(), Entity.newEmpty().
- Removed Entity.getLabel(), Entity.getLabels(), Entity.getDescription(), Entity.getDescription(), Entity.getAliases(), Entity.getAllAliases(); Acquire data via Entity.getFingerprint() instead.
- Removed Entity.getClaims(); Acquire claims/statements via Entity specific implementation.
- Item.getSiteLinks() returns a SiteLinkSet object instead of an array of SiteLink objects.
- Renamed Property.getDataType() to Property.getDataTypeId().
- Removed all toJSON(), newFromJSON(), toMap() and newFromMap() functions; Use serializers and unserializers of wikibase.serialization instead.
- Statement does not accept a plain array of references anymore; Supply a ReferenceList instead.
- Remove Claim.TYPE and Statement.TYPE attributes.
- Instead of inheriting from Claim, Statement now features a Claim instance that needs to be passed to the Statement constructor.
- Reference constructor does not accept a plain list of Snak objects anymore; Supply a proper SnakList object instead.
- SnakList constructor only accepts arrays of Snak objects.

#### Enhancements

[](#enhancements-1)

- Added ClaimGroup.
- Added ClaimGroupSet.
- Added ClaimList.
- Added Fingerprint.
- Added Group.
- Added GroupableCollection.
- Added List.
- Added Map.
- Added MultiTerm.
- Added MultiTermMap.
- Added ReferenceList.
- Added SiteLinkSet.
- Added StatementGroup.
- Added StatementGroupSet.
- Added StatementList.
- Added Term.
- Added TermMap.
- Added Set.
- Added individual constructors for Item and Property.
- Added Entity.getFingerprint(), Entity.setFingerprint().
- Added SiteLink and Statement specific functionality to Item.
- Added Statement specific functionality to Property.
- Added isEmpty() and equals() functions to Item and Property.

### 0.3.2 (2014-08-19)

[](#032-2014-08-19)

- Added wikibase.datamodel.SiteLink.
- Added wikibase.datamodel.Item.getSiteLinks().

### 0.3.1 (2014-08-14)

[](#031-2014-08-14)

- Remove ResourceLoader dependencies on jquery and mediawiki (bug 69468)

### 0.3.0 (2014-07-10)

[](#030-2014-07-10)

- Remove methods isSameAs and equals from wikibase.Entity
- Move all classes from wikibase to wikibase.datamodel, e. g. wikibase.Claim becomes wikibase.datamodel.Claim

### 0.2.0 (2014-06-26)

[](#020-2014-06-26)

- Let Entity.newFromMap expect a string instead of a DataType instance as datatype attribute when creating a Property.
- Let Property.getDataType return the data type's string identifier instead of a DataType instance.
- Fix regular expressions in resource loader definitions

### 0.1.0 (2014-06-18)

[](#010-2014-06-18)

Initial release.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community29

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~78 days

Recently: every ~146 days

Total

16

Last Release

3179d ago

Major Versions

0.3.3 → 1.02014-11-05

1.0.2 → 2.0.02016-01-13

2.0.1 → 3.0.02016-08-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/451bd4039d530fed8f9c3da91bfa519233a397d2182cdfdcad700f6cfea19b7f?d=identicon)[Jeroen De Dauw](/maintainers/Jeroen%20De%20Dauw)

![](https://www.gravatar.com/avatar/054adb441e7ee248ec924bc45fa793835c284710eb31627587fa5de21bab9e96?d=identicon)[wmde](/maintainers/wmde)

![](https://www.gravatar.com/avatar/5406ed1d40d50ffc61d67e9f5149914dbfe0b8a52bdf297299f5ccfab0a73d91?d=identicon)[thiemowmde](/maintainers/thiemowmde)

![](https://www.gravatar.com/avatar/fe4220e5a109212ea1a84969fbcb0795ceaf975145c1f0577bd758d0500e6428?d=identicon)[manicki](/maintainers/manicki)

![](https://www.gravatar.com/avatar/99b03312aa8fcf47db8cbde452192aa5b96c27d1b99c4c1fb22af92ae1dbb0fb?d=identicon)[filbertkm](/maintainers/filbertkm)

---

Top Contributors

[![snaterlicious](https://avatars.githubusercontent.com/u/5755120?v=4)](https://github.com/snaterlicious "snaterlicious (102 commits)")[![thiemowmde](https://avatars.githubusercontent.com/u/6576639?v=4)](https://github.com/thiemowmde "thiemowmde (58 commits)")[![DanweDE](https://avatars.githubusercontent.com/u/101926?v=4)](https://github.com/DanweDE "DanweDE (43 commits)")[![JeroenDeDauw](https://avatars.githubusercontent.com/u/146040?v=4)](https://github.com/JeroenDeDauw "JeroenDeDauw (22 commits)")[![mariushoch](https://avatars.githubusercontent.com/u/2446964?v=4)](https://github.com/mariushoch "mariushoch (21 commits)")[![adrianheine](https://avatars.githubusercontent.com/u/139208?v=4)](https://github.com/adrianheine "adrianheine (21 commits)")[![manicki](https://avatars.githubusercontent.com/u/3524114?v=4)](https://github.com/manicki "manicki (20 commits)")[![Ladsgroup](https://avatars.githubusercontent.com/u/5351225?v=4)](https://github.com/Ladsgroup "Ladsgroup (18 commits)")[![addshore](https://avatars.githubusercontent.com/u/3308769?v=4)](https://github.com/addshore "addshore (9 commits)")[![Benestar](https://avatars.githubusercontent.com/u/2998254?v=4)](https://github.com/Benestar "Benestar (9 commits)")[![jakobw](https://avatars.githubusercontent.com/u/453024?v=4)](https://github.com/jakobw "jakobw (9 commits)")[![JonasKress](https://avatars.githubusercontent.com/u/13198391?v=4)](https://github.com/JonasKress "JonasKress (9 commits)")[![bekh6ex](https://avatars.githubusercontent.com/u/4264331?v=4)](https://github.com/bekh6ex "bekh6ex (8 commits)")[![tobijat](https://avatars.githubusercontent.com/u/2997252?v=4)](https://github.com/tobijat "tobijat (8 commits)")[![tarrow](https://avatars.githubusercontent.com/u/7353563?v=4)](https://github.com/tarrow "tarrow (4 commits)")[![filbertkm](https://avatars.githubusercontent.com/u/135401?v=4)](https://github.com/filbertkm "filbertkm (2 commits)")[![MuhammadJaziraly](https://avatars.githubusercontent.com/u/119682884?v=4)](https://github.com/MuhammadJaziraly "MuhammadJaziraly (2 commits)")[![lucaswerkmeister](https://avatars.githubusercontent.com/u/2346599?v=4)](https://github.com/lucaswerkmeister "lucaswerkmeister (1 commits)")[![Silvan-WMDE](https://avatars.githubusercontent.com/u/59574251?v=4)](https://github.com/Silvan-WMDE "Silvan-WMDE (1 commits)")

### Embed Badge

![Health badge](/badges/wikibase-data-model-javascript/health.svg)

```
[![Health](https://phpackages.com/badges/wikibase-data-model-javascript/health.svg)](https://phpackages.com/packages/wikibase-data-model-javascript)
```

###  Alternatives

[nicmart/tree

A basic but flexible php tree data structure and a fluent tree builder implementation.

57719.3M21](/packages/nicmart-tree)[kiwicommerce/module-inventory-log

Magento 2 - Inventory Log

3735.6k](/packages/kiwicommerce-module-inventory-log)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
