Skip to content

Instantly share code, notes, and snippets.

@foooomio
Last active December 1, 2019 08:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save foooomio/8314036fee8bc74c8d7da835ab1b7fa3 to your computer and use it in GitHub Desktop.
Save foooomio/8314036fee8bc74c8d7da835ab1b7fa3 to your computer and use it in GitHub Desktop.
ピコピコプラネットのクエリ例
# Turtle 形式で出力させるのが見やすくておすすめです
BASE <https://mltd.pikopikopla.net/resource/>
DESCRIBE <LTP_01>
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX : <http://schema.org/>
SELECT ?album ?artist ?position
WHERE {
?s a :MusicAlbum ;
:name ?album ;
:track [
:recordingOf/:name "Thank You!" ;
:byArtist/:name ?artist ;
:position ?position
] .
}
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX mltd: <https://mltd.pikopikopla.net/mltd-schema#>
PREFIX : <http://schema.org/>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?name ?account ?url
WHERE {
?s a mltd:VoiceActor ;
:name ?name ;
foaf:account [
foaf:name "Twitter" ;
foaf:accountName ?account ;
foaf:page ?url
] .
}
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX mltd: <https://mltd.pikopikopla.net/mltd-schema#>
PREFIX : <http://schema.org/>
SELECT ?agency (COUNT(?agency) AS ?people)
WHERE {
?s a mltd:VoiceActor ;
:memberOf ?agency .
}
GROUP BY ?agency
ORDER BY DESC(?people)
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX : <http://schema.org/>
SELECT DISTINCT ?album ?unit_name (GROUP_CONCAT(?member;separator=",") AS ?members)
WHERE {
?unit a :MusicGroup ;
:member/:name ?member ;
^:byArtist/^:track/:name ?album .
OPTIONAL { ?unit :name ?unit_name }
}
GROUP BY ?unit ?unit_name ?album
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX mltd: <https://mltd.pikopikopla.net/mltd-schema#>
PREFIX : <http://schema.org/>
SELECT ?album ?position ?song
WHERE {
?s a :MusicAlbum ;
:name ?album ;
:track [
:recordingOf/:name ?song ;
:byArtist/:member?/:name "七尾百合子" ;
:position ?position
] .
}
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX : <http://schema.org/>
SELECT ?song (COUNT(?song) AS ?count)
WHERE {
?s a :MusicAlbum ;
:name ?album ;
:track [
:recordingOf/:name ?song ;
:byArtist/:name ?artist
] .
}
GROUP BY ?song
ORDER BY DESC(?count)
BASE <https://mltd.pikopikopla.net/resource/>
PREFIX mltd: <https://mltd.pikopikopla.net/mltd-schema#>
PREFIX : <http://schema.org/>
SELECT (STR(?givenName) AS ?名前) (COUNT(?s) AS ?人数) (GROUP_CONCAT(?name) AS ?該当者)
WHERE {
?s a mltd:VoiceActor ;
:name ?name ;
:givenName ?givenName .
FILTER(LANG(?givenName) = 'ja-hira')
}
GROUP BY ?givenName
HAVING (?人数 >= 2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment