Wikidata:WikiProject Figure skating/Queries

From Wikidata
Jump to navigation Jump to search

Home

 

Properties

 

Todo

 

Queries

 

SPARQL queries :

Cool queries

[edit]

Figure skating world records under the -5/+5 GoE rules

[edit]

The following query uses these:

Timeline of competitions of the 2019-2020 season

[edit]

The following query uses these:

  • Properties: time period (P2348)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, image (P18)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID
    #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)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, end time (P582)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, part of (P361)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, end time (P582)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID, sport (P641)  View with Reasonator View with SQID
    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:

Female ice dancers without a description in French

[edit]

The following query uses these:

  • Properties: instance of (P31)  View with Reasonator View with SQID, sex or gender (P21)  View with Reasonator View with SQID, occupation (P106)  View with Reasonator View with SQID
    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:

People participating together in an event without being partners

[edit]

The following query uses these:

Pairs skaters or ice dancers sharing an ISU identifier without the qualifier "shared ID"

[edit]

The following query uses these:

(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)  View with Reasonator View with SQID, identifier shared with (P4070)  View with Reasonator View with SQID
    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:

Skaters participating in a competition with an ISU reference without ISU identifier

[edit]

The following query uses these:

  • Properties: ISU figure skater ID (P2694)  View with Reasonator View with SQID, participant (P710)  View with Reasonator View with SQID, reference URL (P854)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, participant (P710)  View with Reasonator View with SQID, ISU figure skater ID (P2694)  View with Reasonator View with SQID, reference URL (P854)  View with Reasonator View with SQID, together with (P1706)  View with Reasonator View with SQID, identifier shared with (P4070)  View with Reasonator View with SQID
    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:

Specific competitions or series without date

[edit]

The following query uses these:

  • Properties: sport (P641)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID
    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)  View with Reasonator View with SQID, point in time (P585)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, end time (P582)  View with Reasonator View with SQID
    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:

  • Properties: sport (P641)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, time period (P2348)  View with Reasonator View with SQID, start time (P580)  View with Reasonator View with SQID, end time (P582)  View with Reasonator View with SQID
    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.

[edit]

The following query uses these:

  • Properties: sport (P641)  View with Reasonator View with SQID, instance of (P31)  View with Reasonator View with SQID, sports season of league or competition (P3450)  View with Reasonator View with SQID
    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:

  • Properties: property constraint (P2302)  View with Reasonator View with SQID
    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