public function run()
    {
        $this->data = [];

        if (empty($this->item) || !($this->item instanceof \core_kernel_classes_Resource)) {
            throw new ExtractorException('Export item not set.');
        }

        $properties = [];
        foreach ($this->columns as $config) {
            $properties[] = $config['property'];
        }
        $values = $this->item->getPropertiesValues($properties);

        foreach ($this->columns as $column => $config) {
            try {
                $data = [];
                foreach ($values[$config['property']->getUri()] as $itemValue) {
                    if (is_array($itemValue)) {
                        array_walk($itemValue, function (&$value) {
                            $resource = new \core_kernel_classes_Resource($value);
                            $value = $resource->getLabel();
                        });

                        if (isset($config['delimiter'])) {
                            $delimiter = $config['delimiter'];
                        } else {
                            $delimiter = self::DEFAULT_PROPERTY_DELIMITER;
                        }
                        $data[] = explode($delimiter, $itemValue);
                        continue;
                    }

                    $data[] = ($itemValue instanceof \core_kernel_classes_Resource)? $itemValue->getLabel() : (string)$itemValue;
                }
            } catch (\Exception $e) {
                \common_Logger::e('ERROR on column ' . $column . ' : ' . $e->getMessage());
                $data = ['N/A'];
            }

            $this->data[$column] = implode(self::DEFAULT_PROPERTY_DELIMITER, $data);
        }
        $this->columns = [];
        return $this;
    }
public function run()
    {
        $this->data = [];

        if (empty($this->item) || !($this->item instanceof \core_kernel_classes_Resource)) {
            throw new ExtractorException('Export item not set.');
        }

        $properties = [];
        foreach ($this->columns as $config) {
            $properties[] = $config['property'];
        }
        $values = $this->item->getPropertiesValues($properties);

        foreach ($this->columns as $column => $config) {
            try {
                $data = [];
                foreach ($values[$config['property']->getUri()] as $itemValue) {
                    if (is_array($itemValue)) {
                        array_walk($itemValue, function (&$value) {
                            $resource = new \core_kernel_classes_Resource($value);
                            $value = $resource->getLabel();
                        });

                        if (isset($config['delimiter'])) {
                            $delimiter = $config['delimiter'];
                        } else {
                            $delimiter = self::DEFAULT_PROPERTY_DELIMITER;
                        }
                        $data[] = explode($delimiter, $itemValue);
                        continue;
                    }

                    $data[] = ($itemValue instanceof \core_kernel_classes_Resource)? $itemValue->getLabel() : (string)$itemValue;
                }
            } catch (\Exception $e) {
                \common_Logger::e('ERROR on column ' . $column . ' : ' . $e->getMessage());
                $data = ['N/A'];
            }

            $this->data[$column] = implode(self::DEFAULT_PROPERTY_DELIMITER, $data);
        }
        $this->columns = [];
        return $this;
    }
public function run ( ) { $ this -> data = [ ] ; if ( empty ( $ this -> item ) || ! ( $ this -> item instanceof \ core_kernel_classes_Resource ) ) { throw new ExtractorException ( 'Export item not set.' ) ; } $ properties = [ ] ; foreach ( $ this -> columns as $ config ) { $ properties [ ] = $ config [ 'property' ] ; } $ values = $ this -> item -> getPropertiesValues ( $ properties ) ; foreach ( $ this -> columns as $ column => $ config ) { try { $ data = [ ] ; foreach ( $ values [ $ config [ 'property' ] -> getUri ( ) ] as $ itemValue ) { if ( is_array ( $ itemValue ) ) { array_walk ( $ itemValue , function ( & $ value ) { $ resource = new \ core_kernel_classes_Resource ( $ value ) ; $ value = $ resource -> getLabel ( ) ; } ) ; if ( isset ( $ config [ 'delimiter' ] ) ) { $ delimiter = $ config [ 'delimiter' ] ; } else { $ delimiter = self :: DEFAULT_PROPERTY_DELIMITER ; } $ data [ ] = explode ( $ delimiter , $ itemValue ) ; continue ; } $ data [ ] = ( $ itemValue instanceof \ core_kernel_classes_Resource ) ? $ itemValue -> getLabel ( ) : ( string ) $ itemValue ; } } catch ( \ Exception $ e ) { \ common_Logger :: e ( 'ERROR on column ' . $ column . ' : ' . $ e -> getMessage ( ) ) ; $ data = [ 'N/A' ] ; } $ this -> data [ $ column ] = implode ( self :: DEFAULT_PROPERTY_DELIMITER , $ data ) ; } $ this -> columns = [ ] ; return $ this ; }
Get ontology values of requested item properties

@return $this
@throws \Exception
Get ontology values of requested item properties