/** * Adds the given Statement's main Snak to the RDF graph. * * @param EntityId $entityId * @param string $statementLName * @param Statement $statement * @param bool $isBest Is this best ranked statement? */ private function addMainSnak(EntityId $entityId, $statementLName, Statement $statement, $isBest) { $snak = $statement->getMainSnak(); $entityLName = $this->vocabulary->getEntityLName($entityId); $propertyLName = $this->vocabulary->getEntityLName($snak->getPropertyId()); $this->statementWriter->about(RdfVocabulary::NS_ENTITY, $entityLName)->say(RdfVocabulary::NSP_CLAIM, $propertyLName)->is(RdfVocabulary::NS_STATEMENT, $statementLName); $this->statementWriter->about(RdfVocabulary::NS_STATEMENT, $statementLName)->a(RdfVocabulary::NS_ONTOLOGY, 'Statement'); $rank = $statement->getRank(); if (isset(RdfVocabulary::$rankMap[$rank])) { if ($isBest) { $this->statementWriter->a(RdfVocabulary::NS_ONTOLOGY, RdfVocabulary::WIKIBASE_RANK_BEST); } $this->statementWriter->about(RdfVocabulary::NS_STATEMENT, $statementLName)->say(RdfVocabulary::NS_ONTOLOGY, 'rank')->is(RdfVocabulary::NS_ONTOLOGY, RdfVocabulary::$rankMap[$rank]); } else { wfLogWarning("Unknown rank {$rank} encountered for {$entityId}:{$statement->getGuid()}"); } $this->snakBuilder->addSnak($this->statementWriter, $snak, RdfVocabulary::NSP_CLAIM_STATEMENT); }