Skip to content

Commit

Permalink
ajout information sur les éditions dans les occurences des index #737
Browse files Browse the repository at this point in the history
  • Loading branch information
emchateau committed Jul 28, 2020
1 parent 2eec87c commit 7577614
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
17 changes: 10 additions & 7 deletions models/tei.xqm
Expand Up @@ -229,7 +229,7 @@ declare function getCorpusById($queryParams as map(*)) as map(*) {
'title' : getTitles($text, $lang), (: @todo sequence or main and sub :)
'date' : getEditionDates(getOtherEditions(getRef($text))/tei:biblStruct, $dateFormat),
'author' : getAuthors($text, $lang),
'biblio' : getRef($text), (: todo check the serialization :)
'biblio' : getRef($text),
'abstract' : getAbstract($text, $lang),
'format' : getRef($text)//tei:dim[@type = 'format'],
'itemsNb' : fn:count($text//tei:*[@type = 'item' or @type = 'section']), (: todo value and unit :)
Expand Down Expand Up @@ -1209,7 +1209,8 @@ declare function getIndexLocorumItem($queryParams as map(*)) as map(*) {
let $lang := 'fr'
let $dateFormat := 'jjmmaaa'
let $itemId := map:get($queryParams, 'itemId')
let $entry := synopsx.models.synopsx:getDb($queryParams)//tei:place[@xml:id = $itemId]
let $db := synopsx.models.synopsx:getDb($queryParams)
let $entry := $db//tei:place[@xml:id = $itemId]
let $meta := map{
'rubrique' : 'Entrée de l’index de lieux',
'author' : 'Guides de Paris',
Expand All @@ -1234,7 +1235,7 @@ declare function getIndexLocorumItem($queryParams as map(*)) as map(*) {
'uuid' : fn:string($uuid),
'path' : '/indexLocorum/',
'url' : $gdp.globals:root || '/indexLocorum/' || $uuid,
'occurences' : array{ getOccurences($entry) }
'occurences' : array{ getOccurences($entry, map{'db' : $db}) }
}
return map{
'meta' : $meta,
Expand Down Expand Up @@ -1302,7 +1303,8 @@ declare function getIndexNominumItem($queryParams as map(*)) as map(*) {
let $lang := 'fr'
let $dateFormat := 'jjmmaaa'
let $itemId := map:get($queryParams, 'itemId')
let $entry := synopsx.models.synopsx:getDb($queryParams)//tei:listPerson/tei:person[@xml:id = $itemId]
let $db := synopsx.models.synopsx:getDb($queryParams)
let $entry := $db//tei:listPerson/tei:person[@xml:id = $itemId]
let $meta := map{
'rubrique' : 'Entrée d’index des personnes',
'author' : 'Guides de Paris',
Expand Down Expand Up @@ -1332,7 +1334,7 @@ declare function getIndexNominumItem($queryParams as map(*)) as map(*) {
'path' : '/indexNominum/',
'url' : $gdp.globals:root || '/indexNominum/' || $uuid,
'attestedForms' : array{ getAttestedForms($entry, map{'element' : 'person'}) },
'occurences' : array{ getOccurences($entry) }
'occurences' : array{ getOccurences($entry, map{'db' : $db}) }
}
return map{
'meta' : $meta,
Expand Down Expand Up @@ -1396,7 +1398,8 @@ declare function getIndexOperumItem($queryParams as map(*)) as map(*) {
let $lang := 'fr'
let $dateFormat := 'jjmmaaa'
let $itemId := map:get($queryParams, 'itemId')
let $entry := synopsx.models.synopsx:getDb($queryParams)//tei:object[@xml:id = $itemId]
let $db := synopsx.models.synopsx:getDb($queryParams)
let $entry := $db//tei:object[@xml:id = $itemId]
let $occurences := $entry/tei:relation[@type="locus"]
let $meta := map{
'rubrique' : 'Entrée de l’index des œuvres',
Expand Down Expand Up @@ -1436,7 +1439,7 @@ declare function getIndexOperumItem($queryParams as map(*)) as map(*) {
'uuid' : fn:string($uuid),
'path' : '/items/',
'url' : $gdp.globals:root || '/items/' || $uuid,
'occurences' : array{ getOccurences($entry) }
'occurences' : array{ getOccurences($entry, map{'db' : $db}) }
}
return map{
'meta' : $meta,
Expand Down
4 changes: 3 additions & 1 deletion models/teiBuilder.xqm
Expand Up @@ -541,12 +541,14 @@ declare function getOccurences($entry as element()) as map(*)* {
:
: @param $occurences refs
: @return a sequence of maps containing all the index entries for each text
: @todo optimize by supressing getRef
:)
declare function getOccurences($entry as element()) as map(*)* {
declare function getOccurences($entry as element(), $options as map(*)) as map(*)* {
for $item in $entry/tei:listRelation/tei:relation
group by $texts := $item/@type
return map{
'item' : fn:normalize-space($texts),
'biblio' : getRef($options?db//tei:TEI[tei:teiHeader//tei:sourceDesc[@xml:id = $texts]]),
'occurences' : array{
let $ids := $item/@passive ! fn:tokenize(., ' ') ! fn:substring-after(., '#')
let $lookup :=
Expand Down

0 comments on commit 7577614

Please sign in to comment.