query-d1d0b248d6d58bbe434f527919964a6f
title:Ranma 1/2 chapters SELECT ?item ?itemLabel ?ord (GROUP_CONCAT(DISTINCT ?episodeLabel; separator=", ") AS ?episodes) (GROUP_CONCAT(DISTINCT ?characterLabel; separator=", ") AS ?characters) WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?item wdt:P31 wd:Q53460949. ?item wdt:P179 wd:Q272015. OPTIONAL { ?item p:P179 [ pq:P1545 ?ord ]. ?episode wdt:P144 ?item. ?episode rdfs:label ?episodeLabel. FILTER ( LANGMATCHES ( LANG ( ?episodeLabel ), "en" ) ) } OPTIONAL { ?item wdt:P674 ?character. ?character rdfs:label ?characterLabel. FILTER ( LANGMATCHES ( LANG ( ?characterLabel ), "en" ) )
} } GROUP BY ?item ?itemLabel ?ord
Use at
- https://query.wikidata.org/sparql
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#title:Ranma 1/2 chapters
SELECT ?item ?itemLabel ?ord
(GROUP_CONCAT(DISTINCT ?episodeLabel; separator=", ") AS ?episodes)
(GROUP_CONCAT(DISTINCT ?characterLabel; separator=", ") AS ?characters)
WHERE {
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
?item wdt:P31 wd:Q53460949.
?item wdt:P179 wd:Q272015.
OPTIONAL {
?item p:P179 [ pq:P1545 ?ord ].
?episode wdt:P144 ?item.
?episode rdfs:label ?episodeLabel.
FILTER ( LANGMATCHES ( LANG ( ?episodeLabel ), "en" ) )
}
OPTIONAL {
?item wdt:P674 ?character.
?character rdfs:label ?characterLabel.
FILTER ( LANGMATCHES ( LANG ( ?characterLabel ), "en" ) )
}
} GROUP BY ?item ?itemLabel ?ord
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v6("?character")
v1("?characterLabel"):::projected
v8("?characters")
v5("?episode")
v2("?episodeLabel"):::projected
v7("?episodes")
v3("?item"):::projected
v4("?ord"):::projected
a1((" "))
c9(["wd:Q272015"]):::iri
c3(["bd:serviceParam"]):::iri
c5(["#91;AUTO_LANGUAGE#93;,en"]):::literal
c7(["wd:Q53460949"]):::iri
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c3 --"wikibase:language"--> c5
end
v3 --"p:direct/P31"--> c7
v3 --"p:direct/P179"--> c9
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
a1 -."p:qualifier/P1545".-> v4
v3 --"p:P179"--> a1
v5 --"p:direct/P144"--> v3
v5 --"rdfs:label"--> v2
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P674".-> v6
v6 --"rdfs:label"--> v1
end
bind2[/"?episodeLabel"/]
v2 --o bind2
bind2 --as--o v7
bind3[/"?characterLabel"/]
v1 --o bind3
bind3 --as--o v8