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
-
... ... @@ -17,10 +17,10 @@ 17 17 and doc.fullName like :fullNamePrefix 18 18 order by doc.fullName") 19 19 20 -#set($element Rows= $services.query.hql($hqlElements)21 - .bindValue('rootDocFullName', $rootDocFullName) 22 - .bindValue('fullNamePrefix', $fullNamePrefix) 23 - .execute()) 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 24 25 25 ## --------------------------- 26 26 ## 2. Получаем термины глоссария ... ... @@ -46,7 +46,7 @@ 46 46 #set($glossaryTitle = "$!row[1]") 47 47 48 48 #if("$!glossaryTitle" != "") 49 - #set($normalizedGlossaryTitle = $stringtool.lowerCase($glossaryTitle).replaceAll("\ \s+", ""))49 + #set($normalizedGlossaryTitle = $stringtool.lowerCase($glossaryTitle).replaceAll("\s+", "")) 50 50 51 51 #if("$!normalizedGlossaryTitle" != "") 52 52 #set($discard = $glossaryMap.put($normalizedGlossaryTitle, { ... ... @@ -58,10 +58,10 @@ 58 58 #end 59 59 60 60 ## ---------------------------- 61 -## 4. Ищем совпадения 61 +## 4. Ищем совпадения и записываем rdfs.seeAlso 62 62 ## ---------------------------- 63 63 #set($matches = []) 64 -#set($ totalCount =$elementRows.size())64 +#set($updatedCount = 0) 65 65 66 66 #foreach($row in $elementRows) 67 67 #set($elementFullName = $row[0]) ... ... @@ -68,11 +68,22 @@ 68 68 #set($elementTitle = "$!row[1]") 69 69 70 70 #if("$!elementTitle" != "") 71 - #set($normalizedElementTitle = $stringtool.lowerCase($elementTitle).replaceAll("\ \s+", ""))71 + #set($normalizedElementTitle = $stringtool.lowerCase($elementTitle).replaceAll("\s+", "")) 72 72 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 + 76 76 #set($matchRow = { 77 77 "elementFullName" : $elementFullName, 78 78 "elementTitle" : $elementTitle, ... ... @@ -86,23 +86,19 @@ 86 86 #end 87 87 88 88 ## --------------------------- 89 -## 5. Выводим та блицу совпадений100 +## 5. Выводим результат 90 90 ## ---------------------------- 91 91 {{html clean="false" wiki="true"}} 103 +<p><strong>Updated:</strong> $updatedCount</p> 104 + 92 92 <table class="wikitable" border="1"> 93 93 <thead> 94 94 <tr> 95 95 <th>Ontology elements</th> 96 - <th> Glossaryterms</th>109 + <th>Written to rdfs.seeAlso</th> 97 97 </tr> 98 98 </thead> 99 99 <tbody> 100 - <tr> 101 - <th colspan="2" style="text-align: center;"> 102 - Matches ($matches.size() of $totalCount) 103 - </th> 104 - </tr> 105 - 106 106 #if($matches.size() > 0) 107 107 #foreach($match in $matches) 108 108 <tr>