From 21463273113984960416cf53951a21192198be24 Mon Sep 17 00:00:00 2001 From: Seweryn Walentynowicz Date: Tue, 5 Jul 2022 11:13:10 +0200 Subject: [PATCH 1/4] remove Smarty error masking any other trouble --- engine/templates/page_corpus_settings.tpl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/engine/templates/page_corpus_settings.tpl b/engine/templates/page_corpus_settings.tpl index e67ac34c..110ab753 100644 --- a/engine/templates/page_corpus_settings.tpl +++ b/engine/templates/page_corpus_settings.tpl @@ -28,7 +28,9 @@
- {include file="$subpage_file"} + {if isset($subpage_file) } + {include file="$subpage_file"} + {/if}
From 0ff05bf67dc05dc75b121b76e85d2b7721f581f5 Mon Sep 17 00:00:00 2001 From: Seweryn Walentynowicz Date: Tue, 5 Jul 2022 12:04:43 +0200 Subject: [PATCH 2/4] restored original sql query from rev. 81a95ce3 --- .../PerspectiveAnnotation_sets.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php b/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php index 20c1da3c..b6dcfcb5 100644 --- a/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php +++ b/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php @@ -12,20 +12,7 @@ function execute() { global $corpus, $db; - $sql = "SELECT t.id, t.name, t.cid, t.count_ann FROM (" . - " SELECT ase.annotation_set_id AS id, ase.name as name,asco.corpus_id AS cid, count(ra.id) as count_ann" . - " FROM annotation_sets ase" . - " LEFT JOIN annotation_sets_corpora asco ON (ase.annotation_set_id = asco.annotation_set_id)" . - " LEFT JOIN reports_annotations ra ON (ase.annotation_set_id = ra.group AND ra.report_id IN (SELECT id FROM reports r WHERE r.corpora = ?))" . - " WHERE asco.corpus_id = ?" . - " GROUP BY ase.annotation_set_id" . - " UNION ALL" . - " SELECT ase.annotation_set_id as id, ase.name as name, null as cid, 0 as count_ann" . - " FROM annotation_sets ase" . - " LEFT JOIN annotation_sets_corpora asco ON ase.annotation_set_id = asco.annotation_set_id" . - " WHERE ase.annotation_set_id IS NOT NULL" . - " GROUP BY ase.name) t" . - " GROUP BY t.name ORDER BY t.id"; + $sql = "SELECT ase.annotation_set_id AS id, ase.name, asco.corpus_id AS cid, count(ra.id) as count_ann FROM annotation_sets ase LEFT JOIN annotation_sets_corpora asco ON (ase.annotation_set_id = asco.annotation_set_id AND asco.corpus_id = ?) LEFT JOIN annotation_types at ON (ase.annotation_set_id = at.group_id) LEFT JOIN reports_annotations ra ON (at.name = ra.type AND ra.report_id IN (SELECT id FROM reports r WHERE r.corpora = ?)) GROUP BY ase.annotation_set_id"; $this->page->set('annotationsList', $db->fetch_rows($sql, array($corpus['id'], $corpus['id']))); } From 8e812ef78c4db13a09e69fa9a874535c6f7aa9d9 Mon Sep 17 00:00:00 2001 From: Seweryn Walentynowicz Date: Wed, 6 Jul 2022 11:45:03 +0200 Subject: [PATCH 3/4] revoke sql query changes done in 0ff05bf6 --- .../PerspectiveAnnotation_sets.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php b/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php index b6dcfcb5..20c1da3c 100644 --- a/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php +++ b/engine/page/corpus_perspectives/PerspectiveAnnotation_sets.php @@ -12,7 +12,20 @@ function execute() { global $corpus, $db; - $sql = "SELECT ase.annotation_set_id AS id, ase.name, asco.corpus_id AS cid, count(ra.id) as count_ann FROM annotation_sets ase LEFT JOIN annotation_sets_corpora asco ON (ase.annotation_set_id = asco.annotation_set_id AND asco.corpus_id = ?) LEFT JOIN annotation_types at ON (ase.annotation_set_id = at.group_id) LEFT JOIN reports_annotations ra ON (at.name = ra.type AND ra.report_id IN (SELECT id FROM reports r WHERE r.corpora = ?)) GROUP BY ase.annotation_set_id"; + $sql = "SELECT t.id, t.name, t.cid, t.count_ann FROM (" . + " SELECT ase.annotation_set_id AS id, ase.name as name,asco.corpus_id AS cid, count(ra.id) as count_ann" . + " FROM annotation_sets ase" . + " LEFT JOIN annotation_sets_corpora asco ON (ase.annotation_set_id = asco.annotation_set_id)" . + " LEFT JOIN reports_annotations ra ON (ase.annotation_set_id = ra.group AND ra.report_id IN (SELECT id FROM reports r WHERE r.corpora = ?))" . + " WHERE asco.corpus_id = ?" . + " GROUP BY ase.annotation_set_id" . + " UNION ALL" . + " SELECT ase.annotation_set_id as id, ase.name as name, null as cid, 0 as count_ann" . + " FROM annotation_sets ase" . + " LEFT JOIN annotation_sets_corpora asco ON ase.annotation_set_id = asco.annotation_set_id" . + " WHERE ase.annotation_set_id IS NOT NULL" . + " GROUP BY ase.name) t" . + " GROUP BY t.name ORDER BY t.id"; $this->page->set('annotationsList', $db->fetch_rows($sql, array($corpus['id'], $corpus['id']))); } From 32ab905c309d0eb62bf7fdf9accdb6fa4136a5cb Mon Sep 17 00:00:00 2001 From: Seweryn Walentynowicz Date: Wed, 6 Jul 2022 18:01:11 +0200 Subject: [PATCH 4/4] DB struct patched for group in reports_annotations --- database/inforex-v1.0-changelog.sql | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/database/inforex-v1.0-changelog.sql b/database/inforex-v1.0-changelog.sql index 844e9dac..dd187e81 100644 --- a/database/inforex-v1.0-changelog.sql +++ b/database/inforex-v1.0-changelog.sql @@ -653,4 +653,9 @@ ALTER TABLE `reports` ADD `deleted` BOOLEAN NOT NULL DEFAULT FALSE AFTER `parent --changeset czuk:15 -UPDATE `report_perspectives` SET `id` = 'annotator_wsd' WHERE `report_perspectives`.`id` = 'annotatorwsd'; \ No newline at end of file +UPDATE `report_perspectives` SET `id` = 'annotator_wsd' WHERE `report_perspectives`.`id` = 'annotatorwsd'; + +--changeset czuk:16 + +DROP VIEW IF EXISTS `reports_annotations`; +CREATE VIEW `reports_annotations` AS select `ra`.`id` AS `id`,`ra`.`report_id` AS `report_id`,`ra`.`type_id` AS `type_id`,`at`.`name` AS `type`,`at`.`group_id` AS `group`,`ra`.`from` AS `from`,`ra`.`to` AS `to`,`ra`.`text` AS `text`,`ra`.`user_id` AS `user_id`,`ra`.`creation_time` AS `creation_time`,`ra`.`stage` AS `stage`,`ra`.`source` AS `source` from (`inforex`.`reports_annotations_optimized` `ra` left join `inforex`.`annotation_types` `at` on((`at`.`annotation_type_id` = `ra`.`type_id`)));