Output biblio and works for each excerpt

This commit is contained in:
Georgy Litvinov 2020-11-03 15:06:35 +01:00
parent 41dfe40b4f
commit 07626aec70
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 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 {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt .
?elenphExcerpt ?property ?value .
} ORDER BY ?elenphExcerpt
?elenphExcerpt ts_:htmlExcerpt ?htmlContent .
?elenphExcerpt rdfs:label ?htmlLabel .
OPTIONAL{ ?elenphExcerpt ts_:works ?excerptWorks . }
OPTIONAL{ ?elenphExcerpt ts_:bibliography ?excerptBibliography . }
} GROUP BY ?elenphExcerpt ?htmlLabel ?htmlContent ORDER BY ?elenphExcerpt
""" .
display:getArticleExcerptPathsDataGetter
@ -72,7 +75,7 @@ display:getArticleBibliographyDataGetter
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?bibliography
SELECT DISTINCT ?bibliography ?elenphExcerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?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 ts_: <https://litvinovg.pro/text_structures#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT ?works
SELECT DISTINCT ?works ?elenphExcerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?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">
<#-- ${order.path} -->
<#list excerpts as excerptProperties>
<#if order.elenphExcerpt?has_content && excerptProperties.elenphExcerpt == order.elenphExcerpt>
<#if excerptProperties.property == "https://litvinovg.pro/text_structures#htmlExcerpt">
<#assign excerptText = excerptProperties.value >
</#if>
<#if excerptProperties.property == "http://www.w3.org/2000/01/rdf-schema#label">
<#assign excerptTextName = excerptProperties.value >
</#if>
<#assign excerptText = excerptProperties.htmlContent >
<#assign excerptTextName = excerptProperties.htmlLabel >
<#assign worksCounter = excerptProperties.worksCounter >
<#assign bibliographyCounter = excerptProperties.bibliographyCounter >
</#if>
</#list>
<#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>
<div class="htmlExcerpt" style="list-style:none; display:none;">
${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>
</#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>
</div> <#-- articleExcerpt -->
</#list>
</div>
<#-- <@dump var="works" /> -->
<#if works??>
<#assign no_works = true>
<#list works as work>
<#if no_works>
<#if works?? && works?has_content>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%;text-align:left;">Работы</button>
<div class="works" style="display:none;">
<#assign no_works = false>
</#if>
<#list works as work>
<div class="work" style="list-style:none;">
<p> ${work.works} </p>
</div>
</#list>
<#if !no_works>
</div> <#-- works class-->
</#if>
</div>
</#if>
<#if bibliography??>
<#assign no_bibliography = true>
<#list bibliography as one_bibliography>
<#if no_bibliography>
<#if bibliography?? && bibliography?has_content>
<button type="button" class="collapsible" style="border:none;padding: 18px;width: 100%; text-align: left;">Литература</button>
<div class="bibliography" style="display:none;">
<#assign no_bibliography = false>
</#if>
<#list bibliography as one_bibliography>
<div class="bibliography_entry" style="list-style:none;">
<p> ${one_bibliography.bibliography} </p>
</div>
</#list>
<#if !no_bibliography>
</div> <#-- bibliography class-->
</#if>
</div>
</#if>
<#if authors??>