Skip to content

Commit

Permalink
Property::check(): check for multiple ranges
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Feb 27, 2024
1 parent 2c1fb18 commit 68dbeb3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/acdhOeaw/arche/schemaImport/Property.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,15 @@ class Property extends Entity {
public function check(bool $verbose): ?bool {
$base = $this->schema->namespaces->ontology;
$result = true;
$range = (string) $this->res->getResource(RDF::RDFS_RANGE);

if (empty($range)) {
$range = $this->res->allResources(RDF::RDFS_RANGE);
if (count($range) > 1) {
echo $verbose ? $this->res->getUri() . " - has multiple ranges\n" : '';
$result = false;
} elseif (count($range) === 0) {
echo $verbose ? $this->res->getUri() . " - has an empty range\n" : '';
$result = false;
} else {
$range = (string) array_pop($range);
if (!empty($this->res->get($base . 'langTag')) && $range !== RDF::XSD_STRING) {
echo $verbose ? $this->res->getUri() . " - requires a language tag but its range $range is not xsd:string\n" : '';
$result = false;
Expand Down Expand Up @@ -93,5 +96,4 @@ public function check(bool $verbose): ?bool {

return $result;
}

}

0 comments on commit 68dbeb3

Please sign in to comment.