2017 © Pedro Peláez
 

library data-model-serialization

Serializers and deserializers for the Wikibase DataModel

image

wikibase/data-model-serialization

Serializers and deserializers for the Wikibase DataModel

  • PHP
  • 8 Dependents
  • 0 Suggesters
  • 3 Forks
  • 6 Open issues
  • 48 Versions
  • 4 % Grown

The README.md

Wikibase DataModel Serialization

Build Status Scrutinizer Quality Score Code Coverage Download count License, (*1)

Latest Stable Version Latest Unstable Version, (*2)

Library containing serializers and deserializers for the basic Wikibase DataModel entity types and components they are made of. The supported formats are limited to public ones, ie those used by a web API. Serialization code for private formats, such as the format used by the Wikibase Repo data access layer, belongs in other components., (*3)

Recent changes can be found in the release notes., (*4)

Installation

The recommended way to use this library is via Composer., (*5)

Composer

To add this package as a local, per-project dependency to your project, simply add a dependency on wikibase/data-model-serialization to your project's composer.json file. Here is a minimal example of a composer.json file that just defines a dependency on version 2.0 of this package:, (*6)

{
    "require": {
        "wikibase/data-model-serialization": "~2.0"
    }
}

Manual

Get the code of this package, either via git, or some other means. Also get all dependencies. You can find a list of the dependencies in the "require" section of the composer.json file. Then take care of autoloading the classes defined in the src directory., (*7)

Library usage

Construct an instance of the specific deserializer or serializer you need via the appropriate factory., (*8)

use Wikibase\DataModel\DeserializerFactory;

$deserializerFactory = new DeserializerFactory( /* ... */ );
$itemDeserializer = $deserializerFactory->newItemDeserializer();

Then use the deserialize or serialize method., (*9)

$item = $itemDeserializer->deserialize( $myItemSerialization );

In case of deserialization, guarding against failures is good practice. So it is typically better to use the slightly more verbose try-catch approach., (*10)

try {
    $item = $itemDeserializer->deserialize( $myItemSerialization );
} catch ( DeserializationException $ex ) {
    // Handling of the exception
}

All access to services provided by this library should happen through the SerializerFactory and DeserializerFactory. The rest of the code is an implementation detail which users should not know about., (*11)

Library structure

The Wikibase DataModel objects can all be serialized to a generic format from which the objects can later be reconstructed. This is done via a set of Serializers\Serializer implementing objects. These objects turn for instance a Statement object into a data structure containing only primitive types and arrays. This data structure can thus be readily fed to json_encode, serialize, or the like. The process of reconstructing the objects from such a serialization is provided by objects implementing the Deserializers\Deserializer interface., (*12)

Serializers can be obtained via an instance of SerializerFactory and deserializers can be obtained via an instance of DeserializerFactory. You are not allowed to construct these serializers and deserializers directly yourself or to have any kind of knowledge of them (ie type hinting). These objects are internal to this component and might change name or structure at any time. All you are allowed to know when calling $serializerFactory->newItemDeserializer() is that you get back an instance of Serializers\Serializer., (*13)

Running the tests

For tests only, (*14)

composer test

For style checks only, (*15)

composer cs

For a full CI run, (*16)

composer ci

Authors

Wikibase DataModel Serialization has been written by Thomas PT as volunteer and by Jeroen De Dauw as Wikimedia Germany employee for the Wikidata project., (*17)

See also

Bugs on Phabricator

https://phabricator.wikimedia.org/project/view/922/, (*18)

The Versions

01/04 2018
28/03 2018

dev-removeOptions

dev-removeOptions https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

23/02 2018

dev-composerTest

dev-composerTest https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+ GPL-2.0-or-later

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

23/02 2018
22/02 2018

dev-phpunit6Forward

dev-phpunit6Forward https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0-or-later

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

02/11 2017

dev-micro-opti-entityid-stuffz

dev-micro-opti-entityid-stuffz https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

26/10 2017
19/09 2017

dev-numericLanguageCodes

dev-numericLanguageCodes https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

30/08 2017
28/07 2017

dev-entity-setid-nonull

dev-entity-setid-nonull https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

31/05 2017

dev-classFeature

dev-classFeature https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

24/03 2017

dev-roundTripTest

dev-roundTripTest https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

23/03 2017

dev-thereIsNoEntity

dev-thereIsNoEntity https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

20/03 2017

dev-removeHashes

dev-removeHashes https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

16/03 2017

2.4.0

2.4.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

15/02 2017

2.3.0

2.3.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

17/03 2016

dev-realTypes

dev-realTypes https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

11/03 2016

2.2.0

2.2.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

18/02 2016

2.1.0

2.1.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

30/11 2015

dev-Facets

dev-Facets https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

15/09 2015

dev-derivedpropertyvaluesnak

dev-derivedpropertyvaluesnak https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

01/09 2015

dev-extravaluesassigner

dev-extravaluesassigner https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

30/08 2015

2.0.0

2.0.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

26/08 2015

1.9.0

1.9.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

30/07 2015

dev-ideaSlotStuff

dev-ideaSlotStuff https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

23/07 2015

1.7.0

1.7.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

20/07 2015

1.6.0

1.6.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

01/07 2015

1.5.0

1.5.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

08/06 2015

1.4.0

1.4.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

28/01 2015

1.3.0

1.3.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

10/12 2014

dev-factoryTypes

dev-factoryTypes https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

15/10 2014

1.2.0

1.2.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

09/09 2014

1.1.1

1.1.1.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

02/09 2014

1.1.0

1.1.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

28/07 2014

1.0.3

1.0.3.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

21/07 2014

1.0.2

1.0.2.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

16/06 2014

1.0.1

1.0.1.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

27/05 2014

1.0

1.0.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

The Development Requires

serialization wikibase wikidata serializers deserializers datamodel

22/02 2014

0.1

0.1.0.0 https://github.com/wmde/WikibaseDataModelSerialization

Serializers and deserializers for the Wikibase DataModel

  Sources   Download

GPL-2.0+

The Requires

 

serialization wikibase wikidata serializers deserializers datamodel