Esempio n. 1
0
 private function getSerialized(Property $property)
 {
     $serialization = array('type' => $property->getType(), 'datatype' => $property->getDataTypeId());
     $this->addIdToSerialization($property, $serialization);
     $this->addTermsToSerialization($property, $serialization);
     $this->addStatementListToSerialization($property, $serialization);
     return $serialization;
 }
 /**
  * @see PropertyInfoTable::setPropertyInfo
  *
  * @param Property $property
  *
  * @return array Information to be stored in the "pi_info" column of the "wb_property_info"
  * table. Must be an array and can contain anything that can be encoded by json_encode.
  */
 public function buildPropertyInfo(Property $property)
 {
     $info = array(PropertyInfoStore::KEY_DATA_TYPE => $property->getDataTypeId());
     $formatterUrl = $this->getFormatterUrl($property->getStatements());
     if ($formatterUrl !== null) {
         $info[PropertyInfoStore::KEY_FORMATTER_URL] = $formatterUrl;
     }
     return $info;
 }
 private function addType()
 {
     $this->simpleProperty->type = $this->property->getDataTypeId();
 }
 /**
  * Get Wikibase property name for ontology
  *
  * @param Property $prop
  *
  * @return string
  */
 public function getDataTypeName(Property $prop)
 {
     return preg_replace('/\\W+/', '', ucwords(strtr($prop->getDataTypeId(), '-', ' ')));
 }
 /**
  * Check if the property describes link between objects
  * or just data item.
  *
  * @param Property $property
  * @return boolean
  */
 private function propertyIsLink(Property $property)
 {
     // For now, it's very simple but can be more complex later
     return in_array($property->getDataTypeId(), array('wikibase-item', 'wikibase-property', 'url', 'commonsMedia'));
 }