query-2d330ef10200bd2e16489aee539e8d18

rq turtle/ttl

Toutes les stations du SMC SELECT ?item ?itemLabel ?coord ?daily ?d_start ?d_end ?monthly ?m_start ?m_end WHERE { ?item (wdt:P31/wdt:P279*) wd:Q190107. ?item wdt:P127 wd:Q349450. ?item wdt:P6242 ?MSCID SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } OPTIONAL { ?item wdt:P625 ?coord. } OPTIONAL { ?item p:P6339 ?d_statement . # there is a P6339 property ?d_statement ps:P6339 wd:Q59657036 . # and it's a daily ?d_statement ps:P6339 ?daily . # and we get its value, in case there are no dates OPTIONAL { ?d_statement pq:P580 ?d_start .} # might be a start date OPTIONAL { ?d_statement pq:P582 ?d_end .} # might be an end date } OPTIONAL { ?item p:P6339 ?m_statement . # Note we change to ?m_statement from ?d_statement ?m_statement ps:P6339 wd:Q59657037 . # same for monthly ?m_statement ps:P6339 ?monthly .
OPTIONAL { ?m_statement pq:P580 ?m_start .} OPTIONAL { ?m_statement pq:P582 ?m_end .} } } ORDER BY(?MSCID)

Use at

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#>
# Toutes les stations du SMC
SELECT ?item ?itemLabel ?coord ?daily ?d_start ?d_end ?monthly ?m_start ?m_end WHERE {
  ?item (wdt:P31/wdt:P279*) wd:Q190107.
  ?item wdt:P127 wd:Q349450.
  ?item wdt:P6242 ?MSCID
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  OPTIONAL { ?item wdt:P625 ?coord. }
  OPTIONAL { ?item p:P6339 ?d_statement .          # there is a P6339 property
             ?d_statement ps:P6339 wd:Q59657036 .  # and it's a daily
             ?d_statement ps:P6339 ?daily .        # and we get its value, in case there are no dates
             OPTIONAL { ?d_statement pq:P580 ?d_start .} # might be a start date
             OPTIONAL { ?d_statement pq:P582 ?d_end .}   # might be an end date
           }
  OPTIONAL { ?item p:P6339 ?m_statement .          # Note we change to ?m_statement from ?d_statement
             ?m_statement ps:P6339 wd:Q59657037 .  # same for monthly
             ?m_statement ps:P6339 ?monthly .     
             OPTIONAL { ?m_statement pq:P580 ?m_start .}
             OPTIONAL { ?m_statement pq:P582 ?m_end .}
           }
}
ORDER BY(?MSCID)

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?MSCID") v3("?coord"):::projected v7("?d_end"):::projected v6("?d_start"):::projected v4("?d_statement") v5("?daily"):::projected v2("?item"):::projected v11("?m_end"):::projected v10("?m_start"):::projected v8("?m_statement") v9("?monthly"):::projected a1((" ")) c17(["wd:Q59657037"]):::iri c14(["wd:Q59657036"]):::iri c3(["wd:Q190107"]):::iri c5(["wd:Q349450"]):::iri c8(["bd:serviceParam"]):::iri c10(["#91;AUTO_LANGUAGE#93;,en"]):::literal v2 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c3 v2 --"p:direct/P127"--> c5 v2 --"p:direct/P6242"--> v1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c8 --"wikibase:language"--> c10 end subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:direct/P625".-> v3 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P6339".-> v4 v4 --"p:statement/P6339"--> c14 v4 --"p:statement/P6339"--> v5 subgraph optional2["(optional)"] style optional2 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P580".-> v6 end subgraph optional3["(optional)"] style optional3 fill:#bbf,stroke-dasharray: 5 5; v4 -."p:qualifier/P582".-> v7 end end subgraph optional4["(optional)"] style optional4 fill:#bbf,stroke-dasharray: 5 5; v2 -."p:P6339".-> v8 v8 --"p:statement/P6339"--> c17 v8 --"p:statement/P6339"--> v9 subgraph optional5["(optional)"] style optional5 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:qualifier/P580".-> v10 end subgraph optional6["(optional)"] style optional6 fill:#bbf,stroke-dasharray: 5 5; v8 -."p:qualifier/P582".-> v11 end end