public function testAddResourceValue()
 {
     $property = $this->dataItemFactory->newDIProperty('Foo');
     $dataItem = $this->dataItemFactory->newDIWikiPage('Bar', NS_MAIN);
     $expData = new ExpData(new ExpNsResource('Foobar', 'Bar', 'Mo', null));
     $instance = new PropertyValueResourceBuilder();
     $instance->addResourceValue($expData, $property, $dataItem);
     $this->assertTrue($instance->isResourceBuilderFor($property));
 }
 /**
  * Instead of representing an external identifier as "owl:sameAs", the weaker
  * declarative axiom "skos:exactMatch" has been choosen to avoid potential
  * issues with undesirable entailments.
  *
  * "skos:exactMatch" has been defined as "... indicating a high degree of
  * confidence that the concepts can be used interchangeably across a wide
  * range of information retrieval applications ..."
  *
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
 {
     parent::addResourceValue($expData, $property, $dataItem);
     $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $property);
     $formattedUriDataItem = $dataValue->getWithFormattedUri();
     if ($formattedUriDataItem instanceof DIUri) {
         $expData->addPropertyObjectValue($this->exporter->getSpecialNsResource('skos', 'exactMatch'), $this->exporter->getDataItemExpElement($formattedUriDataItem));
     }
 }
 /**
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
 {
     parent::addResourceValue($expData, $property, $dataItem);
     $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $property);
     $list = $dataValue->toArray();
     if (!isset($list['_TEXT']) || !isset($list['_LCODE'])) {
         return;
     }
     // https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secpref
     //
     // "skos:prefLabel ... implies that a resource can only have one such
     // label per language tag ... it is recommended that no two concepts in
     // the same KOS be given the same preferred lexical label for any given
     // language tag ..."
     $expData->addPropertyObjectValue($this->exporter->getSpecialNsResource('skos', 'prefLabel'), new ExpLiteral((string) $list['_TEXT'], 'http://www.w3.org/2001/XMLSchema#string', (string) $list['_LCODE'], $dataItem));
 }
 /**
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
 {
     parent::addResourceValue($expData, $property, $dataItem);
     $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $property);
     $list = $dataValue->toArray();
     if (!isset($list['_TEXT']) || !isset($list['_LCODE'])) {
         return;
     }
     // Ussing `skos:scopeNote` instead of `skos:definition` since we can not
     // ensure that the description given by a user is complete.
     //
     // "skos:scopeNote supplies some, possibly partial, information about the
     // intended meaning of a concept ..."
     //
     // "skos:definition supplies a complete explanation of the intended
     // meaning of a concept."
     //
     // According to https://www.w3.org/TR/2009/NOTE-skos-primer-20090818/#secdocumentation
     $expData->addPropertyObjectValue($this->exporter->getSpecialNsResource('skos', 'scopeNote'), new ExpLiteral((string) $list['_TEXT'], 'http://www.w3.org/2001/XMLSchema#string', (string) $list['_LCODE'], $dataItem));
 }
 /**
  * @since 2.5
  *
  * {@inheritDoc}
  */
 public function addResourceValue(ExpData $expData, DIProperty $property, DataItem $dataItem)
 {
     $expResourceElement = $this->exporter->getResourceElementForWikiPage($property->getCanonicalDiWikiPage(), true);
     // Avoid that an imported vocabulary is pointing to an internal resource.
     //
     // For example: <Has_alternative_label> imported from <skos:altLabel>
     // with "Monolingual text" type is expected to produce:
     //
     // - <property:Has_alternative_label rdf:resource="http://example.org/id/Foo_MLa9c103f4379a94bfab97819dacd3c182"/>
     // - <skos:altLabel xml:lang="en">Foo</skos:altLabel>
     if ($expResourceElement->isImported()) {
         $seekImportVocabulary = false;
         $expData->addPropertyObjectValue($this->exporter->getResourceElementForProperty($property, false, $seekImportVocabulary), $this->exporter->getDataItemExpElement($dataItem));
     } else {
         parent::addResourceValue($expData, $property, $dataItem);
     }
     $dataValue = DataValueFactory::getInstance()->newDataValueByItem($dataItem, $property);
     $list = $dataValue->toArray();
     if (!isset($list['_TEXT']) || !isset($list['_LCODE'])) {
         return;
     }
     $expData->addPropertyObjectValue($expResourceElement, new ExpLiteral((string) $list['_TEXT'], 'http://www.w3.org/2001/XMLSchema#string', (string) $list['_LCODE'], $dataItem));
 }