Get level of excerpts in document

This commit is contained in:
Georgy Litvinov 2021-03-03 17:25:29 +01:00
parent c8496ffe2f
commit 5f6cff9824
2 changed files with 16 additions and 17 deletions

View file

@ -42,11 +42,11 @@ display:getCompilationExcerptPathsDataGetter
display:saveToVar "paths";
display:query
"""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) ?tocElement ?elenphExcerpt
WHERE {
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) (COUNT(?outline) AS ?level) ?tocElement ?elenphExcerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc ts_:hasTOCItem/(ts_:pointsTo/ts_:hasTOCItem)* ?tmpTOCItem .
?tmpTOCItem rdf:type ts_:TOCItem .
@ -56,10 +56,10 @@ display:getCompilationExcerptPathsDataGetter
?tocElement ts_:hasText ?elenphExcerpt .
}
{
SELECT ?tocElement
SELECT ?tocElement
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement .
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement .
?tocElement rdf:type ts_:TOCLevel .
}
}

View file

@ -42,11 +42,11 @@ display:getArticleExcerptPathsDataGetter
display:saveToVar "paths";
display:query
"""
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) ?tocElement ?elenphExcerpt
WHERE {
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX ts_: <https://litvinovg.pro/text_structures#>
SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) (COUNT(?outline) AS ?level) ?tocElement ?elenphExcerpt
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc ts_:hasTOCItem/(ts_:pointsTo/ts_:hasTOCItem)* ?tmpTOCItem .
?tmpTOCItem rdf:type ts_:TOCItem .
@ -56,12 +56,11 @@ display:getArticleExcerptPathsDataGetter
?tocElement ts_:hasText ?elenphExcerpt .
}
{
SELECT ?elenphArticle ?tocElement
SELECT ?elenphArticle ?tocElement
WHERE {
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement .
?individualURI ts_:hasTOC ?toc .
?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement .
?tocElement rdf:type ts_:TOCLevel .
?individualURI rdf:type ts_:elenphArticle .
}
}
} GROUP BY ?tocElement ?elenphExcerpt ORDER BY ?path