Wikibase
MediaWiki Wikibase extension
Loading...
Searching...
No Matches
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 (SiteList $sites, RdfVocabulary $vocabulary, ValueSnakRdfBuilderFactory $valueSnakRdfBuilderFactory, PropertyDataTypeLookup $propertyLookup, EntityRdfBuilderFactory $entityRdfBuilderFactory, $flavor, RdfWriter $writer, DedupeBag $dedupeBag, EntityTitleLookup $titleLookup)
 
 startDocument ()
 Start writing RDF document Note that this builder does not have to finish it, it may be finished later.
 
 finishDocument ()
 Finish writing the document After that, nothing should ever be written into the document.
 
 getRDF ()
 Returns the RDF generated by the builder.
 
 getNamespaces ()
 Returns a map of namespace names to URIs.
 
 getPageProperties ()
 Get map of page properties used by this builder.
 
 entityReferenceMentioned (EntityId $id)
 
 propertyMentioned (PropertyId $id)
 
 subEntityMentioned (EntityDocument $entity)
 
 addEntityRevisionInfo (EntityId $entityId, $revision, $timestamp)
 Adds revision information about an entity's revision to the RDF graph.
 
 setPageProps (PageProps $pageProps)
 Set page props handler.
 
 addEntityPageProps (EntityId $entityId)
 Add page props information.
 
 addEntity (EntityDocument $entity)
 Add an entity to the RDF graph, including all supported structural components of the entity and its sub entities.
 
 resolveMentionedEntities (EntityLookup $entityLookup)
 Add stubs for any entities that were previously mentioned (e.g.
 
 addEntityStub (EntityDocument $entity)
 Adds stub information for the given Entity to the RDF graph.
 
 addEntityRedirect (EntityId $from, EntityId $to)
 Declares $from to be an alias for $to, using the owl:sameAs relationship.
 
 addDumpHeader ( $timestamp=0)
 Create header structure for the dump (this makes RdfProducer::PRODUCE_VERSION_INFO redundant)
 

Private Member Functions

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

Private Attributes

 $entitiesResolved = []
 
 $entitiesToOutput
 
 $produceWhat
 
 $writer
 
 $dedupeBag
 
 $builders = []
 
 $vocabulary
 
 $propertyLookup
 
 $valueSnakRdfBuilderFactory
 
 $titleLookup
 
 $pageProps
 
 $entityRdfBuilders
 

Detailed Description

RDF mapping for wikibase data model.

Constructor & Destructor Documentation

◆ __construct()

Wikibase\Repo\Rdf\RdfBuilder::__construct ( SiteList  $sites,
RdfVocabulary  $vocabulary,
ValueSnakRdfBuilderFactory  $valueSnakRdfBuilderFactory,
PropertyDataTypeLookup  $propertyLookup,
EntityRdfBuilderFactory  $entityRdfBuilderFactory,
  $flavor,
RdfWriter  $writer,
DedupeBag  $dedupeBag,
EntityTitleLookup  $titleLookup 
)
Parameters
SiteList$sites
RdfVocabulary$vocabulary
ValueSnakRdfBuilderFactory$valueSnakRdfBuilderFactory
PropertyDataTypeLookup$propertyLookup
EntityRdfBuilderFactory$entityRdfBuilderFactory
int$flavor
RdfWriter$writer
DedupeBag$dedupeBag
EntityTitleLookup$titleLookup

Member Function Documentation

◆ addDumpHeader()

Wikibase\Repo\Rdf\RdfBuilder::addDumpHeader (   $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 ( EntityDocument  $entity)
private

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

Todo:
extract into MetaDataRdfBuilder
Parameters
EntityDocument$entity

◆ addEntityPageProps()

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

Add page props information.

Parameters
EntityId$entityId

◆ addEntityRedirect()

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

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

Parameters
EntityId$from
EntityId$to

◆ addEntityRevisionInfo()

Wikibase\Repo\Rdf\RdfBuilder::addEntityRevisionInfo ( EntityId  $entityId,
  $revision,
  $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 ( EntityDocument  $entity)

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

Stub information means meta information and labels.

Parameters
EntityDocument$entity

Implements Wikibase\Repo\Rdf\EntityRdfBuilder.

◆ 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)
See also
EntityMentionListener::entityReferenceMentioned
Parameters
EntityId$id

Implements Wikibase\Repo\Rdf\EntityMentionListener.

◆ entityResolved()

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

Registers an entity as resolved.

Parameters
EntityId$entityId

◆ 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.

Parameters
EntityId$entityId

◆ 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.

Returns
array

◆ getPageProperties()

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

Get map of page properties used by this builder.

Returns
string[][]

◆ getRDF()

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

Returns the RDF generated by the builder.

Returns
string RDF

◆ newFullStatementRdfBuilder()

Wikibase\Repo\Rdf\RdfBuilder::newFullStatementRdfBuilder ( )
private
Returns
EntityRdfBuilder

◆ newSnakBuilder()

Wikibase\Repo\Rdf\RdfBuilder::newSnakBuilder (   $flavorFlags)
private
Parameters
int$flavorFlagsFlavor flags to use for this builder
Returns
SnakRdfBuilder

◆ newTruthyStatementRdfBuilder()

Wikibase\Repo\Rdf\RdfBuilder::newTruthyStatementRdfBuilder ( )
private
Returns
EntityRdfBuilder

◆ propertyMentioned()

Wikibase\Repo\Rdf\RdfBuilder::propertyMentioned ( PropertyId  $id)
See also
EntityMentionListener::propertyMentioned
Parameters
PropertyId$id

Implements Wikibase\Repo\Rdf\EntityMentionListener.

◆ resolveMentionedEntities()

Wikibase\Repo\Rdf\RdfBuilder::resolveMentionedEntities ( EntityLookup  $entityLookup)

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

as properties or data values).

Parameters
EntityLookup$entityLookup

◆ setPageProps()

Wikibase\Repo\Rdf\RdfBuilder::setPageProps ( PageProps  $pageProps)

Set page props handler.

Parameters
PageProps$pageProps
Returns
self

◆ shouldProduce()

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

Should we produce this aspect?

Parameters
int$what
Returns
bool

◆ 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)
See also
EntityMentionListener::subEntityMentioned
Parameters
EntityDocument$entity

Implements Wikibase\Repo\Rdf\EntityMentionListener.

Member Data Documentation

◆ $builders

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

◆ $dedupeBag

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

◆ $entitiesResolved

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

◆ $entitiesToOutput

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

◆ $entityRdfBuilders

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

◆ $pageProps

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

◆ $produceWhat

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

◆ $propertyLookup

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

◆ $titleLookup

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

◆ $valueSnakRdfBuilderFactory

Wikibase\Repo\Rdf\RdfBuilder::$valueSnakRdfBuilderFactory
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: