Changes for page Intersection table of ML Elements with glossary terms
Last modified by Artur K. on 2026/06/01 15:50
Summary
-
Page properties (1 modified, 0 added, 0 removed)
Details
- Page properties
-
- Content
-
... ... @@ -1,8 +1,7 @@ 1 -{{velocity}} 1 +{{velocity output="false"}} 2 2 #set($rootDocFullName = $doc.getParent()) 3 3 #set($rootDoc = $xwiki.getDocument($rootDocFullName)) 4 4 #set($fullNamePrefix = "${rootDoc.space}.%") 5 - 6 6 ## ---------------------------- 7 7 ## 1. Получаем Ontology Elements 8 8 ## ---------------------------- ... ... @@ -16,12 +16,7 @@ 16 16 and doc.fullName <> :rootDocFullName 17 17 and doc.fullName like :fullNamePrefix 18 18 order by doc.fullName") 19 - 20 -#set($elementQuery = $services.query.hql($hqlElements)) 21 -#set($discard = $elementQuery.bindValue('rootDocFullName', $rootDocFullName)) 22 -#set($discard = $elementQuery.bindValue('fullNamePrefix', $fullNamePrefix)) 23 -#set($elementRows = $elementQuery.execute()) 24 - 18 +#set($elementRows = $services.query.hql($hqlElements).bindValue('rootDocFullName', $rootDocFullName).bindValue('fullNamePrefix', $fullNamePrefix).execute()) 25 25 ## --------------------------- 26 26 ## 2. Получаем термины глоссария 27 27 ## ---------------------------- ... ... @@ -35,12 +35,10 @@ 35 35 order by doc.fullName") 36 36 37 37 #set($glossaryRows = $services.query.hql($hqlGlossary).execute()) 38 - 39 39 ## --------------------------- 40 40 ## 3. Строим map глоссария по нормализованному title 41 41 ## ---------------------------- 42 42 #set($glossaryMap = {}) 43 - 44 44 #foreach($row in $glossaryRows) 45 45 #set($glossaryFullName = $row[0]) 46 46 #set($glossaryTitle = "$!row[1]") ... ... @@ -56,12 +56,11 @@ 56 56 #end 57 57 #end 58 58 #end 59 - 60 60 ## ---------------------------- 61 -## 4. Ищем совпадения и записываем rdfs.seeAlso52 +## 4. Ищем совпадения 62 62 ## ---------------------------- 63 63 #set($matches = []) 64 -#set($ updatedCount =0)55 +#set($totalCount = $elementRows.size()) 65 65 66 66 #foreach($row in $elementRows) 67 67 #set($elementFullName = $row[0]) ... ... @@ -73,17 +73,6 @@ 73 73 #if($glossaryMap.containsKey($normalizedElementTitle)) 74 74 #set($glossaryData = $glossaryMap.get($normalizedElementTitle)) 75 75 76 - #set($rdoc = $xwiki.getDocument($elementFullName)) 77 - #set($elementObj = $rdoc.getObject('SKMS.Ontology.Code.OntologyElementClass')) 78 - 79 - #set($seeAlsoValue = []) 80 - #set($discard = $seeAlsoValue.add($glossaryData.fullName)) 81 - 82 - #set($discard = $elementObj.set('rdfs.seeAlso', $seeAlsoValue)) 83 - #set($discard = $rdoc.save()) 84 - 85 - #set($updatedCount = $updatedCount + 1) 86 - 87 87 #set($matchRow = { 88 88 "elementFullName" : $elementFullName, 89 89 "elementTitle" : $elementTitle, ... ... @@ -95,21 +95,25 @@ 95 95 #end 96 96 #end 97 97 #end 98 - 78 +{{/velocity}}{{velocity output="true"}} 99 99 ## --------------------------- 100 -## 5. Выводим результат80 +## 5. Выводим таблицу совпадений 101 101 ## ---------------------------- 102 102 {{html clean="false" wiki="true"}} 103 -<p><strong>Updated:</strong> $updatedCount</p> 104 - 105 105 <table class="wikitable" border="1"> 106 106 <thead> 107 107 <tr> 108 108 <th>Ontology elements</th> 109 - <th> Writtentordfs.seeAlso</th>87 + <th>Glossary terms</th> 110 110 </tr> 111 111 </thead> 112 112 <tbody> 91 + <tr> 92 + <th colspan="2" style="text-align: center;"> 93 + Matches ($matches.size() of $totalCount) 94 + </th> 95 + </tr> 96 + 113 113 #if($matches.size() > 0) 114 114 #foreach($match in $matches) 115 115 <tr>