Skip to content

Commit

Permalink
rdf generator corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandaalvaf committed Jan 5, 2024
1 parent 7e39082 commit 0a1f4de
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 49 deletions.
85 changes: 43 additions & 42 deletions app/modules/RDF_gen.xql
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ let $header := concat(
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .&#xA;",
"@prefix wd: <http://www.wikidata.org/entity/> .&#xA;",
"@prefix viaf: <http://viaf.org/viaf/> .&#xA;",
"@prefix gnd: <http://d-nb.info/gnd/>;",
"@prefix gnd: <http://d-nb.info/gnd/> .&#xA;",
"@prefix owl: <http://www.w3.org/2002/07/owl#> .&#xA;",
"&#xA;"
)

Expand All @@ -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 ;', '&#xA;'),
concat($tab,'rdfs:label "', $main_name,'" ;','&#xA;'),
for $viaf_id in $person/tei:idno[@type='viaf']
return if ($viaf_id) then concat($tab,'= ', 'viaf:',$viaf_id, ' ;','&#xA;') else (),
for $gnd_id in $person/tei:idno[@type='gnd']
return if ($gnd_id) then concat($tab,'= ', 'gnd:',$gnd_id,' ;','&#xA;') else (),
for $wikidata_id in $person/tei:idno[@type='wikidata']
return if ($wikidata_id) then concat($tab,'= ','wd:',$wikidata_id, ' ;','&#xA;') else (),
concat($tab, 'foaf:gender "', $gender, '" ;','&#xA;'),
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,'";&#xA;')
else concat('"',$label,'", ')
else ()
),
'&#xA;')
),
(for $periodical in $doc//tei:list[@type='periodical']/tei:item
concat('pdperson:',$person_id, ' a crm:E21_Person ;', '&#xA;'),
concat($tab,'rdfs:label "', $main_name,'"', if ($has_identifiers or $has_gender or $has_names) then ' ;' else '.', '&#xA;'),
(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 ' ;','&#xA;')
else if ($type = 'gnd') then
concat($tab,'owl:sameAs ', 'gnd:',$id/data(), if ($is_last) then '.' else ' ;','&#xA;')
else if ($type = 'wikidata') then
concat($tab,'owl:sameAs ','wd:',$id/data(), if ($is_last) then '.' else ' ;','&#xA;')
else ()
)),
if ($has_gender) then concat($tab, 'foaf:gender "', $gender, '"', if (not($has_names)) then '.' else ' ;','&#xA;') else (),
if ($has_names) then (
concat($tab, 'foaf:name ',
string-join(
for $name in $names return concat('"', $name, '"'),
", "
),
'.&#xA;'
)
) else (),
'&#xA;'
)),
(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 ;','&#xA;'),
concat($tab,'rdfs:label "', $periodical_name,'" ;','&#xA;'),
for $viaf_id in $periodical/tei:idno[@type='viaf']
return if ($viaf_id) then concat($tab,'= ', 'viaf:',$viaf_id, ' ;','&#xA;') else (),
for $gnd_id in $periodical/tei:idno[@type='gnd']
return if ($gnd_id) then concat($tab,'= ','gnd:',$gnd_id, ' ;','&#xA;') else (),
for $wikidata_id in $periodical/tei:idno[@type='wikidata']
return if ($wikidata_id) then concat($tab,'= ','wd:',$wikidata_id, ' ;','&#xA;') else (),
'&#xA;')),
concat('pdperiodical:',$periodical_id, ' a dbo:Journal ;','&#xA;'),
concat($tab,'rdfs:label "', $periodical_name,'".','&#xA;'),
'&#xA;'
)),
(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 ;','&#xA;'),
concat($tab,'rdfs:label "', $publication_name,'" ;','&#xA;'),
for $viaf_id in $publication/tei:idno[@type='viaf']
return if ($viaf_id) then concat($tab,'= ', 'viaf:',$viaf_id, ' ;','&#xA;') else (),
for $gnd_id in $publication/tei:idno[@type='gnd']
return if ($gnd_id) then concat($tab,'= ', 'gnd:',$gnd_id, ' ;','&#xA;') else (),
for $wikidata_id in $publication/tei:idno[@type='wikidata']
return if ($wikidata_id) then concat($tab,'= ','wd:',$wikidata_id, ' ;','&#xA;') else (),
'&#xA;'))
concat('pdpublication:',$publication_id, ' a dbo:LiteraryWork ;','&#xA;'),
concat($tab,'rdfs:label "', $publication_name,'".','&#xA;'),
'&#xA;'
))
)

