Output biblio and works for each excerpt

This commit is contained in:
Georgy Litvinov 2020-11-03 15:06:35 +01:00
parent 6196cbc8b3
commit 1ac49647a3
2 changed files with 57 additions and 46 deletions

View file

@ -26,12 +26,15 @@ display:getArticleExcerptsContentDataGetter
""" """
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#> PREFIX ts_: <https://litvinovg.pro/text_structures#>
SELECT ?elenphExcerpt ?property ?value SELECT ?elenphExcerpt ?htmlLabel ?htmlContent (COUNT (distinct ?excerptWorks) as ?worksCounter) (COUNT (distinct ?excerptBibliography) as ?bibliographyCounter)
WHERE { WHERE {
?individualURI ts_:hasTOC ?toc . ?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
?elenphExcerpt ?property ?value . ?elenphExcerpt ts_:htmlExcerpt ?htmlContent .
} ORDER BY ?elenphExcerpt ?elenphExcerpt rdfs:label ?htmlLabel .
OPTIONAL{ ?elenphExcerpt ts_:works ?excerptWorks . }
OPTIONAL{ ?elenphExcerpt ts_:bibliography ?excerptBibliography . }
} GROUP BY ?elenphExcerpt ?htmlLabel ?htmlContent ORDER BY ?elenphExcerpt
""" . """ .
display:getArticleExcerptPathsDataGetter display:getArticleExcerptPathsDataGetter
@ -72,7 +75,7 @@ display:getArticleBibliographyDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#> PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?bibliography SELECT DISTINCT ?bibliography ?elenphExcerpt
WHERE { WHERE {
?individualURI ts_:hasTOC ?toc . ?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
@ -88,7 +91,7 @@ display:getArticleWorksDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#> PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?works SELECT DISTINCT ?works ?elenphExcerpt
WHERE { WHERE {
?individualURI ts_:hasTOC ?toc . ?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .

View file

@ -127,62 +127,70 @@ ${scripts.add('<script async type="text/javascript" src="//cdn.plu.mx/widget-pop
<div class = "articleExcerpt"> <div class = "articleExcerpt">
<#-- ${order.path} --> <#-- ${order.path} -->
<#list excerpts as excerptProperties> <#list excerpts as excerptProperties>
<#if order.elenphExcerpt?has_content && excerptProperties.elenphExcerpt == order.elenphExcerpt> <#if order.elenphExcerpt?has_content && excerptProperties.elenphExcerpt == order.elenphExcerpt>
<#if excerptProperties.property == "https://litvinovg.pro/text_structures#htmlExcerpt"> <#assign excerptText = excerptProperties.htmlContent >
<#assign excerptText = excerptProperties.value > <#assign excerptTextName = excerptProperties.htmlLabel >
</#if> <#assign worksCounter = excerptProperties.worksCounter >
<#if excerptProperties.property == "http://www.w3.org/2000/01/rdf-schema#label"> <#assign bibliographyCounter = excerptProperties.bibliographyCounter >
<#assign excerptTextName = excerptProperties.value >
</#if>
</#if> </#if>
</#list> </#list>
<#if excerptText?? && excerptTextName?? && excerptTextName?has_content && excerptText?has_content> <#if excerptText?? && excerptTextName?? && excerptTextName?has_content && excerptText?has_content>
<button type="button" style="border:none;padding: 18px;width: 100%; text-align:left;" class="collapsible">${excerptTextName}</button> <button type="button" style="border:none;padding: 18px;width: 100%; text-align:left;" class="collapsible">${excerptTextName}</button>
<div class="htmlExcerpt" style="list-style:none; display:none;"> <div class="htmlExcerpt" style="list-style:none; display:none;">
${excerptText} ${excerptText}
<#if works?? && works?has_content && worksCounter?number &gt; 0 >
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Работы</button>
<div class="works" style="display:none;">
<#list works as work>
<#if work.elenphExcerpt == order.elenphExcerpt >
<div class="work" style="list-style:none;">
<p> ${work.works} </p>
</div> </div>
</#if>
</#list>
</div>
</#if>
<#if bibliography?? && bibliography?has_content && bibliographyCounter?number &gt; 0>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%; text-align: left;">Литература</button>
<div class="bibliography" style="display:none;">
<#list bibliography as one_bibliography>
<#if one_bibliography.elenphExcerpt == order.elenphExcerpt >
<div class="bibliography_entry" style="list-style:none;">
<p> ${one_bibliography.bibliography} </p>
</div>
</#if>
</#list>
</div>
</#if>
</div>
</#if> </#if>
</div> <#-- articleExcerpt --> </div> <#-- articleExcerpt -->
</#list> </#list>
</div> </div>
<#-- <@dump var="works" /> -->
<#if works??> <#if works?? && works?has_content>
<#assign no_works = true>
<#list works as work>
<#if no_works>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Работы</button> <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Работы</button>
<div class="works" style="display:none;"> <div class="works" style="display:none;">
<#assign no_works = false> <#list works as work>
</#if>
<div class="work" style="list-style:none;"> <div class="work" style="list-style:none;">
<p> ${work.works} </p> <p> ${work.works} </p>
</div> </div>
</#list> </#list>
<#if !no_works> </div>
</div> <#-- works class-->
</#if>
</#if> </#if>
<#if bibliography??> <#if bibliography?? && bibliography?has_content>
<#assign no_bibliography = true>
<#list bibliography as one_bibliography>
<#if no_bibliography>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%; text-align: left;">Литература</button> <button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%; text-align: left;">Литература</button>
<div class="bibliography" style="display:none;"> <div class="bibliography" style="display:none;">
<#assign no_bibliography = false> <#list bibliography as one_bibliography>
</#if>
<div class="bibliography_entry" style="list-style:none;"> <div class="bibliography_entry" style="list-style:none;">
<p> ${one_bibliography.bibliography} </p> <p> ${one_bibliography.bibliography} </p>
</div> </div>
</#list> </#list>
<#if !no_bibliography> </div>
</div> <#-- bibliography class-->
</#if>
</#if> </#if>
<#if authors??> <#if authors??>