目的:現在のコードで求められている章よりも深い章・節を求めたい(深い層まで求めたい)
現在Wikidata Query Service内以下のコードで聖書(マタイによる福音書)に関する作品の画像を求めています。
画像を求めるに当たっての過程で
1新約聖書(マタイによる福音)のすべての章を求める
2その章のうち描かれた実体・もの(エピソード)を求める
3それを描いた画像を求める
という順番で進めています。
最終目標である画像の結果を求めることはできていますが、
以下の結果にあるようにこのコードでは最初の変数mat_partには章のみが反映されています。
私は現在、その作品がどの1.章と2.節で記載されているかまでを求めることを目標としています。
____________________________________________
コード:
SELECT ?mat_part ?mat_ob ?mat_sec ?mat_img #変数
?mat_partLabel ?mat_obLabel ?mat_secLabel ?mat_imgLabel #1行目3つの変数のラベルを表示するための変数
WHERE
{
wd:Q392302 wdt:P527 ?mat_part.
//主:マタイによる福音書(Q392392) 述:この主題の一部(P527) 目:mat_part
?mat_part wdt:P180 ?mat_ob.
//主:mat_part 述:描かれた実体(P180) 目:mat_ob
?mat_ob wdt:P18 ?mat_img.
//主:mat_ob 述:画像(P18) 目:mat_img
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } #ラベル出力用の処理
}
____________________________________________
結果:
mat_part wd:Q6789861
mat_ob wd:Q1267621
mat_img commons:Scarsellino - Driving of the merchants from the temple - Google Art Project.jpg
mat_partLabel マタイによる福音書 第21章
mat_obLabel Cleansing of the Temple
mat_imgLabel http://commons.wikimedia.org/wiki/Special:FilePath/Scarsellino%20-%20Driving%20of%20the%20merchants%20from%20the%20temple%20-%20Google%20Art%20Project.jpg
____________________________________________
mat_part wd:Q6789938
mat_ob wd:Q4015942
mat_img commons:Ghirlandaio, Domenico - Calling of the Apostles - 1481.jpg
mat_partLabel マタイによる福音書 第4章
mat_obLabel calling of the disciples
mat_imgLabel http://commons.wikimedia.org/wiki/Special:FilePath/Ghirlandaio%2C%20Domenico%20-%20Calling%20of%20the%20Apostles%20-%201481.jpg
____________________________________________
mat_part wd:Q6790067
mat_ob wd:Q4015942
mat_img commons:Ghirlandaio, Domenico - Calling of the Apostles - 1481.jpg
mat_partLabel マタイによる福音書 第9章
mat_obLabel calling of the disciples
mat_imgLabel http://commons.wikimedia.org/wiki/Special:FilePath/Ghirlandaio%2C%20Domenico%20-%20Calling%20of%20the%20Apostles%20-%201481.jpg
____________________________________________
mat_part wd:Q6790067
mat_ob wd:Q5022191
mat_img commons:Bernardo Strozzi - Calling of St Matthew.jpg
mat_partLabel マタイによる福音書 第9章
mat_obLabel Calling of Matthew
mat_imgLabel
http://commons.wikimedia.org/wiki/Special:FilePath/Bernardo%20Strozzi%20-%20Calling%20of%20St%20Matthew.jpg
____________________________________________
mat_part wd:Q6789819
mat_ob wd:Q56857972
mat_img commons:Degollación de San Juan Bautista, Juan Martínez Montañés.jpg
mat_partLabel マタイによる福音書 第14章
mat_obLabel beheading of John the Baptist
mat_imgLabel http://commons.wikimedia.org/wiki/Special:FilePath/Degollaci%C3%B3n%20de%20San%20Juan%20Bautista%2C%20Juan%20Mart%C3%ADnez%20Monta%C3%B1%C3%A9s.jpg
__________________________________________
理想的な実行結果
mat_part wd:Q6789819
mat_ob wd:Q56857972
mat_img commons:Degollación de San Juan Bautista, Juan Martínez Montañés.jpg
mat_partLabel マタイによる福音書 第14章 23~28
mat_obLabel beheading of John the Baptist
mat_imgLabel http://commons.wikimedia.org/wiki/Special:FilePath/Degollaci%C3%B3n%20de%20San%20Juan%20Bautista%2C%20Juan%20Mart%C3%ADnez%20Monta%C3%B1%C3%A9s.jpg
文章に至らない点もあるとは思いますが、コメント等ですぐに対応させていただきます。
よろしくお願いいたします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/10/17 07:45