Beispiel #1
0
 /**
  * @see Hashable::getHash
  *
  * @since 1.0
  *
  * @return string
  */
 public function getHash()
 {
     if ($this->hash === null) {
         $this->hash = sha1($this->getType() . $this->propertyId->getHash() . $this->subDescription->getHash() . $this->isSubProperty);
     }
     return $this->hash;
 }
 /**
  * Creates a value node for $value, and attaches it to the current subject of $writer.
  * If a value node for $value was already created, null is returned. Otherwise, the
  * value node's lname is returned, which should be used to generate detailed about the
  * value into the writer returned by getValueNodeWriter().
  *
  * When this method returns a non-null lname, the current subject of the RdfWriter returned by
  * getValueNodeWriter() will the be value node with that lname.
  *
  * @param RdfWriter $writer
  * @param string $propertyValueNamespace Property value relation namespace
  * @param string $propertyValueLName Property value relation name
  * @param string $dataType Property data type (unused, passed here for symmetry
  *        with the signature of ValueSnakRdfBuilder::addValue).
  * @param DataValue $value
  *
  * @return string|null The LName of the value node (in the RdfVocabulary::NS_VALUE namespace),
  *  or null if the value node should not be processed (generally, because it already has
  *  been processed).
  */
 public function attachValueNode(RdfWriter $writer, $propertyValueNamespace, $propertyValueLName, $dataType, DataValue $value)
 {
     $valueLName = $value->getHash();
     $writer->say(RdfVocabulary::$claimToValue[$propertyValueNamespace], $propertyValueLName)->is(RdfVocabulary::NS_VALUE, $valueLName);
     if ($this->dedupeBag->alreadySeen($valueLName, 'V') !== false) {
         return null;
     }
     $this->valueNodeWriter->about(RdfVocabulary::NS_VALUE, $valueLName)->a(RdfVocabulary::NS_ONTOLOGY, $this->vocabulary->getValueTypeName($value));
     return $valueLName;
 }
 /**
  * @see Hashable::getHash
  *
  * @since 1.0
  *
  * @return string
  */
 public function getHash()
 {
     return sha1($this->getType() . $this->propertyId->getHash());
 }
 /**
  * @dataProvider instanceProvider
  * @param DataValue $value
  * @param array $arguments
  */
 public function testGetHash(DataValue $value, array $arguments)
 {
     $hash = $value->getHash();
     $this->assertInternalType('string', $hash);
     $this->assertEquals($hash, $value->getHash());
     $this->assertEquals($hash, $value->getCopy()->getHash());
 }
 /**
  * @see Hashable::getHash
  *
  * @since 1.0
  *
  * @return string
  */
 public function getHash()
 {
     return sha1($this->getType() . $this->value->getHash() . $this->comparator);
 }