protected function importProperties(core_kernel_classes_Resource $resource, $propertiesValues, $map, $class)
    {
        if (isset($propertiesValues[OntologyRdf::RDF_TYPE])) {
            // assuming single Type
            if (count($propertiesValues[OntologyRdf::RDF_TYPE]) > 1) {
                return new common_report_Report(common_report_Report::TYPE_ERROR, __('Resource not imported due to multiple types'));
            } else {
                foreach ($propertiesValues[OntologyRdf::RDF_TYPE] as $k => $v) {
                    $classType = isset($map[$v['value']])
                        ? new core_kernel_classes_Class($map[$v['value']])
                        : $class;
                    //$resource->setType($classType);
                    $classType->createInstance(null, null, $resource->getUri());
                }
            }
            unset($propertiesValues[OntologyRdf::RDF_TYPE]);
        }

        if (isset($propertiesValues[OntologyRdfs::RDFS_SUBCLASSOF])) {
            $resource = new core_kernel_classes_Class($resource);
            // assuming single subclass
            if (isset($propertiesValues[OntologyRdf::RDF_TYPE]) && count($propertiesValues[OntologyRdf::RDF_TYPE]) > 1) {
                return new common_report_Report(common_report_Report::TYPE_ERROR, __('Resource not imported due to multiple super classes'));
            }
            foreach ($propertiesValues[OntologyRdfs::RDFS_SUBCLASSOF] as $k => $v) {
                $classSup = isset($map[$v['value']])
                    ? new core_kernel_classes_Class($map[$v['value']])
                    : $class;
                $resource->setSubClassOf($classSup);
            }

            unset($propertiesValues[OntologyRdfs::RDFS_SUBCLASSOF]);
        }
        foreach ($propertiesValues as $prop => $values) {
            $property = new core_kernel_classes_Property(isset($map[$prop]) ? $map[$prop] : $prop);
            foreach ($values as $k => $v) {
                $value = isset($map[$v['value']]) ? $map[$v['value']] : $v['value'];
                if (isset($v['lang'])) {
                    $resource->setPropertyValueByLg($property, $value, $v['lang']);
                } else {
                    $resource->setPropertyValue($property, $value);
                }
            }
        }
        $msg = $resource instanceof core_kernel_classes_Class
            ? __('Successfully imported class "%s"', $resource->getLabel())
            : __('Successfully imported "%s"', $resource->getLabel());

        return new common_report_Report(common_report_Report::TYPE_SUCCESS, $msg, $resource);
    }
protected function importProperties(core_kernel_classes_Resource $resource, $propertiesValues, $map, $class)
    {
        if (isset($propertiesValues[OntologyRdf::RDF_TYPE])) {
            // assuming single Type
            if (count($propertiesValues[OntologyRdf::RDF_TYPE]) > 1) {
                return new common_report_Report(common_report_Report::TYPE_ERROR, __('Resource not imported due to multiple types'));
            } else {
                foreach ($propertiesValues[OntologyRdf::RDF_TYPE] as $k => $v) {
                    $classType = isset($map[$v['value']])
                        ? new core_kernel_classes_Class($map[$v['value']])
                        : $class;
                    //$resource->setType($classType);
                    $classType->createInstance(null, null, $resource->getUri());
                }
            }
            unset($propertiesValues[OntologyRdf::RDF_TYPE]);
        }

        if (isset($propertiesValues[OntologyRdfs::RDFS_SUBCLASSOF])) {
            $resource = new core_kernel_classes_Class($resource);
            // assuming single subclass
            if (isset($propertiesValues[OntologyRdf::RDF_TYPE]) && count($propertiesValues[OntologyRdf::RDF_TYPE]) > 1) {
                return new common_report_Report(common_report_Report::TYPE_ERROR, __('Resource not imported due to multiple super classes'));
            }
            foreach ($propertiesValues[OntologyRdfs::RDFS_SUBCLASSOF] as $k => $v) {
                $classSup = isset($map[$v['value']])
                    ? new core_kernel_classes_Class($map[$v['value']])
                    : $class;
                $resource->setSubClassOf($classSup);
            }

            unset($propertiesValues[OntologyRdfs::RDFS_SUBCLASSOF]);
        }
        foreach ($propertiesValues as $prop => $values) {
            $property = new core_kernel_classes_Property(isset($map[$prop]) ? $map[$prop] : $prop);
            foreach ($values as $k => $v) {
                $value = isset($map[$v['value']]) ? $map[$v['value']] : $v['value'];
                if (isset($v['lang'])) {
                    $resource->setPropertyValueByLg($property, $value, $v['lang']);
                } else {
                    $resource->setPropertyValue($property, $value);
                }
            }
        }
        $msg = $resource instanceof core_kernel_classes_Class
            ? __('Successfully imported class "%s"', $resource->getLabel())
            : __('Successfully imported "%s"', $resource->getLabel());

        return new common_report_Report(common_report_Report::TYPE_SUCCESS, $msg, $resource);
    }
