Skip to content

Commit

Permalink
fix for #187
Browse files Browse the repository at this point in the history
  • Loading branch information
eroux committed Sep 2, 2022
1 parent 7376b15 commit 9511af6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions openpecha/buda/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,11 @@ def _res_from_model(g, wlname):
break
else:
res["source_metadata"]["title"] = l.value
res["source_metadata"]["languages"] = set()
for _, _, wa in g.triples((mwres, BDO.instanceOf, None)):
for _, _, l in g.triples((wa, BDO.language, None)):
for _, _, lt in g.triples((l, BDO.langBCP47Lang, None)):
res["source_metadata"]["languages"].add(lt.value)
for _, _, aac in g.triples((wa, BDO.creator, None)):
if (aac, BDO.role, BDR.R0ER0009) or (aac, BDO.role, BDR.R0ER0009) in g:
for _, _, p in g.triples((aac, BDO.agent, None)):
Expand All @@ -144,6 +148,7 @@ def _res_from_model(g, wlname):
break
else:
res["source_metadata"]["author"] = l.value
res["source_metadata"]["languages"] = list(res["source_metadata"]["languages"])
for _, _, ig in g.triples((wres, BDO.instanceHasVolume, None)):
iglname = str(ig)[str(ig).rfind('/')+1:]
res["image_groups"][iglname] = {}
Expand Down
7 changes: 7 additions & 0 deletions tests/buda/data/OP_info-W12827.ttl
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,13 @@ bdr:I2071 a bdo:ImageGroup ;
bdo:volumePagesTbrcIntro 0 ;
bdo:volumePagesTotal 525 .

bdr:LangBo a bdo:Language , owl:Class ;
rdfs:seeAlso <https://github.com/buda-base/owl-schema/issues/98> , <http://lexvo.org/id/iso639-3/bod> ;
rdfs:subClassOf bdo:Language ;
bdo:langBCP47Lang "bo" ;
bdo:langMARCCode "tib" ;
skos:prefLabel "藏文"@zh-hans , "bod yig"@bo-x-ewts , "Tibetan"@en .

bdr:I2061 a bdo:ImageGroup ;
bdo:volumeNumber 1 ;
bdo:volumeOf bdr:W12827 ;
Expand Down
1 change: 1 addition & 0 deletions tests/buda/data/expected-W12827.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"access":"http://purl.bdrc.io/admindata/AccessOpen",
"reproduction_of":"http://purl.bdrc.io/resource/MW12827",
"copyright_status":"http://purl.bdrc.io/resource/CopyrightPublicDomain",
"languages": ["bo"],
"title":"སྙིང་ཐིག་ཡ་བཞི།",
"author":"ཀློང་ཆེན་རབ་འབྱམས་པ་དྲི་མེད་འོད་ཟེར།",
"geo_restriction": ["CN"]
Expand Down

0 comments on commit 9511af6

Please sign in to comment.