private function assertSnakHasUnDeserializableValue(PropertyValueSnak $snak)
 {
     $this->assertEquals(new PropertyId('P42'), $snak->getPropertyId());
     $dataValue = $snak->getDataValue();
     /**
      * @var UnDeserializableValue $dataValue
      */
     $this->assertInstanceOf('DataValues\\UnDeserializableValue', $dataValue);
     $this->assertEquals($dataValue->getTargetType(), 'string');
     $this->assertEquals($dataValue->getValue(), 1337);
 }
 /**
  * @see SnakUrlExpander::expandUrl
  *
  * @param PropertyValueSnak $snak
  *
  * @return string|null A URL or URI derived from the Snak, or null if no such URL
  *         could be determined.
  */
 public function expandUrl(PropertyValueSnak $snak)
 {
     $propertyId = $snak->getPropertyId();
     $value = $snak->getDataValue();
     Assert::parameterType('DataValues\\StringValue', $value, '$snak->getDataValue()');
     $pattern = $this->infoProvider->getPropertyInfo($propertyId);
     if ($pattern === null) {
         return null;
     }
     $id = urlencode($value->getValue());
     $url = str_replace('$1', $id, $pattern);
     return $url;
 }
 public function testGetPropertyId()
 {
     $snak = new PropertyValueSnak(new PropertyId('P1'), new StringValue('a'));
     $propertyId = $snak->getPropertyId();
     $this->assertInstanceOf('Wikibase\\DataModel\\Entity\\PropertyId', $propertyId);
 }
 /**
  * Adds the value of the given property to the RDF graph.
  *
  * @param RdfWriter $writer
  * @param PropertyValueSnak $snak
  * @param string $propertyNamespace The property namespace for this snak
  */
 private function addSnakValue(RdfWriter $writer, PropertyValueSnak $snak, $propertyNamespace)
 {
     $propertyId = $snak->getPropertyId();
     $propertyValueLName = $this->vocabulary->getEntityLName($propertyId);
     $propertyKey = $propertyId->getSerialization();
     // cache data type for all properties we encounter
     if (!isset($this->propertyTypes[$propertyKey])) {
         try {
             $this->propertyTypes[$propertyKey] = $this->propertyLookup->getDataTypeIdForProperty($propertyId);
         } catch (PropertyDataTypeLookupException $e) {
             $this->propertyTypes[$propertyKey] = "unknown";
         }
     }
     $dataType = $this->propertyTypes[$propertyKey];
     $this->valueBuilder->addValue($writer, $propertyNamespace, $propertyValueLName, $dataType, $snak);
 }