src/acdhOeaw/util/metadataValidator/MetadataValidator.php
static private function checkProperty(string $property, Resource $res,
                                          Fedora $fedora): array {
        $uri = $res->getUri();
        $ret = array();
        try {
            $propDef = self::getPropertyDef($property, $fedora);

            if (!self::checkRangeDomain($res, $propDef->getDomain())) {
                $ret[] = new Error($uri, 'wrong domain', '', $property);
            }

            list($matchType, $wrongType) = $propDef->fetchValues($res);
            foreach ($wrongType as $i) {
                $ret[] = new Error($uri, 'wrong value type (literal/uri)', (string) $i, $property);
            }
            foreach ($matchType as $i) {
                if (!self::checkRangeDomain($i, $propDef->getRange())) {
                    $ret[] = new Error($uri, 'wrong range', $i->getUri(), $property);
                }
            }
        } catch (RuntimeException $e) {
            switch ($e->getCode()) {
                case 10:
                    $ret[] = new Error($uri, 'unknown property', '', $property);
                    break;
                case 11:
                    $ret[] = new Error($uri, 'wrongly defined property', '', $property);
                    break;
                case 12:
                    $ret[] = new Error($uri, 'wrongly defined property', '', $property);
                    break;
                default:
                    throw $e;
            }
        }
        return $ret;
    }
static private function checkProperty(string $property, Resource $res,
                                          Fedora $fedora): array {
        $uri = $res->getUri();
        $ret = array();
        try {
            $propDef = self::getPropertyDef($property, $fedora);

            if (!self::checkRangeDomain($res, $propDef->getDomain())) {
                $ret[] = new Error($uri, 'wrong domain', '', $property);
            }

            list($matchType, $wrongType) = $propDef->fetchValues($res);
            foreach ($wrongType as $i) {
                $ret[] = new Error($uri, 'wrong value type (literal/uri)', (string) $i, $property);
            }
            foreach ($matchType as $i) {
                if (!self::checkRangeDomain($i, $propDef->getRange())) {
                    $ret[] = new Error($uri, 'wrong range', $i->getUri(), $property);
                }
            }
        } catch (RuntimeException $e) {
            switch ($e->getCode()) {
                case 10:
                    $ret[] = new Error($uri, 'unknown property', '', $property);
                    break;
                case 11:
                    $ret[] = new Error($uri, 'wrongly defined property', '', $property);
                    break;
                case 12:
                    $ret[] = new Error($uri, 'wrongly defined property', '', $property);
                    break;
                default:
                    throw $e;
            }
        }
        return $ret;
    }
static private function checkProperty ( string $ property , Resource $ res , Fedora $ fedora ) : array { $ uri = $ res -> getUri ( ) ; $ ret = array ( ) ; try { $ propDef = self :: getPropertyDef ( $ property , $ fedora ) ; if ( ! self :: checkRangeDomain ( $ res , $ propDef -> getDomain ( ) ) ) { $ ret [ ] = new Error ( $ uri , 'wrong domain' , '' , $ property ) ; } list ( $ matchType , $ wrongType ) = $ propDef -> fetchValues ( $ res ) ; foreach ( $ wrongType as $ i ) { $ ret [ ] = new Error ( $ uri , 'wrong value type (literal/uri)' , ( string ) $ i , $ property ) ; } foreach ( $ matchType as $ i ) { if ( ! self :: checkRangeDomain ( $ i , $ propDef -> getRange ( ) ) ) { $ ret [ ] = new Error ( $ uri , 'wrong range' , $ i -> getUri ( ) , $ property ) ; } } } catch ( RuntimeException $ e ) { switch ( $ e -> getCode ( ) ) { case 10 : $ ret [ ] = new Error ( $ uri , 'unknown property' , '' , $ property ) ; break ; case 11 : $ ret [ ] = new Error ( $ uri , 'wrongly defined property' , '' , $ property ) ; break ; case 12 : $ ret [ ] = new Error ( $ uri , 'wrongly defined property' , '' , $ property ) ; break ; default : throw $ e ; } } return $ ret ; }
Checks if a given property is defined in the ontology and if all its
values for a given resource match property definition provided by the
ontology.
@param string $property RDF property to be checked
@param Resource $res resource containing given property values
@param Fedora $fedora repository connection object
@return array list of errors
@throws RuntimeException
Checks if a given property is defined in the ontology and if all its values for a given resource match property definition provided by the ontology .