Skip to content

Instantly share code, notes, and snippets.

@banjun
Created December 28, 2019 10:33
Show Gist options
  • Save banjun/f11ba03622b8094f5f5ab151d2f96e5d to your computer and use it in GitHub Desktop.
Save banjun/f11ba03622b8094f5f5ab151d2f96e5d to your computer and use it in GitHub Desktop.
generate-prismdb-characters.jisyo.md

oneliner

curl 'https://prismdb.takanakahiko.me/sparql?default-graph-uri=&query=PREFIX+prism%3A+%3Chttps%3A%2F%2Fprismdb.takanakahiko.me%2Fprism-schema.ttl%23%3E%0D%0A%0D%0ASELECT+concat%28%22%5Cn%3B%3B+okuri-ari+entries.%5Cn%3B%3B+okuri-nasi+entries.%5Cn%5Cn%22%2C%0D%0Agroup_concat%28concat%28replace%28%3Fckana%2C+%22+%22%2C+%22%22%29%2C+%22+%2F%22%2C+replace%28%3Fcname%2C+%22+%22%2C+%22%22%29%2C+%22%3B%22%2C+%3Fcclass%2C+if%28bound%28%3Fccv%29%2C+concat%28%22+CV%3A%22%2C+%3Fccv%29%2C+%22%22%29%2C+%22%2F%22%29%3B+separator%3D%22%5Cn%22%29%29%0D%0AWHERE+%7B%0D%0A++++%3Fc+a+prism%3ACharacter%3B%0D%0A++++++++prism%3Aname+%3Fcname%3B%0D%0A++++++++prism%3Aname_kana+%3Fckana%3B%0D%0A++++++++a%2Frdfs%3Alabel+%3Fcclass.%0D%0A++++optional+%7B%3Fc+prism%3Acv+%3Fccv.%7D%0D%0A++++bind%28%22%22+as+%3Fg%29%0D%0A%7D%0D%0Agroup+by+%3Fg&format=text%2Fcsv' | tail +3 | LC_ALL=C sort > prismdb-characters.jisyo

SPARQL

PREFIX prism: <https://prismdb.takanakahiko.me/prism-schema.ttl#>

SELECT concat("\n;; okuri-ari entries.\n;; okuri-nasi entries.\n\n",
group_concat(concat(replace(?ckana, " ", ""), " /", replace(?cname, " ", ""), ";", ?cclass, if(bound(?ccv), concat(" CV:", ?ccv), ""), "/"); separator="\n"))
WHERE {
    ?c a prism:Character;
        prism:name ?cname;
        prism:name_kana ?ckana;
        a/rdfs:label ?cclass.
    optional {?c prism:cv ?ccv.}
    bind("" as ?g)
}
group by ?g

refs

@banjun
Copy link
Author

banjun commented Dec 28, 2019

use by AquaSKK

真中らぁら

@banjun
Copy link
Author

banjun commented Dec 29, 2019

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