query-4989ff82eee5007652c1a2a71a7cbab7
Bradyguy18(P155)follows (P156)followed by (P179)part of the series (P155)follows (P156)followed by
Use at
- https://query.wikidata.org/sparql
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?book ?bookLabel ?seriesLabel ?number ?followsLabel ?followed_byLabel
WHERE
{
?book wdt:P50 wd:Q333719 . # book by Lee Child
OPTIONAL
{
?book p:P179 ?series_statement .
?series_statement ps:P179 ?series .
OPTIONAL { ?series_statement pq:P1545 ?number . }
OPTIONAL { ?series_statement pq:P155 ?follows_qualifier . }
OPTIONAL { ?series_statement pq:P156 ?followed_by_qualifier . }
}
OPTIONAL { ?book wdt:P155 ?follows_main . }
OPTIONAL { ?book wdt:P156 ?followed_by_main . }
BIND (COALESCE(?follows_qualifier, ?follows_main) AS ?follows)
BIND (COALESCE(?followed_by_qualifier, ?followed_by_main) AS ?followed_by)
SERVICE wikibase:label {
bd:serviceParam wikibase:language "en" .
}
}
ORDER BY ?series xsd:integer(?number)
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v3("?book"):::projected
v10("?followed_by")
v8("?followed_by_main")
v6("?followed_by_qualifier")
v9("?follows")
v7("?follows_main")
v5("?follows_qualifier")
v2("?number"):::projected
v1("?series")
v4("?series_statement")
c13(["en"]):::literal
c11(["bd:serviceParam"]):::iri
c2(["wd:Q333719"]):::iri
v3 --"p:direct/P50"--> c2
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:P179".-> v4
v4 --"p:statement/P179"--> v1
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P1545".-> v2
end
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P155".-> v5
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v4 -."p:qualifier/P156".-> v6
end
end
subgraph optional4["(optional)"]
style optional4 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P155".-> v7
end
subgraph optional5["(optional)"]
style optional5 fill:#bbf,stroke-dasharray: 5 5;
v3 -."p:direct/P156".-> v8
end
bind0[/"?follows_qualifier?follows_main"/]
v5 --o bind0
v7 --o bind0
bind0 --as--o v9
bind1[/"?followed_by_qualifier?followed_by_main"/]
v6 --o bind1
v8 --o bind1
bind1 --as--o v10
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end