Service for serializing entity data.
More...
|
| __construct (EntityLookup $entityLookup, EntityTitleStoreLookup $entityTitleStoreLookup, EntityContentFactory $entityContentFactory, PropertyDataTypeLookup $propertyLookup, ValueSnakRdfBuilderFactory $valueSnakRdfBuilderFactory, EntityRdfBuilderFactory $entityRdfBuilderFactory, EntityDataFormatProvider $entityDataFormatProvider, SerializerFactory $serializerFactory, Serializer $entitySerializer, SiteLookup $siteLookup, RdfVocabulary $rdfVocabulary) |
|
| getSerializedData ( $format, EntityRevision $entityRevision, RedirectRevision $followedRedirect=null, array $incomingRedirects=[], $flavor=null) |
| Output entity data. More...
|
|
|
| rdfSerialize (EntityRevision $entityRevision, ?RedirectRevision $followedRedirect, array $incomingRedirects, RdfBuilder $rdfBuilder, $flavor=null) |
|
| addIncomingRedirects (EntityId $targetId, ?EntityRedirect $followedRedirect, array $incomingRedirects, RdfBuilder $rdfBuilder) |
|
| newApiMain ( $format) |
| Returns an ApiMain module that acts as a context for the formatting and serialization. More...
|
|
| createApiSerializer ( $formatName) |
| Creates an API printer that can generate the given output format. More...
|
|
| getFlavor ( $flavorName) |
| Get the producer setting for current data format. More...
|
|
| createRdfBuilder ( $format, $flavorName=null) |
| Creates an Rdf Serializer that can generate the given output format. More...
|
|
| generateApiResult (EntityRevision $entityRevision, ApiFormatBase $printer) |
| Pushes the given $entity into the ApiResult held by the ApiMain module returned by newApiMain(). More...
|
|
| getApiSerialization (EntityRevision $entityRevision, ApiFormatBase $printer) |
| Serialize the entity data using the provided format. More...
|
|
Service for serializing entity data.
Note that we are using the API's serialization facility to ensure a consistent external representation of data entities. Using the ContentHandler to serialize the entity would expose internal implementation details.
For RDF output, this relies on the RdfBuilder class.
- Copyright
- GPL-2.0-or-later
- Author
- Daniel Kinzler
-
Thomas Pellissier Tanon
-
Anja Jentzsch < anja..nosp@m.jent.nosp@m.zsch@.nosp@m.wiki.nosp@m.media.nosp@m..de >
◆ __construct()
Wikibase\Repo\LinkedData\EntityDataSerializationService::__construct |
( |
EntityLookup |
$entityLookup, |
|
|
EntityTitleStoreLookup |
$entityTitleStoreLookup, |
|
|
EntityContentFactory |
$entityContentFactory, |
|
|
PropertyDataTypeLookup |
$propertyLookup, |
|
|
ValueSnakRdfBuilderFactory |
$valueSnakRdfBuilderFactory, |
|
|
EntityRdfBuilderFactory |
$entityRdfBuilderFactory, |
|
|
EntityDataFormatProvider |
$entityDataFormatProvider, |
|
|
SerializerFactory |
$serializerFactory, |
|
|
Serializer |
$entitySerializer, |
|
|
SiteLookup |
$siteLookup, |
|
|
RdfVocabulary |
$rdfVocabulary |
|
) |
| |
◆ addIncomingRedirects()
Wikibase\Repo\LinkedData\EntityDataSerializationService::addIncomingRedirects |
( |
EntityId |
$targetId, |
|
|
?EntityRedirect |
$followedRedirect, |
|
|
array |
$incomingRedirects, |
|
|
RdfBuilder |
$rdfBuilder |
|
) |
| |
|
private |
- Parameters
-
EntityId | $targetId | |
EntityRedirect | null | $followedRedirect | The followed redirect, will be omitted from the output. |
EntityId[] | $incomingRedirects | |
RdfBuilder | $rdfBuilder | |
◆ createApiSerializer()
Wikibase\Repo\LinkedData\EntityDataSerializationService::createApiSerializer |
( |
|
$formatName | ) |
|
|
private |
Creates an API printer that can generate the given output format.
- Parameters
-
string | $formatName | The desired serialization format, as a format name understood by ApiBase or RdfWriterFactory. |
- Returns
- ApiFormatBase|null A suitable result printer, or null if the given format is not supported by the API.
◆ createRdfBuilder()
Wikibase\Repo\LinkedData\EntityDataSerializationService::createRdfBuilder |
( |
|
$format, |
|
|
|
$flavorName = null |
|
) |
| |
|
private |
Creates an Rdf Serializer that can generate the given output format.
- Parameters
-
string | $format | The desired serialization format, as a format name understood by ApiBase or RdfWriterFactory |
string | null | $flavorName | Flavor name (used for RDF output) |
- Returns
- RdfBuilder|null A suitable result printer, or null if the given format is not supported.
◆ generateApiResult()
Wikibase\Repo\LinkedData\EntityDataSerializationService::generateApiResult |
( |
EntityRevision |
$entityRevision, |
|
|
ApiFormatBase |
$printer |
|
) |
| |
|
private |
Pushes the given $entity into the ApiResult held by the ApiMain module returned by newApiMain().
Calling $printer->execute() later will output this result, if $printer was generated from that same ApiMain module, as createApiPrinter() does.
- Parameters
-
EntityRevision | $entityRevision | The entity to convert ot an ApiResult |
ApiFormatBase | $printer | The output printer that will be used for serialization. Used to provide context for generating the ApiResult, and may also be manipulated to fine-tune the output. |
- Returns
- ApiResult
◆ getApiSerialization()
Wikibase\Repo\LinkedData\EntityDataSerializationService::getApiSerialization |
( |
EntityRevision |
$entityRevision, |
|
|
ApiFormatBase |
$printer |
|
) |
| |
|
private |
Serialize the entity data using the provided format.
Note that we are using the API's serialization facility to ensure a consistent external representation of data entities. Using the ContentHandler to serialize the entity would expose internal implementation details.
- Parameters
-
EntityRevision | $entityRevision | the entity to output. |
ApiFormatBase | $printer | the printer to use to generate the output |
- Returns
- string the serialized data
◆ getFlavor()
Wikibase\Repo\LinkedData\EntityDataSerializationService::getFlavor |
( |
|
$flavorName | ) |
|
|
private |
Get the producer setting for current data format.
- Parameters
-
- Returns
- int
- Exceptions
-
◆ getSerializedData()
Wikibase\Repo\LinkedData\EntityDataSerializationService::getSerializedData |
( |
|
$format, |
|
|
EntityRevision |
$entityRevision, |
|
|
RedirectRevision |
$followedRedirect = null , |
|
|
array |
$incomingRedirects = [] , |
|
|
|
$flavor = null |
|
) |
| |
Output entity data.
- Parameters
-
string | $format | The name (mime type of file extension) of the format to use |
EntityRevision | $entityRevision | The entity |
RedirectRevision | null | $followedRedirect | The redirect that led to the entity, or null |
EntityId[] | $incomingRedirects | Incoming redirects to include in the output |
string | null | $flavor | The type of the output provided by serializer |
- Returns
- array tuple of ( $data, $contentType )
- Exceptions
-
◆ newApiMain()
Wikibase\Repo\LinkedData\EntityDataSerializationService::newApiMain |
( |
|
$format | ) |
|
|
private |
Returns an ApiMain module that acts as a context for the formatting and serialization.
- Parameters
-
string | $format | The desired output format, as a format name that ApiBase understands. |
- Returns
- ApiMain
◆ rdfSerialize()
Wikibase\Repo\LinkedData\EntityDataSerializationService::rdfSerialize |
( |
EntityRevision |
$entityRevision, |
|
|
?RedirectRevision |
$followedRedirect, |
|
|
array |
$incomingRedirects, |
|
|
RdfBuilder |
$rdfBuilder, |
|
|
|
$flavor = null |
|
) |
| |
|
private |
- Parameters
-
EntityRevision | $entityRevision | |
RedirectRevision | null | $followedRedirect | a redirect leading to the entity for use in the output |
EntityId[] | $incomingRedirects | Incoming redirects to include in the output |
RdfBuilder | $rdfBuilder | |
string | null | $flavor | The type of the output provided by serializer |
- Returns
- string RDF
◆ $entityContentFactory
Wikibase\Repo\LinkedData\EntityDataSerializationService::$entityContentFactory |
|
private |
◆ $entityDataFormatProvider
Wikibase\Repo\LinkedData\EntityDataSerializationService::$entityDataFormatProvider |
|
private |
◆ $entityLookup
Wikibase\Repo\LinkedData\EntityDataSerializationService::$entityLookup = null |
|
private |
◆ $entityRdfBuilderFactory
Wikibase\Repo\LinkedData\EntityDataSerializationService::$entityRdfBuilderFactory |
|
private |
◆ $entitySerializer
Wikibase\Repo\LinkedData\EntityDataSerializationService::$entitySerializer |
|
private |
◆ $entityTitleStoreLookup
Wikibase\Repo\LinkedData\EntityDataSerializationService::$entityTitleStoreLookup |
|
private |
◆ $propertyLookup
Wikibase\Repo\LinkedData\EntityDataSerializationService::$propertyLookup |
|
private |
◆ $rdfVocabulary
Wikibase\Repo\LinkedData\EntityDataSerializationService::$rdfVocabulary |
|
private |
◆ $rdfWriterFactory
Wikibase\Repo\LinkedData\EntityDataSerializationService::$rdfWriterFactory |
|
private |
◆ $serializerFactory
Wikibase\Repo\LinkedData\EntityDataSerializationService::$serializerFactory |
|
private |
◆ $siteLookup
Wikibase\Repo\LinkedData\EntityDataSerializationService::$siteLookup |
|
private |
◆ $valueSnakRdfBuilderFactory
Wikibase\Repo\LinkedData\EntityDataSerializationService::$valueSnakRdfBuilderFactory |
|
private |
The documentation for this class was generated from the following file: