Skip to content

Commit

Permalink
Add role to characters in play information and to the characters endp…
Browse files Browse the repository at this point in the history
…oint

Discovered from #274 that this is missing
  • Loading branch information
cmil committed Dec 20, 2024
1 parent 5319e5f commit 0a53eda
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1958,6 +1958,8 @@ components:
- MALE
- FEMALE
- UNKNOWN
role:
type: string
wikidataId:
# ontology: #character_wikidata_id
type: string
Expand Down Expand Up @@ -2226,6 +2228,8 @@ components:
- FEMALE
- UNKNOWN
nullable: true
role:
type: string
betweenness:
# ontology: #character_node_betweenness
type: number
Expand Down
4 changes: 4 additions & 0 deletions modules/util.xqm
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,7 @@ declare function dutil:get-play-info(
)
let $name := $node/(tei:persName | tei:name)[1]/text()
let $sex := $node/@sex/string()
let $role := $node/@role/string()
let $isGroup := if ($node/name() eq 'personGrp')
then true() else false()
let $wikidata-id := dutil:get-wikidata-id-from-ana($node)
Expand All @@ -1030,6 +1031,7 @@ declare function dutil:get-play-info(
"isGroup": $isGroup,
"sex": if($sex) then $sex else ()
},
if ($role) then map:entry("role", $role) else (),
if ($wikidata-id) then map:entry("wikidataId", $wikidata-id) else ()
))
},
Expand Down Expand Up @@ -1151,6 +1153,7 @@ declare function dutil:characters-info (
)
let $name := $node/(tei:persName | tei:name)[1]/text()
let $sex := $node/@sex/string()
let $role := $node/@role/string()
let $isGroup := if ($node/name() eq 'personGrp')
then true() else false()
let $num-of-speech := $tei//tei:sp[@who='#'||$id]
Expand All @@ -1174,6 +1177,7 @@ declare function dutil:characters-info (
"betweenness": $metrics-node/betweenness/number(.),
"eigenvector": $eigenvector
},
if ($role) then map:entry("role", $role) else (),
if ($wikidata-id) then map:entry("wikidataId", $wikidata-id) else ()
))
}
Expand Down

0 comments on commit 0a53eda

Please sign in to comment.