\acdhOeaw\util\metadataValidatorMetadataValidator

Validates metadata (EasyRdf\Graph or EasyRdf\Resource) against the ontology in the Fedora.

Summary

Methods
Properties
Constants
validateGraph()
validateResource()
validateFedoraResource()
printResults()
No public properties found
RDFS_TYPE
No protected methods found
No protected properties found
N/A
checkClass()
checkProperty()
getPropertyDef()
checkRangeDomain()
loadClasses()
$cache
$classes
N/A

Constants

RDFS_TYPE

RDFS_TYPE

Properties

$cache

$cache : array

Stores RDF properties definitions fetched from the repository.

Type

array

$classes

$classes : array

Stores inheritence list for all classes as a map. Key is class URI, value is an array of inherited class URIs (including class URI).

Type

array

Methods

validateGraph()

validateGraph(\EasyRdf\Graph  $graph, \acdhOeaw\fedora\Fedora  $fedora) : array

Checks a given RDF graph against ontology in a given Fedora repository.

Parameters

\EasyRdf\Graph $graph

RDF graph to be checked

\acdhOeaw\fedora\Fedora $fedora

repository connection object

Returns

array —

list of errors

validateResource()

validateResource(Resource  $res, \acdhOeaw\fedora\Fedora  $fedora) : array

Checks a given EasyRdf\Resource against ontology in a given repository.

Parameters

Resource $res
\acdhOeaw\fedora\Fedora $fedora

repository connection object

Returns

array —

list of errors

validateFedoraResource()

validateFedoraResource(\acdhOeaw\fedora\FedoraResource  $res) : array

Checks a given FedoraResource. Simple overlay on top of the validateResource() method.

Parameters

\acdhOeaw\fedora\FedoraResource $res

Returns

array —

list of errors

printResults()

printResults(array  $results, string  $format = 'text') 

Pretty prints a list of errors.

Parameters

array $results

list of errors

string $format

print format: tsv or text

checkClass()

checkClass(Resource  $res, \acdhOeaw\fedora\Fedora  $fedora) : array

Checks if a resource is of known class

Parameters

Resource $res

resource to be checked

\acdhOeaw\fedora\Fedora $fedora

repository connection object

Returns

array —

list of errors

checkProperty()

checkProperty(string  $property, Resource  $res, \acdhOeaw\fedora\Fedora  $fedora) : array

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.

Parameters

string $property

RDF property to be checked

Resource $res

resource containing given property values

\acdhOeaw\fedora\Fedora $fedora

repository connection object

Throws

\RuntimeException

Returns

array —

list of errors

getPropertyDef()

getPropertyDef(string  $property, \acdhOeaw\fedora\Fedora  $fedora) : \acdhOeaw\util\metadataValidator\OntologyProperty

Fetches property definition from cache.

Creates a deifinition if it does not exist.

Parameters

string $property

RDF property URI

\acdhOeaw\fedora\Fedora $fedora

repository connection object

Returns

\acdhOeaw\util\metadataValidator\OntologyProperty

checkRangeDomain()

checkRangeDomain(\acdhOeaw\util\metadataValidator\type  $res, string  $class) : boolean

Checks if a given subject/value is of a given class taking into account class inheritance.

Literal values are not checked at the moment!

Parameters

\acdhOeaw\util\metadataValidator\type $res

subject/value to be checked

string $class

class a subject/value should match

Returns

boolean

loadClasses()

loadClasses(\acdhOeaw\fedora\Fedora  $fedora) 

Loads classes defined in the ontology.

Parameters

\acdhOeaw\fedora\Fedora $fedora

repository connection object