12 changes: 6 additions & 6 deletions app/resources/lists.xml
Original file line number Diff line number Diff line change
Expand Up @@ -893,41 +893,41 @@
<term xml:lang="pt">
<span>Sepúlveda, Pedro, Ulrike Henny-Krahmer e Jorge Uribe (eds).</span>
<span type="link"/>
<span type="web"/><span>. Lisboa/Colónia: IELT/CCeH, 2017-2023. Versão A3.0.0-C2.1.0</span>
<span type="web"/><span>. Lisboa/Colónia: IELT/CCeH, 2017-2024. Versão A3.0.0-C2.1.0</span>
<span type="url"/><span type="doi">10.18716/cceh/pessoa</span>
</term>
<term xml:lang="en">
<span>Sepúlveda, Pedro, Ulrike Henny-Krahmer, and Jorge Uribe (eds).</span>
<span type="link"/>
<span type="web"/><span>. Lisbon/Cologne: IELT/CCeH, University of Cologne 2017-2023. Version
<span type="web"/><span>. Lisbon/Cologne: IELT/CCeH, University of Cologne 2017-2024. Version
A3.0.0-C2.1.0</span>
<span type="url"/><span type="doi">10.18716/cceh/pessoa</span>
</term>
<term xml:lang="de">
<span>Sepúlveda, Pedro, Ulrike Henny-Krahmer und Jorge Uribe (Hrsg).</span>
<span type="link"/>
<span type="web"/><span>. Lissabon/Köln: IELT/CCeH, 2017-2023. Version A3.0.0-C2.1.0</span>
<span type="web"/><span>. Lissabon/Köln: IELT/CCeH, 2017-2024. Version A3.0.0-C2.1.0</span>
<span type="url"/><span type="doi">10.18716/cceh/pessoa</span>
</term>
</item>
<item xml:id="cite-sd">
<term xml:lang="pt">
<span>Sepúlveda, Pedro, Ulrike Henny-Krahmer e Jorge Uribe (eds).</span>
<span type="web"/><span>. 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</span>
Universidade de Colónia 2017-2024. Versão A3.0.0-C2.1.0</span>
<span type="url"/><span type="doi">10.18716/cceh/pessoa</span>
</term>
<term xml:lang="en">
<span>Sepúlveda, Pedro, Ulrike Henny-Krahmer, and Jorge Uribe (eds).</span>
<span type="web"/><span>. Lisbon and Cologne: IELT, New University of Lisbon and CCeH, University
of Cologne 2017-2023. Version A3.0.0-C2.1.0</span>
of Cologne 2017-2024. Version A3.0.0-C2.1.0</span>
<span type="url"/><span type="doi">10.18716/cceh/pessoa</span>
</term>
<term xml:lang="de">
<span>Sepúlveda, Pedro, Ulrike Henny-Krahmer und Jorge Uribe (Hrsg).</span>
<span type="web"/>
<span>. 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</span>
Universität zu Köln 2017-2024. Version A3.0.0-C2.1.0</span>
<span type="url"/><span type="doi">10.18716/cceh/pessoa</span>
</term>
</item>
Expand Down
4 changes: 3 additions & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
<exclude name="*.xpr"/>

<!-- data: -->

<include name="data/doc/*.*"/>
<include name="data/network/*.*"/>
<exclude name="data/pre1913/*.*"/>
Expand All @@ -35,7 +36,6 @@
<exclude name="data/todo/*.*"/>
<include name="data/*.*"/>


<!-- general excludes: -->
<exclude name="**/*.properties"/>
<exclude name="**/*.tmpl"/>
Expand All @@ -44,6 +44,8 @@
</fileset>

<fileset dir="./app">


<include name="*.*"/>
<include name="modules/*.*"/>
<include name="page/*.*"/>
Expand Down

0 comments on commit 0a1f4de

Please sign in to comment.