Skip to content

Instantly share code, notes, and snippets.

@fvh-P
Created March 27, 2022 14:53
Show Gist options
  • Save fvh-P/e4cbb1325cd8d9c22060357f63d227bb to your computer and use it in GitHub Desktop.
Save fvh-P/e4cbb1325cd8d9c22060357f63d227bb to your computer and use it in GitHub Desktop.
正式名称のかな表記が6文字のリリィ・教導官・その他キャラクター、または正式名称が6文字のレギオン・CHARMを取得するSPARQLクエリ
PREFIX lily: <https://lily.fvhp.net/rdf/IRIs/lily_schema.ttl#>
PREFIX schema: <http://schema.org/>
SELECT ?kana ?display ?class ?slug
WHERE {
{
VALUES ?class { lily:Lily lily:Teacher lily:Character }
?slug lily:nameKana ?kana ;
schema:name ?display ;
a ?class.
FILTER(strlen(?kana)=6)
FILTER(lang(?display)="ja")
}
UNION
{
VALUES ?class { lily:Legion lily:Charm }
?slug schema:name ?display ;
a ?class.
FILTER(strlen(?display)=6)
FILTER(lang(?display)="ja")
}
}
@fvh-P
Copy link
Author

fvh-P commented Mar 27, 2022

変数 ?class?slug は Lemonade の URL 生成用。
変数 ?nameKana が存在しない場合、変数 ?display から利用者側で漢字表記などのものを除去・ひらがなへの変換が必要。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment