/**
  * Adds the given Statement from the given Entity to the RDF graph.
  *
  * @param EntityId $entityId
  * @param Statement $statement
  * @param bool $isBest Is this best ranked statement?
  */
 private function addStatement(EntityId $entityId, Statement $statement, $isBest)
 {
     $statementLName = $this->vocabulary->getStatementLName($statement);
     $this->addMainSnak($entityId, $statementLName, $statement, $isBest);
     // XXX: separate builder for qualifiers?
     if ($this->produceQualifiers) {
         // this assumes statement was added by addMainSnak
         foreach ($statement->getQualifiers() as $q) {
             $this->snakBuilder->addSnak($this->statementWriter, $q, RdfVocabulary::NSP_QUALIFIER);
         }
     }
     // XXX: separate builder for references?
     if ($this->produceReferences) {
         /** @var Reference $reference */
         foreach ($statement->getReferences() as $reference) {
             //FIXME: split body into separate method
             $hash = $reference->getSnaks()->getHash();
             $refLName = $hash;
             $this->statementWriter->about(RdfVocabulary::NS_STATEMENT, $statementLName)->say(RdfVocabulary::NS_PROV, 'wasDerivedFrom')->is(RdfVocabulary::NS_REFERENCE, $refLName);
             if ($this->dedupeBag->alreadySeen($hash, 'R') !== false) {
                 continue;
             }
             $this->referenceWriter->about(RdfVocabulary::NS_REFERENCE, $refLName)->a(RdfVocabulary::NS_ONTOLOGY, 'Reference');
             foreach ($reference->getSnaks() as $refSnak) {
                 $this->snakBuilder->addSnak($this->referenceWriter, $refSnak, RdfVocabulary::NSP_REFERENCE);
             }
         }
     }
 }