Skip to content

Commit

Permalink
Ontology: do not initialize properties without range
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Feb 27, 2024
1 parent 2df0302 commit f0bf169
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/acdhOeaw/arche/lib/schema/Ontology.php
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ private function loadPropertiesDb(): void {
FROM t JOIN identifiers i ON t.pid = i.id
GROUP BY 1
) c2 USING (id)
LEFT JOIN (
JOIN (
SELECT r.id, jsonb_agg(ids) AS range
FROM relations r JOIN identifiers i ON r.target_id = i.id AND r.property = ?
GROUP BY 1
Expand Down Expand Up @@ -767,12 +767,13 @@ private function loadClassRest(object $data, string $nmsp, string $baseUrl): voi
private function loadPropertyRest(object $data, string $nmsp): void {
$data->property = $data->ids;
$data->properties = $data->ids;
if (!isset($data->range)) {
return;
}
$data->range = array_unique(array_merge(...array_map(fn($x) => $x->ids, $data->range)));
if (isset($data->domain)) {
$data->domain = array_unique(array_merge(...array_map(fn($x) => $x->ids, $data->domain)));
}
if (isset($data->range)) {
$data->range = array_unique(array_merge(...array_map(fn($x) => $x->ids, $data->range)));
}
if (isset($data->recommendedClass)) {
$data->recommendedClass = array_unique(array_merge(...array_map(fn($x) => $x->ids, $data->recommendedClass)));
}
Expand Down

0 comments on commit f0bf169

Please sign in to comment.