From c8fd8d9f8f60b20e0a3ff27c5c8cdf7a51ef48d4 Mon Sep 17 00:00:00 2001 From: Vainonen Date: Wed, 19 May 2021 18:22:10 +0300 Subject: [PATCH 1/5] vocabularyStatistics query changed --- controller/RestController.php | 5 +++++ model/sparql/GenericSparql.php | 26 ++++++++++++++++---------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/controller/RestController.php b/controller/RestController.php index 49d3fd251..9be9cde1e 100644 --- a/controller/RestController.php +++ b/controller/RestController.php @@ -292,6 +292,7 @@ public function vocabularyStatistics($request) 'class' => 'http://www.w3.org/2004/02/skos/core#Concept', 'label' => gettext('skos:Concept'), 'count' => isset($vocabStats['http://www.w3.org/2004/02/skos/core#Concept']) ? $vocabStats['http://www.w3.org/2004/02/skos/core#Concept']['count'] : 0, + 'deprecatedCount' => isset($vocabStats['http://www.w3.org/2004/02/skos/core#Concept']) ? $vocabStats['http://www.w3.org/2004/02/skos/core#Concept']['deprcount'] : 0, ), 'subTypes' => $subTypes, ); @@ -301,18 +302,22 @@ public function vocabularyStatistics($request) 'class' => 'http://www.w3.org/2004/02/skos/core#Collection', 'label' => gettext('skos:Collection'), 'count' => $vocabStats['http://www.w3.org/2004/02/skos/core#Collection']['count'], + 'deprecatedCount' => $vocabStats['http://www.w3.org/2004/02/skos/core#Collection']['deprcount'], ); + } else if (isset($vocabStats[$groupClass])) { $ret['conceptGroups'] = array( 'class' => $groupClass, 'label' => isset($vocabStats[$groupClass]['label']) ? $vocabStats[$groupClass]['label'] : gettext(EasyRdf\RdfNamespace::shorten($groupClass)), 'count' => $vocabStats[$groupClass]['count'], + 'deprecatedCount' => $vocabStats[$groupClass]['deprcount'], ); } else if (isset($vocabStats[$arrayClass])) { $ret['arrays'] = array( 'class' => $arrayClass, 'label' => isset($vocabStats[$arrayClass]['label']) ? $vocabStats[$arrayClass]['label'] : gettext(EasyRdf\RdfNamespace::shorten($arrayClass)), 'count' => $vocabStats[$arrayClass]['count'], + 'deprecatedCount' => $vocabStats[$arrayClass]['deprcount'], ); } diff --git a/model/sparql/GenericSparql.php b/model/sparql/GenericSparql.php index 561bb4c18..5c33a1f61 100644 --- a/model/sparql/GenericSparql.php +++ b/model/sparql/GenericSparql.php @@ -178,17 +178,23 @@ private function shortenUri($uri) { */ private function generateCountConceptsQuery($array, $group) { $fcl = $this->generateFromClause(); - $optional = $array ? "UNION { ?type rdfs:subClassOf* <$array> }" : ''; - $optional .= $group ? "UNION { ?type rdfs:subClassOf* <$group> }" : ''; + $optional = $array ? "(<$array>) " : ''; + $optional .= $group ? "(<$group>)" : ''; $query = << Date: Thu, 20 May 2021 16:03:51 +0300 Subject: [PATCH 2/5] deprecatedCount fixed, added translations to vocabulary statistics --- controller/RestController.php | 8 ++++---- model/sparql/GenericSparql.php | 14 ++++++++++---- resource/js/docready.js | 3 ++- .../translations/en/LC_MESSAGES/skosmos.mo | Bin 13480 -> 13558 bytes .../translations/fi/LC_MESSAGES/skosmos.mo | Bin 13760 -> 13849 bytes resource/translations/skosmos_en.po | 3 +++ resource/translations/skosmos_fi.po | 3 +++ resource/translations/skosmos_sv.po | 3 +++ .../translations/sv/LC_MESSAGES/skosmos.mo | Bin 13656 -> 13731 bytes swagger.json | 16 ++++++++++++++-- tests/VocabularyTest.php | 1 + view/scripts.twig | 1 + 12 files changed, 41 insertions(+), 11 deletions(-) diff --git a/controller/RestController.php b/controller/RestController.php index 9be9cde1e..0159d87a8 100644 --- a/controller/RestController.php +++ b/controller/RestController.php @@ -292,7 +292,7 @@ public function vocabularyStatistics($request) 'class' => 'http://www.w3.org/2004/02/skos/core#Concept', 'label' => gettext('skos:Concept'), 'count' => isset($vocabStats['http://www.w3.org/2004/02/skos/core#Concept']) ? $vocabStats['http://www.w3.org/2004/02/skos/core#Concept']['count'] : 0, - 'deprecatedCount' => isset($vocabStats['http://www.w3.org/2004/02/skos/core#Concept']) ? $vocabStats['http://www.w3.org/2004/02/skos/core#Concept']['deprcount'] : 0, + 'deprecatedCount' => isset($vocabStats['http://www.w3.org/2004/02/skos/core#Concept']) ? $vocabStats['http://www.w3.org/2004/02/skos/core#Concept']['deprecatedCount'] : 0, ), 'subTypes' => $subTypes, ); @@ -302,7 +302,7 @@ public function vocabularyStatistics($request) 'class' => 'http://www.w3.org/2004/02/skos/core#Collection', 'label' => gettext('skos:Collection'), 'count' => $vocabStats['http://www.w3.org/2004/02/skos/core#Collection']['count'], - 'deprecatedCount' => $vocabStats['http://www.w3.org/2004/02/skos/core#Collection']['deprcount'], + 'deprecatedCount' => $vocabStats['http://www.w3.org/2004/02/skos/core#Collection']['deprecatedCount'], ); } else if (isset($vocabStats[$groupClass])) { @@ -310,14 +310,14 @@ public function vocabularyStatistics($request) 'class' => $groupClass, 'label' => isset($vocabStats[$groupClass]['label']) ? $vocabStats[$groupClass]['label'] : gettext(EasyRdf\RdfNamespace::shorten($groupClass)), 'count' => $vocabStats[$groupClass]['count'], - 'deprecatedCount' => $vocabStats[$groupClass]['deprcount'], + 'deprecatedCount' => $vocabStats[$groupClass]['deprecatedCount'], ); } else if (isset($vocabStats[$arrayClass])) { $ret['arrays'] = array( 'class' => $arrayClass, 'label' => isset($vocabStats[$arrayClass]['label']) ? $vocabStats[$arrayClass]['label'] : gettext(EasyRdf\RdfNamespace::shorten($arrayClass)), 'count' => $vocabStats[$arrayClass]['count'], - 'deprecatedCount' => $vocabStats[$arrayClass]['deprcount'], + 'deprecatedCount' => $vocabStats[$arrayClass]['deprecatedCount'], ); } diff --git a/model/sparql/GenericSparql.php b/model/sparql/GenericSparql.php index 5c33a1f61..878b7b4a9 100644 --- a/model/sparql/GenericSparql.php +++ b/model/sparql/GenericSparql.php @@ -193,7 +193,7 @@ private function generateCountConceptsQuery($array, $group) { } } } GROUP BY ?type ?typelabel - EOQ; +EOQ; return $query; } @@ -209,10 +209,16 @@ private function transformCountConceptsResults($result, $lang) { if (!isset($row->type)) { continue; } - $ret[$row->type->getUri()]['type'] = $row->type->getUri(); - $ret[$row->type->getUri()]['count'] = $row->c->getValue(); + $typeURI = $row->type->getUri(); + $ret[$typeURI]['type'] = $typeURI; + + if (!isset($row->typelabel)) { + $ret[$typeURI]['count'] = $row->c->getValue(); + $ret[$typeURI]['deprecatedCount'] = $row->deprcount->getValue(); + } + if (isset($row->typelabel) && $row->typelabel->getLang() === $lang) { - $ret[$row->type->getUri()]['label'] = $row->typelabel->getValue(); + $ret[$typeURI]['label'] = $row->typelabel->getValue(); } } diff --git a/resource/js/docready.js b/resource/js/docready.js index f899d4995..1640e777b 100644 --- a/resource/js/docready.js +++ b/resource/js/docready.js @@ -203,7 +203,7 @@ $(function() { // DOCUMENT READY $.ajax({ url : rest_base_url + vocab + '/vocabularyStatistics', req_kind: $.ajaxQ.requestKind.GLOBAL, - data: $.param({'lang' : content_lang}), + data: $.param({'lang' : lang}), success : function(data) { var $spinner = $('#counts tr:nth-of-type(2)'); var typeStats = '' + data.concepts.label + '' + data.concepts.count +''; @@ -212,6 +212,7 @@ $(function() { // DOCUMENT READY var label = sub.label ? sub.label : sub.type; typeStats += ' • ' + label + '' + sub.count + ''; } + typeStats += ' • ' + depr_trans + '' + data.concepts.deprecatedCount + ''; if (data.conceptGroups) { typeStats += '' + data.conceptGroups.label + '' + data.conceptGroups.count +''; } diff --git a/resource/translations/en/LC_MESSAGES/skosmos.mo b/resource/translations/en/LC_MESSAGES/skosmos.mo index b33b1471bece9cd8c082a6da061cb4f13abd297e..1f959bb41bb113614299b2bd64ef9071dd46a092 100644 GIT binary patch delta 4492 zcmZwJ32;@_0f+IU1VTt43kDPkK_ChHo+2QNqEZVKkX72s5&~sWDWHIYuZ0#+P%Ma{ zix8GpXhFeXL4>lZ6t`9#8J)JnI4x+AGB_>mSjYDJ-aT=cws-P>zjNTxDGqv0kr2IVN<+>b|CATWWbAH^>C0y<-V zMjO0<-Y_&tW*`e)np|vw&Cn(8joxo8rW|Pn1xGXwS^lsJZ@{(4U)akBeF?8&BRqrN z@M7G*nv0o?kdFY(d!mPpFnT$46+L0D0ZL*-3h9Q?wVE1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OTXrc~O&%iMNd_q- zGl)lZN?3{0$#=*w@@;Z2=|cNqIr$a2mG~<^h}0jWDcl@SI^u(5EEyQD4MAVp`hyL1 z>G0)zk$jKbP8t%AACaGtJd!-dhg+=vSQraW;MQ0!#&yJ>r#<9h@DlQ>1NwM?$|W{|4dbp?EnA( diff --git a/resource/translations/fi/LC_MESSAGES/skosmos.mo b/resource/translations/fi/LC_MESSAGES/skosmos.mo index 0828f2e3c617246fd1ed5a5043966900a2180c87..21626c874d08ffb58968c58e4a37c28d8c8327dd 100644 GIT binary patch delta 4498 zcmZwJ2~bs40LJm7fT*A>isZ^mL=jL#z!G=Gw8(G?DO(kuhNKca7hHOjxf>cLT9%Sn znu!}OMT;P%MULs%R5rGZ<y5TRV2by-y z2(&;=O$c_u4yY;ak9yuj^s1*h6x5?4Wctl2ycNrkKXZT&+G0M&*7z;zfmiH)Q!ZvO zOc=Jp7#xYos0S6JhI}ciffcBFuSYWel+9s2G>4yH6#j&LF^CnVAsvjGiV>(APDibQ zxkww#a-4=+P#p^7X=-33YHH(9BQek(ABDPpQhUZeNdMAQ@wKn>Xh z)LO_zT~};fi+aFzWEM;v>bftHTbpb4d@EL6*c zD^U%sM)l+!)Ce}9>V0na&!ZOQ6;yq{&dzg!QP1g&A$tE4Dd+}6P&d3A)xt@>3dYPp z^>`7gUK#2JTkQFL);d(Z({}%&-TxhRzaZX0b*KxfUT+N6`#*w$DvU*qL=LJU9@G>( zZI72)w;->&*^8=o40Zjds5!laS|eAjdZpCx5LClES$m^b6^ByLP-WT^IjFgujXJ-^ zp5Kh>!G2UjkD?lK1~tb&*nNMObG`$rLGh^jq@t!M9d(~f7vrxUKEi>M{L{%tz2|9s z@h9M9)caqGTFvXMn~=_#O4JA(MJ={dsGeR%EzaLi4-V!(m>Sv(ZmW&R6Al z4s_$deW;!-LJd_Z24Ds1Mz5h(_d!&>lc)!NgG{se8TFu++^h$>Q2V1%Bm6L`VTGs; ztngCMjdx%S9>!ky6{^QU9MlDEP(v1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rls0CFq`xL%(-7vi)Hp4#nT112~J`pUsB@9g3d685uw-OrpZia+rrc zrK`~!e}mq*1N|jCh>rM+cs_ezvh-ci6)cO#lj8Ao^!pny4K3y5KJuamlvkXZ%e|Rw zAkNe>o6I9WCQlLzI}sjRyfeFfY6i7GkwwHsy`GFDJIDj1nz%V{k+;b^#Bw9Km`o); zJr>^|*KLgllv_x5@@F!N_@4NR)RO6hk_vYumGDP&@!hC<$q$L;b@E(ejg3HmcrCjU z!jfoybS{3MRFO^OYVtGUdM_g{lcw^#znN{Dj_?Pu&N_z)yz~e zd73OFzNG0Sk4zz!bqV2dypvo*Mv(832T4!*508>xkei9`#}Lv~Dydu-54zz3GMWsI z=Z2!cHcf>m^nCG2{2jT0{D@pYEO(QilPr>YmXATCsno^Fa$FzlCAgIMw*Q_yMSe<} z%C%H_kZI%vGN0@voyl7AD`II){?J(Ce;bLZa6gsF@nl7`Ci-ioAr)L@X`H7P8X=N(WLzR+6N+{*)Xtys?&i41-zZRkDYyB6pE(B%4^i z)A-5D9lZyCLJG-7@)Eg;loHEUGKnlE#iX%R^VvYklEd?#?WsAoapd;%XOo|w%Q+q& n&vnF>v3?n5lJ63KMcyPc$r}x2Icw4yj^|#G)6lAWyWIZ+9GsD< diff --git a/resource/translations/skosmos_en.po b/resource/translations/skosmos_en.po index f9be6ff2d..128526af9 100644 --- a/resource/translations/skosmos_en.po +++ b/resource/translations/skosmos_en.po @@ -851,3 +851,6 @@ msgstr "You can select a vocabulary" msgid "We're sorry but Skosmos doesn't work properly without JavaScript enabled. Please enable it to continue." msgstr "We're sorry but Skosmos doesn't work properly without JavaScript enabled. Please enable it to continue." + +msgid "Deprecated concept" +msgstr "Deprecated concept" diff --git a/resource/translations/skosmos_fi.po b/resource/translations/skosmos_fi.po index 1160cfc87..904c65df7 100644 --- a/resource/translations/skosmos_fi.po +++ b/resource/translations/skosmos_fi.po @@ -850,3 +850,6 @@ msgstr "Voit valita halutessasi sanaston" msgid "We're sorry but Skosmos doesn't work properly without JavaScript enabled. Please enable it to continue." msgstr "Pahoittelut, mutta Skosmos ei toimi kunnolla ilman JavaScript-tukea. Ole hyvä ja ota se käyttöön." + +msgid "Deprecated concept" +msgstr "Käytöstä poistettu käsite" diff --git a/resource/translations/skosmos_sv.po b/resource/translations/skosmos_sv.po index d8f5a6832..8b4284471 100644 --- a/resource/translations/skosmos_sv.po +++ b/resource/translations/skosmos_sv.po @@ -848,3 +848,6 @@ msgstr "Du kan välja en vokabulär" msgid "We're sorry but Skosmos doesn't work properly without JavaScript enabled. Please enable it to continue." msgstr "Vi beklagar, men Skosmos fungerar inte ordentligt utan JavaScript-stöd. Var god och aktivera JavaScript för att fortsätta." + +msgid "Deprecated concept" +msgstr "Raderat begrepp" diff --git a/resource/translations/sv/LC_MESSAGES/skosmos.mo b/resource/translations/sv/LC_MESSAGES/skosmos.mo index 6aa74c2f1c5fa5d130e2ffe0b6f026c0680c0f6d..c7267368aa1f85d8d5d5f72347e951b6113c6eea 100644 GIT binary patch delta 4484 zcmZwJ2~ZbR0LSsCf+U9=iY6YAh{ma?XyB13UZrV;m8K^C`FlVr0&1l6FY^k#&BzWf zQuDU(&b%|D)GoE0aw=~d$733;nI`-G{`+v8rX7F(&)c`VZ{M-I_(M*4uIFr+&tk*& z6=_7K)HEi%nlV2Gs@9lRp~ggGGN#}FtbwKIi}TPQ7vqDt9Bbh&48ubhjHfULFX96j z$U)BYm~f|HBGHcnu^52K*c3Y<*O*~g2lFumXQ0k2!-iOH>-V8L_BHa)oZ?3}zG4lg zkp}Fipda@){V3=L&)Nf{Q9XVgo8ux(#NDW#U&i`)6V-uQb)6B1qYwL$sL5-FIzJiX zF%4631gc}pu^#s~6%=$qCAPrRsHwh-378V@)DOov_DirOZbQx31yqCAP&YL7oEfNv zTAE;Nf)S`CPDS1C8T4qRE(#h^0kZt26d%Hc$Un1{ANpdx#M<}^>W0_teswNpGE682 zVGMT1HmDmFp{9HWs)Nf>=dG>J{8KhN_|Y1kz)1WZTVnuEl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2 zMP4ASiQCZ3ZwSAO&c+)_JMt`fjEo~aiQDt!7P5+zkjz%eZ!IZLb}#(qQ?hM0kee?Y u4dHUi{m8Umodel->getVocabulary('test'); $stats = $vocab->getStatistics(); $this->assertEquals(17, $stats['http://www.w3.org/2004/02/skos/core#Concept']['count']); + $this->assertEquals(0, $stats['http://www.w3.org/2004/02/skos/core#Concept']['deprecatedCount']); } /** diff --git a/view/scripts.twig b/view/scripts.twig index 6d832e43b..48884eeb2 100644 --- a/view/scripts.twig +++ b/view/scripts.twig @@ -10,6 +10,7 @@ var missing_value = "{% trans %}Value is required and can not be empty{% endtran var expand_paths = "{% trans %}show all # paths{% endtrans %}"; var expand_propvals = "{% trans %}show all # values{% endtrans %}"; var hiertrans = "{% trans "Hier-nav" %}"; +var depr_trans = "{% trans %}Deprecated concept{% endtrans %}"; var sr_only_translations = { hierarchy_listing: "{% trans "Hierarchical listing of vocabulary concepts" %}", groups_listing: "{% trans "Hierarchical listing of vocabulary concepts and groupings" %}", From 4e71757973024085fae96ac2f7e61f02126d3a7e Mon Sep 17 00:00:00 2001 From: Vainonen Date: Wed, 26 May 2021 17:53:52 +0300 Subject: [PATCH 3/5] added REST controller and vocabulary statistics tests --- controller/RestController.php | 3 +- model/Concept.php | 2 -- tests/RestControllerTest.php | 55 +++++++++++++++++++++++++++++++++++ tests/VocabularyTest.php | 4 ++- 4 files changed, 60 insertions(+), 4 deletions(-) diff --git a/controller/RestController.php b/controller/RestController.php index 0159d87a8..2b26af06b 100644 --- a/controller/RestController.php +++ b/controller/RestController.php @@ -259,7 +259,8 @@ public function vocabularyStatistics($request) $this->setLanguageProperties($request->getLang()); $arrayClass = $request->getVocab()->getConfig()->getArrayClassURI(); $groupClass = $request->getVocab()->getConfig()->getGroupClassURI(); - $vocabStats = $request->getVocab()->getStatistics($request->getQueryParam('lang'), $arrayClass, $groupClass); + $queryLang = $request->getQueryParam('lang') ?? $request->getLang(); + $vocabStats = $request->getVocab()->getStatistics($queryLang, $arrayClass, $groupClass); $types = array('http://www.w3.org/2004/02/skos/core#Concept', 'http://www.w3.org/2004/02/skos/core#Collection', $arrayClass, $groupClass); $subTypes = array(); foreach ($vocabStats as $subtype) { diff --git a/model/Concept.php b/model/Concept.php index 67c48759b..d781f9f4a 100644 --- a/model/Concept.php +++ b/model/Concept.php @@ -396,7 +396,6 @@ private function addResourceReifications($sub, $pred, $obj, &$seen) public function getMappingProperties(array $whitelist = null) { $ret = array(); - $longUris = $this->resource->propertyUris(); foreach ($longUris as &$prop) { if (EasyRdf\RdfNamespace::shorten($prop) !== null) { @@ -410,7 +409,6 @@ public function getMappingProperties(array $whitelist = null) // whitelist in use and this is not a whitelisted property, skipping continue; } - if (in_array($prop, $this->MAPPING_PROPERTIES) && !in_array($prop, $this->DELETED_PROPERTIES)) { $propres = new EasyRdf\Resource($prop, $this->graph); $proplabel = $propres->label($this->getEnvLang()) ? $propres->label($this->getEnvLang()) : $propres->label(); // current language diff --git a/tests/RestControllerTest.php b/tests/RestControllerTest.php index a8b6c698d..a6c0c8e58 100644 --- a/tests/RestControllerTest.php +++ b/tests/RestControllerTest.php @@ -422,4 +422,59 @@ public function testModifiedConcepts() { $this->assertJsonStringEqualsJsonString($changeList, $expected); } + + /** + * @covers RestController::vocabularyStatistics + */ + public function testVocabularyStatistics() { + $request = new Request($this->model); + $request->setVocab('test'); + $request->setLang('en'); + + $this->controller->vocabularyStatistics($request); + $statistics = $this->getActualOutput(); + $expected = <<assertJsonStringEqualsJsonString($statistics, $expected); + } } diff --git a/tests/VocabularyTest.php b/tests/VocabularyTest.php index 0da846ac3..80d6820a0 100644 --- a/tests/VocabularyTest.php +++ b/tests/VocabularyTest.php @@ -154,7 +154,9 @@ public function testGetStatistics() { $vocab = $this->model->getVocabulary('test'); $stats = $vocab->getStatistics(); $this->assertEquals(17, $stats['http://www.w3.org/2004/02/skos/core#Concept']['count']); - $this->assertEquals(0, $stats['http://www.w3.org/2004/02/skos/core#Concept']['deprecatedCount']); + $this->assertEquals(1, $stats['http://www.w3.org/2004/02/skos/core#Concept']['deprecatedCount']); + $this->assertEquals(13, $stats['http://www.skosmos.skos/test-meta/TestClass']['count']); + $this->assertEquals(1, $stats['http://www.skosmos.skos/test-meta/TestClass']['deprecatedCount']); } /** From 4cced0482cf3fe330d2d39d823aa44e8c429979e Mon Sep 17 00:00:00 2001 From: Vainonen Date: Mon, 31 May 2021 15:27:35 +0300 Subject: [PATCH 4/5] style fixes --- model/Concept.php | 2 ++ model/sparql/GenericSparql.php | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/model/Concept.php b/model/Concept.php index d781f9f4a..67c48759b 100644 --- a/model/Concept.php +++ b/model/Concept.php @@ -396,6 +396,7 @@ private function addResourceReifications($sub, $pred, $obj, &$seen) public function getMappingProperties(array $whitelist = null) { $ret = array(); + $longUris = $this->resource->propertyUris(); foreach ($longUris as &$prop) { if (EasyRdf\RdfNamespace::shorten($prop) !== null) { @@ -409,6 +410,7 @@ public function getMappingProperties(array $whitelist = null) // whitelist in use and this is not a whitelisted property, skipping continue; } + if (in_array($prop, $this->MAPPING_PROPERTIES) && !in_array($prop, $this->DELETED_PROPERTIES)) { $propres = new EasyRdf\Resource($prop, $this->graph); $proplabel = $propres->label($this->getEnvLang()) ? $propres->label($this->getEnvLang()) : $propres->label(); // current language diff --git a/model/sparql/GenericSparql.php b/model/sparql/GenericSparql.php index 878b7b4a9..d4cb9f72a 100644 --- a/model/sparql/GenericSparql.php +++ b/model/sparql/GenericSparql.php @@ -190,11 +190,11 @@ private function generateCountConceptsQuery($array, $group) { } } UNION {SELECT * WHERE { ?type rdfs:label ?typelabel - } } + } } GROUP BY ?type ?typelabel EOQ; - return $query; + return $query; } /** From faf465e23c8fcf0b59a2f8407f558e404937d8a1 Mon Sep 17 00:00:00 2001 From: Vainonen Date: Wed, 2 Jun 2021 11:05:35 +0300 Subject: [PATCH 5/5] added test for transforming concept counting --- model/Vocabulary.php | 2 ++ model/sparql/GenericSparql.php | 2 ++ tests/GenericSparqlTest.php | 13 +++++++++++++ 3 files changed, 17 insertions(+) diff --git a/model/Vocabulary.php b/model/Vocabulary.php index 2aaf4de7a..6f3e6ba43 100644 --- a/model/Vocabulary.php +++ b/model/Vocabulary.php @@ -304,6 +304,8 @@ private function parseVersionInfo($version) /** * Counts the statistics of the vocabulary. * @return Array containing the label counts + * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray + * @param string $group the uri of the concept group class, eg. isothes:ConceptGroup */ public function getStatistics($lang = '', $array=null, $group=null) { diff --git a/model/sparql/GenericSparql.php b/model/sparql/GenericSparql.php index d4cb9f72a..9c58a9a1d 100644 --- a/model/sparql/GenericSparql.php +++ b/model/sparql/GenericSparql.php @@ -228,6 +228,8 @@ private function transformCountConceptsResults($result, $lang) { /** * Used for counting number of concepts and collections in a vocabulary. * @param string $lang language of labels + * @param string $array the uri of the concept array class, eg. isothes:ThesaurusArray + * @param string $group the uri of the concept group class, eg. isothes:ConceptGroup * @return array with number of concepts in this vocabulary per label */ public function countConcepts($lang = null, $array = null, $group = null) { diff --git a/tests/GenericSparqlTest.php b/tests/GenericSparqlTest.php index f5497d7ff..990a42c19 100644 --- a/tests/GenericSparqlTest.php +++ b/tests/GenericSparqlTest.php @@ -46,6 +46,19 @@ public function testCountConcepts() { $this->assertEquals(17, $actual['http://www.w3.org/2004/02/skos/core#Concept']['count']); } + /** + * @covers GenericSparql::countConcepts + * @covers GenericSparql::generateCountConceptsQuery + * @covers GenericSparql::transformCountConceptsResults + */ + public function testTransformCountConceptsResults() { + $result = $this->sparql->countConcepts(); + + $this->assertEquals(13, $result['http://www.skosmos.skos/test-meta/TestClass']['count']); + $this->assertEquals(1, $result['http://www.skosmos.skos/test-meta/TestClass']['deprecatedCount']); + $this->assertEquals('http://www.skosmos.skos/test-meta/TestClass', $result['http://www.skosmos.skos/test-meta/TestClass']['type']); + } + /** * @covers GenericSparql::countLangConcepts * @covers GenericSparql::generateCountLangConceptsQuery