Wikibase
MediaWiki Wikibase extension
Wikibase\Repo\Rdf\RdfBuilder Class Reference

RDF mapping for wikibase data model. More...

+ Inheritance diagram for Wikibase\Repo\Rdf\RdfBuilder:
+ Collaboration diagram for Wikibase\Repo\Rdf\RdfBuilder:

Public Member Functions

 __construct (RdfVocabulary $vocabulary, EntityRdfBuilderFactory $entityRdfBuilderFactory, int $flavor, RdfWriter $writer, DedupeBag $dedupeBag, EntityContentFactory $entityContentFactory, EntityStubRdfBuilderFactory $entityStubRdfBuilderFactory, EntityRevisionLookup $entityRevisionLookup)
 
 startDocument ()
 Start writing RDF document Note that this builder does not have to finish it, it may be finished later. More...
 
 finishDocument ()
 Finish writing the document After that, nothing should ever be written into the document. More...
 
 getRDF ()
 Returns the RDF generated by the builder. More...
 
 getNamespaces ()
 Returns a map of namespace names to URIs. More...
 
 getPagePropertyDefs ()
 Get map of page properties used by this builder. More...
 
 entityReferenceMentioned (EntityId $id)
 
 propertyMentioned (PropertyId $id)
 
 subEntityMentioned (EntityDocument $entity)
 
 addEntityRevisionInfo (EntityId $entityId, int $revision, string $timestamp)
 Adds revision information about an entity's revision to the RDF graph. More...
 
 addEntityPageProps (EntityDocument $entity)
 Add page props information. More...
 
 addEntity (EntityDocument $entity)
 Add an entity to the RDF graph, including all supported structural components of the entity and its sub entities. More...
 
 resolveMentionedEntities ()
 Add stubs for any entities that were previously mentioned (e.g. More...
 
 addEntityStub (EntityId $entityId)
 Adds stub information for the given EntityId to the RDF graph. More...
 
 addEntityRedirect (EntityId $from, EntityId $to)
 Declares $from to be an alias for $to, using the owl:sameAs relationship. More...
 
 addDumpHeader (int $timestamp=0)
 Create header structure for the dump (this makes RdfProducer::PRODUCE_VERSION_INFO redundant) More...
 

Private Member Functions

 shouldProduce (int $what)
 Should we produce this aspect? More...
 
 entityToResolve (EntityId $entityId)
 Registers an entity as mentioned. More...
 
 entityResolved (EntityId $entityId)
 Registers an entity as resolved. More...
 
 addEntityMetaData (EntityId $entityId)
 Adds meta-information about an entity id (such as the ID and type) to the RDF graph. More...
 
 addSingleEntity (EntityDocument $entity)
 Add a single entity to the RDF graph, including all supported structural components of the entity. More...
 
 addQueuedEntities ()
 Add the RDF serialization of all entities in the entitiesToOutput queue. More...
 
 markStubEntityDataForPrefetching (array $entityIds)
 

Private Attributes

 $entitiesResolved = []
 
 $entitiesToOutput
 
 $produceWhat
 
 $writer
 
 $vocabulary
 
 $entityContentFactory
 
 $entityRdfBuilders
 
 $entityStubRdfBuilderFactory
 
 $entityStubRdfBuilders
 
 $entityRevisionLookup
 

Detailed Description

RDF mapping for wikibase data model.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Rdf\RdfBuilder::__construct ( RdfVocabulary  $vocabulary,
EntityRdfBuilderFactory  $entityRdfBuilderFactory,
int  $flavor,
RdfWriter  $writer,
DedupeBag  $dedupeBag,
EntityContentFactory  $entityContentFactory,
EntityStubRdfBuilderFactory  $entityStubRdfBuilderFactory,
EntityRevisionLookup  $entityRevisionLookup 
)

Member Function Documentation

◆ addDumpHeader()

Wikibase\Repo\Rdf\RdfBuilder::addDumpHeader ( int  $timestamp = 0)

Create header structure for the dump (this makes RdfProducer::PRODUCE_VERSION_INFO redundant)

Parameters
int$timestampTimestamp (for testing)

◆ addEntity()

Wikibase\Repo\Rdf\RdfBuilder::addEntity ( EntityDocument  $entity)

Add an entity to the RDF graph, including all supported structural components of the entity and its sub entities.

Parameters
EntityDocument$entitythe entity to output.

Implements Wikibase\Repo\Rdf\EntityRdfBuilder.

◆ addEntityMetaData()

Wikibase\Repo\Rdf\RdfBuilder::addEntityMetaData ( EntityId  $entityId)
private

Adds meta-information about an entity id (such as the ID and type) to the RDF graph.

Todo:
extract into MetaDataRdfBuilder

◆ addEntityPageProps()

Wikibase\Repo\Rdf\RdfBuilder::addEntityPageProps ( EntityDocument  $entity)

Add page props information.

To ensure consistent data, this recalculates the page props from the entity content; it does not actually query the page_props table.

◆ addEntityRedirect()

Wikibase\Repo\Rdf\RdfBuilder::addEntityRedirect ( EntityId  $from,
EntityId  $to 
)

Declares $from to be an alias for $to, using the owl:sameAs relationship.

◆ addEntityRevisionInfo()

Wikibase\Repo\Rdf\RdfBuilder::addEntityRevisionInfo ( EntityId  $entityId,
int  $revision,
string  $timestamp 
)

Adds revision information about an entity's revision to the RDF graph.

Todo:
extract into MetaDataRdfBuilder
Parameters
EntityId$entityId
int$revision
string$timestampin TS_MW format

◆ addEntityStub()

Wikibase\Repo\Rdf\RdfBuilder::addEntityStub ( EntityId  $entityId)

Adds stub information for the given EntityId to the RDF graph.

Stub information means meta information and labels.

Implements Wikibase\Repo\Rdf\EntityStubRdfBuilder.

◆ addQueuedEntities()

Wikibase\Repo\Rdf\RdfBuilder::addQueuedEntities ( )
private

Add the RDF serialization of all entities in the entitiesToOutput queue.

◆ addSingleEntity()

Wikibase\Repo\Rdf\RdfBuilder::addSingleEntity ( EntityDocument  $entity)
private

Add a single entity to the RDF graph, including all supported structural components of the entity.

Parameters
EntityDocument$entitythe entity to output.

◆ entityReferenceMentioned()

Wikibase\Repo\Rdf\RdfBuilder::entityReferenceMentioned ( EntityId  $id)

◆ entityResolved()

Wikibase\Repo\Rdf\RdfBuilder::entityResolved ( EntityId  $entityId)
private

Registers an entity as resolved.

◆ entityToResolve()

Wikibase\Repo\Rdf\RdfBuilder::entityToResolve ( EntityId  $entityId)
private

Registers an entity as mentioned.

Will be recorded as unresolved if it wasn't already marked as resolved.

◆ finishDocument()

Wikibase\Repo\Rdf\RdfBuilder::finishDocument ( )

Finish writing the document After that, nothing should ever be written into the document.

◆ getNamespaces()

Wikibase\Repo\Rdf\RdfBuilder::getNamespaces ( )

Returns a map of namespace names to URIs.

◆ getPagePropertyDefs()

Wikibase\Repo\Rdf\RdfBuilder::getPagePropertyDefs ( )

Get map of page properties used by this builder.

Returns
string[][]

◆ getRDF()

Wikibase\Repo\Rdf\RdfBuilder::getRDF ( )

Returns the RDF generated by the builder.

◆ markStubEntityDataForPrefetching()

Wikibase\Repo\Rdf\RdfBuilder::markStubEntityDataForPrefetching ( array  $entityIds)
private

◆ propertyMentioned()

Wikibase\Repo\Rdf\RdfBuilder::propertyMentioned ( PropertyId  $id)

◆ resolveMentionedEntities()

Wikibase\Repo\Rdf\RdfBuilder::resolveMentionedEntities ( )

Add stubs for any entities that were previously mentioned (e.g.

as properties or data values).

◆ shouldProduce()

Wikibase\Repo\Rdf\RdfBuilder::shouldProduce ( int  $what)
private

Should we produce this aspect?

◆ startDocument()

Wikibase\Repo\Rdf\RdfBuilder::startDocument ( )

Start writing RDF document Note that this builder does not have to finish it, it may be finished later.

◆ subEntityMentioned()

Wikibase\Repo\Rdf\RdfBuilder::subEntityMentioned ( EntityDocument  $entity)

Member Data Documentation

◆ $entitiesResolved

Wikibase\Repo\Rdf\RdfBuilder::$entitiesResolved = []
private

◆ $entitiesToOutput

Wikibase\Repo\Rdf\RdfBuilder::$entitiesToOutput
private

◆ $entityContentFactory

Wikibase\Repo\Rdf\RdfBuilder::$entityContentFactory
private

◆ $entityRdfBuilders

Wikibase\Repo\Rdf\RdfBuilder::$entityRdfBuilders
private

◆ $entityRevisionLookup

Wikibase\Repo\Rdf\RdfBuilder::$entityRevisionLookup
private

◆ $entityStubRdfBuilderFactory

Wikibase\Repo\Rdf\RdfBuilder::$entityStubRdfBuilderFactory
private

◆ $entityStubRdfBuilders

Wikibase\Repo\Rdf\RdfBuilder::$entityStubRdfBuilders
private

◆ $produceWhat

Wikibase\Repo\Rdf\RdfBuilder::$produceWhat
private

◆ $vocabulary

Wikibase\Repo\Rdf\RdfBuilder::$vocabulary
private

◆ $writer

Wikibase\Repo\Rdf\RdfBuilder::$writer
private

The documentation for this class was generated from the following file: