diff --git a/app/modules/RDF_gen.xql b/app/modules/RDF_gen.xql index 4a0905d9..b0e12a01 100644 --- a/app/modules/RDF_gen.xql +++ b/app/modules/RDF_gen.xql @@ -15,7 +15,8 @@ let $header := concat( "@prefix rdfs: . ", "@prefix wd: . ", "@prefix viaf: . ", - "@prefix gnd: ;", + "@prefix gnd: . ", + "@prefix owl: . ", " " ) @@ -25,53 +26,53 @@ return ( let $person_id := $person/@xml:id let $main_name := $person/tei:persName[@type='main']/data(.) let $gender := $person/tei:sex/data(.) - let $labels := $person/tei:persName[not(@type='main')]/data(.) + let $names := $person/tei:persName[not(@type='main')]/data(.) + let $identifiers := $person/tei:idno + let $has_identifiers := exists($identifiers) + let $has_gender := exists($gender) + let $has_names := exists($names) + let $last_element := if ($has_names) then 'name' else if ($has_gender) then 'gender' else 'identifier' return ( - concat('pdperson:',$person_id, ' a crm:E21_Person ;', ' '), - concat($tab,'rdfs:label "', $main_name,'" ;',' '), - for $viaf_id in $person/tei:idno[@type='viaf'] - return if ($viaf_id) then concat($tab,'= ', 'viaf:',$viaf_id, ' ;',' ') else (), - for $gnd_id in $person/tei:idno[@type='gnd'] - return if ($gnd_id) then concat($tab,'= ', 'gnd:',$gnd_id,' ;',' ') else (), - for $wikidata_id in $person/tei:idno[@type='wikidata'] - return if ($wikidata_id) then concat($tab,'= ','wd:',$wikidata_id, ' ;',' ') else (), - concat($tab, 'foaf:gender "', $gender, '" ;',' '), - if (exists($labels)) then concat($tab, 'foaf:name ') else (), - ( - for $label at $i in $labels - return if ($label) then - if ($i = count($labels)) - then concat('"',$label,'"; ') - else concat('"',$label,'", ') - else () - ), - ' ') - ), - (for $periodical in $doc//tei:list[@type='periodical']/tei:item + concat('pdperson:',$person_id, ' a crm:E21_Person ;', ' '), + concat($tab,'rdfs:label "', $main_name,'"', if ($has_identifiers or $has_gender or $has_names) then ' ;' else '.', ' '), + (for $id at $i in $identifiers + let $type := $id/@type + let $is_last := $i = count($identifiers) and not($has_gender) and not($has_names) + return ( + if ($type = 'viaf') then + concat($tab,'owl:sameAs ', 'viaf:',$id/data(), if ($is_last) then '.' else ' ;',' ') + else if ($type = 'gnd') then + concat($tab,'owl:sameAs ', 'gnd:',$id/data(), if ($is_last) then '.' else ' ;',' ') + else if ($type = 'wikidata') then + concat($tab,'owl:sameAs ','wd:',$id/data(), if ($is_last) then '.' else ' ;',' ') + else () + )), + if ($has_gender) then concat($tab, 'foaf:gender "', $gender, '"', if (not($has_names)) then '.' else ' ;',' ') else (), + if ($has_names) then ( + concat($tab, 'foaf:name ', + string-join( + for $name in $names return concat('"', $name, '"'), + ", " + ), + '. ' + ) + ) else (), + ' ' + )), + (for $periodical in $doc//tei:list[@type='periodical']/tei:item let $periodical_id := $periodical/@xml:id/data(.) let $periodical_name := $periodical/tei:title/normalize-space(data(.)) return( - concat('pdperiodical:',$periodical_id, ' a dbo:Journal ;',' '), - concat($tab,'rdfs:label "', $periodical_name,'" ;',' '), - for $viaf_id in $periodical/tei:idno[@type='viaf'] - return if ($viaf_id) then concat($tab,'= ', 'viaf:',$viaf_id, ' ;',' ') else (), - for $gnd_id in $periodical/tei:idno[@type='gnd'] - return if ($gnd_id) then concat($tab,'= ','gnd:',$gnd_id, ' ;',' ') else (), - for $wikidata_id in $periodical/tei:idno[@type='wikidata'] - return if ($wikidata_id) then concat($tab,'= ','wd:',$wikidata_id, ' ;',' ') else (), - ' ')), + concat('pdperiodical:',$periodical_id, ' a dbo:Journal ;',' '), + concat($tab,'rdfs:label "', $periodical_name,'".',' '), + ' ' + )), (for $publication in $doc//tei:list[@type='publications']/tei:item let $publication_id := $publication/@xml:id/data(.) let $publication_name := $publication/tei:title/normalize-space(data(.)) return( - concat('pdpublication:',$publication_id, ' a dbo:LiteraryWork ;',' '), - concat($tab,'rdfs:label "', $publication_name,'" ;',' '), - for $viaf_id in $publication/tei:idno[@type='viaf'] - return if ($viaf_id) then concat($tab,'= ', 'viaf:',$viaf_id, ' ;',' ') else (), - for $gnd_id in $publication/tei:idno[@type='gnd'] - return if ($gnd_id) then concat($tab,'= ', 'gnd:',$gnd_id, ' ;',' ') else (), - for $wikidata_id in $publication/tei:idno[@type='wikidata'] - return if ($wikidata_id) then concat($tab,'= ','wd:',$wikidata_id, ' ;',' ') else (), - ' ')) + concat('pdpublication:',$publication_id, ' a dbo:LiteraryWork ;',' '), + concat($tab,'rdfs:label "', $publication_name,'".',' '), + ' ' + )) ) - diff --git a/app/resources/lists.xml b/app/resources/lists.xml index 7296464d..ca643607 100644 --- a/app/resources/lists.xml +++ b/app/resources/lists.xml @@ -893,20 +893,20 @@ Sepúlveda, Pedro, Ulrike Henny-Krahmer e Jorge Uribe (eds). - . Lisboa/Colónia: IELT/CCeH, 2017-2023. Versão A3.0.0-C2.1.0 + . Lisboa/Colónia: IELT/CCeH, 2017-2024. Versão A3.0.0-C2.1.0 10.18716/cceh/pessoa Sepúlveda, Pedro, Ulrike Henny-Krahmer, and Jorge Uribe (eds). - . Lisbon/Cologne: IELT/CCeH, University of Cologne 2017-2023. Version + . Lisbon/Cologne: IELT/CCeH, University of Cologne 2017-2024. Version A3.0.0-C2.1.0 10.18716/cceh/pessoa Sepúlveda, Pedro, Ulrike Henny-Krahmer und Jorge Uribe (Hrsg). - . Lissabon/Köln: IELT/CCeH, 2017-2023. Version A3.0.0-C2.1.0 + . Lissabon/Köln: IELT/CCeH, 2017-2024. Version A3.0.0-C2.1.0 10.18716/cceh/pessoa @@ -914,20 +914,20 @@ Sepúlveda, Pedro, Ulrike Henny-Krahmer e Jorge Uribe (eds). . Lisboa e Colónia: IELT, Universidade Nova de Lisboa e CCeH, - Universidade de Colónia 2017-2023. Versão A3.0.0-C2.1.0 + Universidade de Colónia 2017-2024. Versão A3.0.0-C2.1.0 10.18716/cceh/pessoa Sepúlveda, Pedro, Ulrike Henny-Krahmer, and Jorge Uribe (eds). . Lisbon and Cologne: IELT, New University of Lisbon and CCeH, University - of Cologne 2017-2023. Version A3.0.0-C2.1.0 + of Cologne 2017-2024. Version A3.0.0-C2.1.0 10.18716/cceh/pessoa Sepúlveda, Pedro, Ulrike Henny-Krahmer und Jorge Uribe (Hrsg). . Lissabon und Köln: IELT, Neue Universität Lissabon und CCeH, - Universität zu Köln 2017-2023. Version A3.0.0-C2.1.0 + Universität zu Köln 2017-2024. Version A3.0.0-C2.1.0 10.18716/cceh/pessoa diff --git a/build.xml b/build.xml index fe497529..bf767bf0 100644 --- a/build.xml +++ b/build.xml @@ -25,6 +25,7 @@ + @@ -35,7 +36,6 @@ - @@ -44,6 +44,8 @@ + +