Wikidata:WikiProject Figure skating/Queries
SPARQL queries :
Cool queries
[edit]Figure skating world records under the -5/+5 GoE rules
[edit]The following query uses these:
- Properties: uses (P2283) , instance of (P31) , sport (P641) , point in time (P585) , participant (P710) , number of points/goals/set scored (P1351)
SELECT DISTINCT ?skater ?skaterLabel ?score ?natureLabel ?competitionLabel ?sportLabel ?date WHERE { ?competition wdt:P2283 wd:Q57614485 ; wdt:P31 ?nature ; p:P710 ?statement . ?statement ps:P710 ?skater ; pq:P1351 ?score ; pq:P31 wd:Q688615 . OPTIONAL { ?competition wdt:P641 ?sport .} OPTIONAL { ?competition wdt:P585 ?date .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Timeline of competitions of the 2019-2020 season
[edit]The following query uses these:
- Properties: time period (P2348) , instance of (P31) , image (P18) , start time (P580) , point in time (P585)
#defaultView:Timeline SELECT ?competition ?competitionLabel ?image ?date WHERE { ?competition wdt:P2348 wd:Q58776861 ; wdt:P31 wd:Q2990963 . OPTIONAL { ?competition wdt:P18 ?image .} OPTIONAL { ?competition wdt:P580 ?start .} OPTIONAL { ?competition wdt:P585 ?pointInTime. } BIND(COALESCE(?start, ?pointInTime) AS ?date) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?competition ?competitionLabel ?image ?date ORDER BY ?date
Future figure skating competitions
[edit]The following query uses these:
- Properties: instance of (P31) , part of (P361) , start time (P580) , end time (P582) , point in time (P585)
SELECT ?competition ?competitionLabel ?date ?end WHERE { { ?competition wdt:P31 wd:Q2990963. } UNION { ?competition wdt:P31 wd:Q16510064. ?competition wdt:P361 ?comp. ?comp wdt:P31 wd:Q2990963. } UNION { ?competition wdt:P361 ?segment. ?segment wdt:P31 wd:Q16510064. } OPTIONAL { ?competition wdt:P580 ?start. } OPTIONAL { ?competition wdt:P582 ?end. } OPTIONAL { ?competition wdt:P585 ?pointInTime. } BIND(COALESCE(?start, ?pointInTime) AS ?date) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } FILTER((BOUND(?start)) || (BOUND(?pointInTime))) FILTER(?date >= (NOW() - "P1D"^^xsd:duration)) } ORDER BY ?date
Currently happening figure skating competitions
[edit]The following query uses these:
- Properties: instance of (P31) , part of (P361) , start time (P580) , end time (P582) , point in time (P585)
SELECT ?competition ?competitionLabel ?date ?end WHERE { { ?competition wdt:P31 wd:Q2990963. } UNION { ?competition wdt:P31 wd:Q16510064. ?competition wdt:P361 ?comp. ?comp wdt:P31 wd:Q2990963. } UNION { ?competition wdt:P361 ?segment. ?segment wdt:P31 wd:Q16510064. } OPTIONAL { ?competition wdt:P580 ?start. } OPTIONAL { ?competition wdt:P582 ?end. } OPTIONAL { ?competition wdt:P585 ?pointInTime. } BIND(COALESCE(?start, ?pointInTime) AS ?date) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } FILTER((BOUND(?start)) || (BOUND(?pointInTime))) FILTER(?end >= (NOW() - "P1D"^^xsd:duration)) FILTER((NOW()) >= ?date) } ORDER BY ?date
Maintenance queries
[edit]Skaters without sport
[edit]The following query uses these:
- Properties: instance of (P31) , occupation (P106) , sport (P641)
SELECT ?skater ?skaterLabel WHERE { ?skater wdt:P31 wd:Q5 ; wdt:P106 wd:Q13219587 . FILTER NOT EXISTS { ?skater wdt:P641 wd:Q38108 .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Skaters without discipline competed in
[edit]The following query uses these:
- Items: human (Q5) , figure skating (Q38108)
- Properties: instance of (P31) , sport (P641) , sports discipline competed in (P2416)
SELECT ?skater ?skaterLabel WHERE { ?skater wdt:P31 wd:Q5 ; wdt:P641 wd:Q38108 . FILTER NOT EXISTS { ?skater wdt:P2416 ?dummy .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Female ice dancers without a description in French
[edit]The following query uses these:
- Items: human (Q5) , female (Q6581072) , ice dancer (Q17361147)
- Properties: instance of (P31) , sex or gender (P21) , occupation (P106)
SELECT ?person ?personLabel (COUNT(?occ) AS ?occC) WHERE { ?person wdt:P31 wd:Q5 ; wdt:P21 wd:Q6581072 ; wdt:P106 wd:Q17361147 ; wdt:P106 ?occ. MINUS { ?person schema:description ?desc. FILTER(LANG(?desc) = "fr") } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } GROUP BY ?person ?personLabel HAVING (?occC = 1)
Pairs skaters or ice dancers without partner
[edit]The following query uses these:
- Items: human (Q5) , pair skating (Q1682809) , ice dance (Q926191)
- Properties: instance of (P31) , sports discipline competed in (P2416) , partner in business or sport (P1327)
SELECT ?skater ?skaterLabel ?disciplineLabel WHERE { ?skater wdt:P31 wd:Q5 ; wdt:P2416 ?discipline . FILTER (?discipline IN (wd:Q1682809, wd:Q926191)) FILTER NOT EXISTS { ?skater wdt:P1327 ?partner .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
People participating together in an event without being partners
[edit]The following query uses these:
- Items: human (Q5) , figure skating (Q38108)
- Properties: instance of (P31) , sport (P641) , partner in business or sport (P1327) , participant (P710) , together with (P1706)
SELECT DISTINCT ?skater ?skaterLabel ?partner ?partnerLabel ?compet WHERE { ?compet p:P710 ?statement . ?statement ps:P710 ?skater ; pq:P1706 ?partner . ?skater wdt:P31 wd:Q5 ; wdt:P641 wd:Q38108. ?partner wdt:P31 wd:Q5 . MINUS { ?skater wdt:P1327 ?partner .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }
Pairs skaters or ice dancers sharing an ISU identifier without the qualifier "shared ID"
[edit]The following query uses these:
- Properties: partner in business or sport (P1327) , ISU figure skater ID (P2694) , identifier shared with (P4070)
SELECT ?item ?item2 (CONCAT("A", ?dummy) AS ?id) WHERE { ?item p:P2694 ?statement ; wdt:P1327 ?item2 . ?statement ps:P2694 ?dummy . ?item2 wdt:P2694 ?dummy . FILTER (?item != ?item2) FILTER NOT EXISTS { ?statement pq:P4070 ?nothing .} }
(The 'A' is added in the identifier so that the .csv export doesn't delete the first 0. The A should be deleted when the identifier is correctly marked as text and not number in the software)
Pairs skaters or ice dancers with an ISU identifier with the qualifier "shared ID" when the partner doesn't have the ISU identifier
[edit]The following query uses these:
- Properties: ISU figure skater ID (P2694) , identifier shared with (P4070)
SELECT ?item ?itemLabel ?item2 ?item2Label (CONCAT("A", ?dummy) AS ?id) WHERE { ?item p:P2694 ?statement . ?statement ps:P2694 ?dummy . ?statement pq:P4070 ?item2 . FILTER NOT EXISTS { ?item2 wdt:P2694 ?dummy .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Pairs skaters or ice dancers with an ISU identifier with the qualifier "shared ID" without the same value in the property "partner"
[edit]The following query uses these:
- Properties: partner in business or sport (P1327) , ISU figure skater ID (P2694) , identifier shared with (P4070)
SELECT ?item ?itemLabel ?item2 ?item2Label (CONCAT("A", ?dummy) AS ?id) WHERE { ?item p:P2694 ?statement . ?statement ps:P2694 ?dummy . ?statement pq:P4070 ?item2 . FILTER NOT EXISTS { ?item wdt:P1327 ?item2 .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Skaters participating in a competition with an ISU reference without ISU identifier
[edit]The following query uses these:
- Properties: ISU figure skater ID (P2694) , participant (P710) , reference URL (P854)
SELECT DISTINCT ?skater ?skaterLabel WHERE { ?compet p:P710 ?statement . ?statement ps:P710 ?skater . ?statement prov:wasDerivedFrom ?ref . ?ref pr:P854 ?refURL . FILTER (CONTAINS(str(?refURL),'www.isuresults.com')) . MINUS { ?skater wdt:P2694 ?isu .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . } }
Skaters participating in a competition with a partner and an ISU reference without a shared ISU identifier with the partner
[edit]The following query uses these:
- Properties: sport (P641) , participant (P710) , ISU figure skater ID (P2694) , reference URL (P854) , together with (P1706) , identifier shared with (P4070)
SELECT DISTINCT ?skater ?skaterLabel WHERE { ?compet wdt:P641 ?sport. ?compet p:P710 ?statement. ?statement ps:P710 ?skater. ?statement pq:P1706 ?skater2. ?statement prov:wasDerivedFrom ?ref. ?ref pr:P854 ?refURL. SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } FILTER(CONTAINS(STR(?refURL), "www.isuresults.com")) FILTER(NOT EXISTS { ?skater p:P2694 ?stat. ?stat ps:P2694 ?isu. ?stat pq:P4070 ?skater2. }) FILTER(?sport IN(wd:Q1682809, wd:Q926191, wd:Q38108)) }
People acting as figure skating judges without the occupation figure skating judge
[edit]The following query uses these:
- Properties: occupation (P106) , significant person (P3342) , object of statement has role (P3831)
SELECT DISTINCT ?juge ?jugeLabel WHERE { ?item p:P3342 ?statement . ?statement ps:P3342 ?juge . ?statement pq:P3831 wd:Q56882269 . FILTER NOT EXISTS { ?juge wdt:P106 wd:Q56882269 . } SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } }
Specific competitions or series without date
[edit]The following query uses these:
- Items: pair skating (Q1682809) , ice dance (Q926191) , ladies' singles (Q4179462) , men's singles (Q4305887) , figure skating (Q38108) , figure skating series (Q57305027) , figure skating competition (Q2990963)
- Properties: sport (P641) , instance of (P31) , point in time (P585)
SELECT ?item ?itemLabel WHERE { ?item wdt:P641 ?sport ; wdt:P31 ?competition. FILTER (?sport IN (wd:Q1682809, wd:Q926191, wd:Q4179462, wd:Q4305887, wd:Q38108)) FILTER (?competition IN (wd:Q57305027, wd:Q2990963)) MINUS { ?item wdt:P585 ?date .} SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } }
Competitions with a date with year precision and both a start and end date with day precision in the same month
[edit]The following query uses these:
- Properties: instance of (P31) , point in time (P585) , start time (P580) , end time (P582)
SELECT ?competition ?competitionLabel ?year ?begin_date ?end_date WHERE { ?competition wdt:P31 wd:Q2990963 . ?competition p:P585/psv:P585 ?date_node . ?date_node wikibase:timePrecision "9"^^xsd:integer . ?date_node wikibase:timeValue ?date . ?competition p:P580/psv:P580 ?begin_date_node . ?begin_date_node wikibase:timePrecision "11"^^xsd:integer . ?begin_date_node wikibase:timeValue ?begin_date . ?competition p:P582/psv:P582 ?end_date_node . ?end_date_node wikibase:timePrecision "11"^^xsd:integer . ?end_date_node wikibase:timeValue ?end_date . SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } BIND(year(?date) AS ?year) BIND(month(?begin_date) AS ?month1) BIND(month(?end_date) AS ?month2) FILTER(?month1 = ?month2) } ORDER BY ?date ?competitionLabel
Specific competitions or series without period
[edit]The following query uses these:
- Items: pair skating (Q1682809) , ice dance (Q926191) , ladies' singles (Q4179462) , men's singles (Q4305887) , figure skating (Q38108) , figure skating series (Q57305027) , figure skating competition (Q2990963)
- Properties: sport (P641) , instance of (P31) , time period (P2348) , start time (P580) , end time (P582)
SELECT ?item ?itemLabel ?begin_date ?end_date WHERE { ?item wdt:P641 ?sport ; wdt:P31 ?competition. FILTER (?sport IN (wd:Q1682809, wd:Q926191, wd:Q4179462, wd:Q4305887, wd:Q38108)) FILTER (?competition IN (wd:Q57305027, wd:Q2990963)) MINUS { ?item wdt:P2348 ?period .} ?item p:P580/psv:P580 ?begin_date_node . ?begin_date_node wikibase:timePrecision "11"^^xsd:integer . ?begin_date_node wikibase:timeValue ?begin_date . ?item p:P582/psv:P582 ?end_date_node . ?end_date_node wikibase:timePrecision "11"^^xsd:integer . ?end_date_node wikibase:timeValue ?end_date . SERVICE wikibase:label { bd:serviceParam wikibase:language "en". } FILTER("2007-07-01"^^xsd:dateTime <= ?begin_date && ?begin_date < "2008-06-30"^^xsd:dateTime). }
Note: this query is specifically for the 2007-2008 season, changing the dates in FILTER is needed for other seasons.
Specific competitions where the link to the generic competition has no qualifiers nor references
[edit]The following query uses these:
- Items: pair skating (Q1682809) , ice dance (Q926191) , ladies' singles (Q4179462) , men's singles (Q4305887) , figure skating (Q38108) , figure skating series (Q57305027) , figure skating competition (Q2990963)
- Properties: sport (P641) , instance of (P31) , sports season of league or competition (P3450)
SELECT ?item ?itemLabel WHERE { ?item wdt:P641 ?sport ; wdt:P31 ?competition ; p:P3450 ?statement . FILTER (?sport IN (wd:Q1682809, wd:Q926191, wd:Q4179462, wd:Q4305887, wd:Q38108)) FILTER (?competition IN (wd:Q57305027, wd:Q2990963)) MINUS { ?statement ?pq ?qualifier. ?property wikibase:qualifier ?pq. } MINUS { ?statement prov:wasDerivedFrom ?reference. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } }
Constraints violations on items linked to "figure skating"
[edit](Due to a bug currently reported in Phabricator, this query only work on items which have been recently visited by logged in users)
The following query uses these:
- Items: figure skating (Q38108)
- Properties: property constraint (P2302)
SELECT ?property ?propertyLabel ?constraintTypeLabel ?item ?itemLabel ?pLabel WHERE { ?item ?linksTo wd:Q38108; ?p ?statement. ?statement wikibase:hasViolationForConstraint ?constraint. ?property p:P2302 ?constraint. ?constraint ps:P2302 ?constraintType SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } ORDER BY ?property