public function extract($resource)
    {
        if (! $resource instanceof \core_kernel_classes_Resource) {
            throw new MetadataExtractionException(__('The given target is not an instance of core_kernel_classes_Resource'));
        }

        $identifier = \tao_helpers_Uri::getUniqueId($resource->getUri());
        $metadata = array($identifier => []);

        $triples = $resource->getRdfTriples();


        /** @var \core_kernel_classes_Triple $triple */
        foreach ($triples->getIterator() as $triple) {

            /** @var \core_kernel_classes_Resource $property */
            $property = $this->getResource($triple->predicate);
            $value = $triple->object;

            if (trim($value) != ''
                && $property->isProperty()
                && !in_array($property->getUri(), self::$excludedProperties)
            ) {
                $metadata[$identifier][] = new ClassificationMetadataValue(
                    new ClassificationSourceMetadataValue($resource->getUri(), $property->getUri()),
                    [new ClassificationEntryMetadataValue($resource->getUri(), $value)]
                );
            }
        }

        if (empty($metadata[$identifier])) {
            return [];
        }

        return $metadata;
    }
public function extract($resource)
    {
        if (! $resource instanceof \core_kernel_classes_Resource) {
            throw new MetadataExtractionException(__('The given target is not an instance of core_kernel_classes_Resource'));
        }

        $identifier = \tao_helpers_Uri::getUniqueId($resource->getUri());
        $metadata = array($identifier => []);

        $triples = $resource->getRdfTriples();


        /** @var \core_kernel_classes_Triple $triple */
        foreach ($triples->getIterator() as $triple) {

            /** @var \core_kernel_classes_Resource $property */
            $property = $this->getResource($triple->predicate);
            $value = $triple->object;

            if (trim($value) != ''
                && $property->isProperty()
                && !in_array($property->getUri(), self::$excludedProperties)
            ) {
                $metadata[$identifier][] = new ClassificationMetadataValue(
                    new ClassificationSourceMetadataValue($resource->getUri(), $property->getUri()),
                    [new ClassificationEntryMetadataValue($resource->getUri(), $value)]
                );
            }
        }

        if (empty($metadata[$identifier])) {
            return [];
        }

        return $metadata;
    }
public function extract ( $ resource ) { if ( ! $ resource instanceof \ core_kernel_classes_Resource ) { throw new MetadataExtractionException ( __ ( 'The given target is not an instance of core_kernel_classes_Resource' ) ) ; } $ identifier = \ tao_helpers_Uri :: getUniqueId ( $ resource -> getUri ( ) ) ; $ metadata = array ( $ identifier => [ ] ) ; $ triples = $ resource -> getRdfTriples ( ) ; /** @var \core_kernel_classes_Triple $triple */ foreach ( $ triples -> getIterator ( ) as $ triple ) { /** @var \core_kernel_classes_Resource $property */ $ property = $ this -> getResource ( $ triple -> predicate ) ; $ value = $ triple -> object ; if ( trim ( $ value ) != '' && $ property -> isProperty ( ) && ! in_array ( $ property -> getUri ( ) , self :: $ excludedProperties ) ) { $ metadata [ $ identifier ] [ ] = new ClassificationMetadataValue ( new ClassificationSourceMetadataValue ( $ resource -> getUri ( ) , $ property -> getUri ( ) ) , [ new ClassificationEntryMetadataValue ( $ resource -> getUri ( ) , $ value ) ] ) ; } } if ( empty ( $ metadata [ $ identifier ] ) ) { return [ ] ; } return $ metadata ; }
Extract resource metadata and transform it to ClassificationMetadataValue

@param \core_kernel_classes_Resource $resource

@return array

@throws MetadataExtractionException
@throws \oat\tao\model\metadata\exception\writer\MetadataWriterException
Extract resource metadata and transform it to ClassificationMetadataValue