diff --git a/app/modules/app.xqm b/app/modules/app.xqm index b3a9d60..b9e1e3b 100644 --- a/app/modules/app.xqm +++ b/app/modules/app.xqm @@ -6,7 +6,7 @@ module namespace app="http://localhost/app"; declare namespace tei="http://www.tei-c.org/ns/1.0"; declare default collation "?lang=es"; declare variable $app:root := "/db/apps/bibacme"; -declare variable $app:home := "/exist/apps/bibacme/"; (: end with slash :) +declare variable $app:home := "/"; (: end with slash :) declare variable $app:works := doc(concat($app:root, "/data/works.xml"))//tei:listBibl/tei:bibl; declare variable $app:authors := doc(concat($app:root, "/data/authors.xml"))//tei:person; declare variable $app:editions := doc(concat($app:root, "/data/editions.xml"))//tei:listBibl/tei:biblStruct; @@ -532,14 +532,14 @@ declare function app:autores-por-nacionalidad(){ (

Sinopsis

, (: number of authors per country :) let $data := map { - "x" := data:get-nationalities(), - "y" := data:get-nationality-numbers() + "x" : data:get-nationalities(), + "y" : data:get-nationality-numbers() } let $params := map { - "title" := "Autores por nacionalidad / origen", - "containerId" := "ChartAutores_1", - "xaxis-title" := "nacionalidad / origen", - "yaxis-title" := "número de autores" + "title" : "Autores por nacionalidad / origen", + "containerId" : "ChartAutores_1", + "xaxis-title" : "nacionalidad / origen", + "yaxis-title" : "número de autores" } return (
, @@ -551,12 +551,12 @@ declare function app:autores-por-sexo(){ (

Sinopsis

, (: number of authors by sex :) let $data := map { - "labels" := data:get-sexes(), - "values" := data:get-sex-numbers() + "labels" : data:get-sexes(), + "values" : data:get-sex-numbers() } let $params := map { - "title" := "Autores por sexo", - "containerId" := "ChartAutores_2" + "title" : "Autores por sexo", + "containerId" : "ChartAutores_2" } return (
, @@ -574,15 +574,15 @@ declare function app:obras-por-ano(){ let $num-editions := for $year in (1830 to 1910) return count($first-ed-years[xs:integer(.) = $year]) let $params := map { - "title" := "Obras por año", - "containerId" := "ChartObras_5", - "xaxis-title" := "año", - "yaxis-title" := "número de obras", - "y_range" := 40 + "title" : "Obras por año", + "containerId" : "ChartObras_5", + "xaxis-title" : "año", + "yaxis-title" : "número de obras", + "y_range" : 40 } let $data := map { - "x" := (1830 to 1910), - "y" := $num-editions + "x" : (1830 to 1910), + "y" : $num-editions } return (
, @@ -597,16 +597,16 @@ declare function app:obras-por-ano(){ let $num-editions := for $year in (1830 to 1910) return count($first-ed-years[xs:integer(.) = $year]) let $params := map { - "title" := "Obras por año (escritas por autores de nacionalidad argentina)", - "containerId" := "ChartObras_6", - "xaxis-title" := "año", - "yaxis-title" := "número de obras", - "color" := "light blue", - "y_range" := 40 + "title" : "Obras por año (escritas por autores de nacionalidad argentina)", + "containerId" : "ChartObras_6", + "xaxis-title" : "año", + "yaxis-title" : "número de obras", + "color" : "light blue", + "y_range" : 40 } let $data := map { - "x" := (1830 to 1910), - "y" := $num-editions + "x" : (1830 to 1910), + "y" : $num-editions } return (
, @@ -621,16 +621,16 @@ declare function app:obras-por-ano(){ let $num-editions := for $year in (1830 to 1910) return count($first-ed-years[xs:integer(.) = $year]) let $params := map { - "title" := "Obras por año (escritas por autores originarios de Cuba)", - "containerId" := "ChartObras_7", - "xaxis-title" := "año", - "yaxis-title" := "número de obras", - "color" := "#CC0000", - "y_range" := 40 + "title" : "Obras por año (escritas por autores originarios de Cuba)", + "containerId" : "ChartObras_7", + "xaxis-title" : "año", + "yaxis-title" : "número de obras", + "color" : "#CC0000", + "y_range" : 40 } let $data := map { - "x" := (1830 to 1910), - "y" := $num-editions + "x" : (1830 to 1910), + "y" : $num-editions } return (
, @@ -645,16 +645,16 @@ declare function app:obras-por-ano(){ let $num-editions := for $year in (1830 to 1910) return count($first-ed-years[xs:integer(.) = $year]) let $params := map { - "title" := "Obras por año (escritas por autores de nacionalidad mexicana)", - "containerId" := "ChartObras_8", - "xaxis-title" := "año", - "yaxis-title" := "número de obras", - "color" := "#006633", - "y_range" := 40 + "title" : "Obras por año (escritas por autores de nacionalidad mexicana)", + "containerId" : "ChartObras_8", + "xaxis-title" : "año", + "yaxis-title" : "número de obras", + "color" : "#006633", + "y_range" : 40 } let $data := map { - "x" := (1830 to 1910), - "y" := $num-editions + "x" : (1830 to 1910), + "y" : $num-editions } return (
, @@ -670,14 +670,14 @@ declare function app:obras-por-autor(){ let $map := data:get-work-numbers-by-author() let $values := app:get-map-values($map) let $data := map { - "x" := $values + "x" : $values } let $params := map { - "title" := "Obras por autor", - "containerId" := "ChartObras_4", - "xaxis-title" := "número de obras", - "yaxis-title" := "número de autores", - "legend-name" := "autores" + "title" : "Obras por autor", + "containerId" : "ChartObras_4", + "xaxis-title" : "número de obras", + "yaxis-title" : "número de autores", + "legend-name" : "autores" } return (
, @@ -692,14 +692,14 @@ declare function app:obras-por-nacionalidad-de-autor(){ let $keys := app:get-map-keys($map) let $values := app:get-map-values($map) let $data := map { - "x" := $keys, - "y" := $values + "x" : $keys, + "y" : $values } let $params := map { - "title" := "Obras por nacionalidad / origen de autor", - "containerId" := "ChartObras_1", - "xaxis-title" := "nacionalidad / origen de autor", - "yaxis-title" := "número de obras" + "title" : "Obras por nacionalidad / origen de autor", + "containerId" : "ChartObras_1", + "xaxis-title" : "nacionalidad / origen de autor", + "yaxis-title" : "número de obras" } return (
, @@ -714,14 +714,14 @@ declare function app:obras-por-pais-de-primera-edicion(){ let $keys := app:get-map-keys($map) let $values := app:get-map-values($map) let $data := map { - "x" := $keys, - "y" := $values + "x" : $keys, + "y" : $values } let $params := map { - "title" := "Obras por país de primera edición", - "containerId" := "ChartObras_2", - "xaxis-title" := "país del lugar de publicación", - "yaxis-title" := "número de obras" + "title" : "Obras por país de primera edición", + "containerId" : "ChartObras_2", + "xaxis-title" : "país del lugar de publicación", + "yaxis-title" : "número de obras" } return (
, @@ -739,14 +739,14 @@ declare function app:obras-por-decada(){ let $num-editions := for $dec in $app:decades return count($first-ed-decs[. = $dec]) let $params := map { - "title" := "Obras por década", - "containerId" := "ChartObras_3", - "xaxis-title" := "década", - "yaxis-title" := "número de obras" + "title" : "Obras por década", + "containerId" : "ChartObras_3", + "xaxis-title" : "década", + "yaxis-title" : "número de obras" } let $data := map { - "x" := $app:decade-labels, - "y" := $num-editions + "x" : $app:decade-labels, + "y" : $num-editions } return (
, @@ -765,14 +765,14 @@ declare function app:ediciones-por-decada(){ let $num-editions := for $dec in $app:decades return count($ed-decs[. = $dec]) let $params := map { - "title" := "Ediciones por década", - "containerId" := "ChartEdiciones_1", - "xaxis-title" := "década", - "yaxis-title" := "número de ediciones" + "title" : "Ediciones por década", + "containerId" : "ChartEdiciones_1", + "xaxis-title" : "década", + "yaxis-title" : "número de ediciones" } let $data := map { - "x" := $app:decade-labels, - "y" := $num-editions + "x" : $app:decade-labels, + "y" : $num-editions } return (
, @@ -788,14 +788,14 @@ declare function app:ediciones-por-obra(){ let $work-id := $work/@xml:id return count($app:editions//range:field-eq("work-key", $work-id)) let $params := map { - "title" := "Ediciones por obra", - "containerId" := "ChartEdiciones_2", - "xaxis-title" := "número de ediciones", - "yaxis-title" := "número de obras", - "legend-name" := "obras" + "title" : "Ediciones por obra", + "containerId" : "ChartEdiciones_2", + "xaxis-title" : "número de ediciones", + "yaxis-title" : "número de obras", + "legend-name" : "obras" } let $data := map { - "x" := $num-editions + "x" : $num-editions } return (
, diff --git a/app/modules/data.xqm b/app/modules/data.xqm index 89adbbf..fb2012d 100644 --- a/app/modules/data.xqm +++ b/app/modules/data.xqm @@ -153,7 +153,7 @@ declare function data:get-sex-numbers() as xs:integer+{ declare function data:get-work-numbers-by-nationality() as map(xs:string, xs:integer){ (: fetch the number of works by the author's nationality :) - map:new( + map:merge( for $nat in distinct-values($app:authors//tei:nationality) let $author-ids := $app:authors[tei:nationality = $nat]/@xml:id let $count := count($app:works[tei:author/@key = $author-ids]) @@ -163,7 +163,7 @@ declare function data:get-work-numbers-by-nationality() as map(xs:string, xs:int declare function data:get-work-numbers-by-pubPlace-first() as map(xs:string, xs:integer) { (: fetch the number of works by the publication place (country) of the first edition :) - let $work-map := map:new( + let $work-map := map:merge( for $work in $app:works let $work-id := $work/@xml:id let $editions := data:get-work-editions($work-id) @@ -182,7 +182,7 @@ declare function data:get-work-numbers-by-pubPlace-first() as map(xs:string, xs: let $place := $app:countries[@xml:id = $ed-first-place]/tei:placeName return map:entry($work-id, $place) ) - let $place-map := map:new( + let $place-map := map:merge( let $values := for $key in map:keys($work-map) let $value := map:get($work-map, $key) return $value @@ -223,7 +223,7 @@ declare function data:get-first-letter($name as xs:string) as xs:string{ declare function data:get-work-numbers-by-author() as map(xs:string, xs:integer){ - map:new( + map:merge( for $author in $app:authors let $author-id := $author/@xml:id let $author-works := $app:works//range:field-eq("author-key", $author-id)