protected function importProperties ( core_kernel_classes_Resource $ resource , $ propertiesValues , $ map , $ class ) { if ( isset ( $ propertiesValues [ OntologyRdf :: RDF_TYPE ] ) ) { // assuming single Type if ( count ( $ propertiesValues [ OntologyRdf :: RDF_TYPE ] ) > 1 ) { return new common_report_Report ( common_report_Report :: TYPE_ERROR , __ ( 'Resource not imported due to multiple types' ) ) ; } else { foreach ( $ propertiesValues [ OntologyRdf :: RDF_TYPE ] as $ k => $ v ) { $ classType = isset ( $ map [ $ v [ 'value' ] ] ) ? new core_kernel_classes_Class ( $ map [ $ v [ 'value' ] ] ) : $ class ; //$resource->setType($classType); $ classType -> createInstance ( null , null , $ resource -> getUri ( ) ) ; } } unset ( $ propertiesValues [ OntologyRdf :: RDF_TYPE ] ) ; } if ( isset ( $ propertiesValues [ OntologyRdfs :: RDFS_SUBCLASSOF ] ) ) { $ resource = new core_kernel_classes_Class ( $ resource ) ; // assuming single subclass if ( isset ( $ propertiesValues [ OntologyRdf :: RDF_TYPE ] ) && count ( $ propertiesValues [ OntologyRdf :: RDF_TYPE ] ) > 1 ) { return new common_report_Report ( common_report_Report :: TYPE_ERROR , __ ( 'Resource not imported due to multiple super classes' ) ) ; } foreach ( $ propertiesValues [ OntologyRdfs :: RDFS_SUBCLASSOF ] as $ k => $ v ) { $ classSup = isset ( $ map [ $ v [ 'value' ] ] ) ? new core_kernel_classes_Class ( $ map [ $ v [ 'value' ] ] ) : $ class ; $ resource -> setSubClassOf ( $ classSup ) ; } unset ( $ propertiesValues [ OntologyRdfs :: RDFS_SUBCLASSOF ] ) ; } foreach ( $ propertiesValues as $ prop => $ values ) { $ property = new core_kernel_classes_Property ( isset ( $ map [ $ prop ] ) ? $ map [ $ prop ] : $ prop ) ; foreach ( $ values as $ k => $ v ) { $ value = isset ( $ map [ $ v [ 'value' ] ] ) ? $ map [ $ v [ 'value' ] ] : $ v [ 'value' ] ; if ( isset ( $ v [ 'lang' ] ) ) { $ resource -> setPropertyValueByLg ( $ property , $ value , $ v [ 'lang' ] ) ; } else { $ resource -> setPropertyValue ( $ property , $ value ) ; } } } $ msg = $ resource instanceof core_kernel_classes_Class ? __ ( 'Successfully imported class "%s"' , $ resource -> getLabel ( ) ) : __ ( 'Successfully imported "%s"' , $ resource -> getLabel ( ) ) ; return new common_report_Report ( common_report_Report :: TYPE_SUCCESS , $ msg , $ resource ) ; }
Import the properties of the resource

@param core_kernel_classes_Resource $resource
@param array                        $propertiesValues
@param array                        $map
@param core_kernel_classes_Class    $class
@return common_report_Report
Import the properties of the resource