query-f609f85e1949e20e20073916d08e2e8c
TODO
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 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 ?league_land ?league_landLabel ?league ?leagueLabel ?team ?teamLabel ?home_venue ?home_venueLabel ?start_year ?end_year WHERE {
?team wdt:P31 wd:Q17156793 . # team is an American football team
?team p:P118/ps:P118 ?league . # team plays in a league
OPTIONAL {?league wdt:P17 ?league_land } # the league is in country
OPTIONAL {
?team p:P115 ?p115stm . # team has a home venue...
?p115stm ps:P115 ?home_venue .
OPTIONAL {?p115stm pq:P580 ?startdate . BIND(YEAR(?startdate) AS ?start_year) } # ...with a start date
OPTIONAL {?p115stm pq:P582 ?enddate . BIND(YEAR(?enddate) AS ?end_year)} # ...with a end date
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "en,ca,it". }
}
ORDER BY ?league_landLabel ?leagueLabel ?teamLabel ?start_year
Query found at
graph TD
classDef projected fill:lightgreen;
classDef literal fill:orange;
classDef iri fill:yellow;
v12("?end_year"):::projected
v11("?enddate")
v9("?home_venue"):::projected
v6("?league"):::projected
v2("?leagueLabel"):::projected
v7("?league_land"):::projected
v1("?league_landLabel"):::projected
v8("?p115stm")
v11("?start_year"):::projected
v10("?startdate")
v5("?team"):::projected
v3("?teamLabel"):::projected
a1((" "))
c13(["en,ca,it"]):::literal
c11(["bd:serviceParam"]):::iri
c2(["wd:Q17156793"]):::iri
v5 --"p:direct/P31"--> c2
v5 --"p:P118"--> a1
a1 --"p:statement/P118"--> v6
subgraph optional0["(optional)"]
style optional0 fill:#bbf,stroke-dasharray: 5 5;
v6 -."p:direct/P17".-> v7
end
subgraph optional1["(optional)"]
style optional1 fill:#bbf,stroke-dasharray: 5 5;
v5 -."p:P115".-> v8
v8 --"p:statement/P115"--> v9
subgraph optional2["(optional)"]
style optional2 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P580".-> v10
bind0[/"year-from-dateTime(?startdate)"/]
v10 --o bind0
bind0 --as--o v11
end
subgraph optional3["(optional)"]
style optional3 fill:#bbf,stroke-dasharray: 5 5;
v8 -."p:qualifier/P582".-> v11
bind1[/"year-from-dateTime(?enddate)"/]
v11 --o bind1
bind1 --as--o v12
end
end
subgraph s1["http://wikiba.se/ontology#label"]
style s1 stroke-width:4px;
c11 --"wikibase:language"--> c13
end