query-f616d3c5b04ef5f0311abeee92af7134

rq turtle/ttl

Classe ELECCIONS amb P580, mostrant P582 i P585 SELECT distinct ?eleccions ?eleccionsLabel ?igual_1 ?p585_edited ?p585pr ?p580_edited ?p580pr ?p582_edited ?p582pr ?igual_2 WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } ?eleccions (wdt:P31/(wdt:P279*)) wd:Q18669875; wdt:P580 ?data_d_inici.

OPTIONAL { ?eleccions p:P585 ?p585_statement . ?p585_statement psv:P585 ?p585_value . ?p585_value wikibase:timeValue ?p585 . ?p585_value wikibase:timePrecision ?p585_precision . BIND (COALESCE( IF(?p585_precision = 11, CONCAT(STR(DAY(?p585)), "-", STR(MONTH(?p585)), "-", STR(YEAR(?p585))), 1/0), IF(?p585_precision = 10, CONCAT(STR(MONTH(?p585)), "-", STR(YEAR(?p585))), 1/0), IF(?p585_precision = 9, STR(YEAR(?p585)), 1/0), IF(?p585_precision = 8, CONCAT(STR(FLOOR(YEAR(?p585)/10)*10), "s"), 1/0), IF(?p585_precision = 7, CONCAT(STR(FLOOR((YEAR(?p585)+99)/100)), " century"), 1/0), IF(?p585_precision = 6, CONCAT(STR(FLOOR((YEAR(?p585)+999)/1000)), " milleium"), 1/0), "Unhandled precision" ) AS ?p585_edited) BIND ( IF(?p585_precision = 11, "","prec" ) AS ?p585pr)

        }

OPTIONAL { ?eleccions p:P582 ?p582_statement . ?p582_statement psv:P582 ?p582_value . ?p582_value wikibase:timeValue ?p582 . ?p582_value wikibase:timePrecision ?p582_precision . BIND (COALESCE( IF(?p582_precision = 11, CONCAT(STR(DAY(?p582)), "-", STR(MONTH(?p582)), "-", STR(YEAR(?p582))), 1/0), IF(?p582_precision = 10, CONCAT(STR(MONTH(?p582)), "-", STR(YEAR(?p582))), 1/0), IF(?p582_precision = 9, STR(YEAR(?p582)), 1/0), IF(?p582_precision = 8, CONCAT(STR(FLOOR(YEAR(?p582)/10)*10), "s"), 1/0), IF(?p582_precision = 7, CONCAT(STR(FLOOR((YEAR(?p582)+99)/100)), " century"), 1/0), IF(?p582_precision = 6, CONCAT(STR(FLOOR((YEAR(?p582)+999)/1000)), " milleium"), 1/0), "Unhandled precision" ) AS ?p582_edited) BIND ( IF(?p582_precision = 11, "","prec" ) AS ?p582pr)

        }

?eleccions p:P580 ?p580_statement . ?p580_statement psv:P580 ?p580_value . ?p580_value wikibase:timeValue ?p580 . ?p580_value wikibase:timePrecision ?p580_precision . BIND (COALESCE( IF(?p580_precision = 11, CONCAT(STR(DAY(?p580)), "-", STR(MONTH(?p580)), "-", STR(YEAR(?p580))), 1/0), IF(?p580_precision = 10, CONCAT(STR(MONTH(?p580)), "-", STR(YEAR(?p580))), 1/0), IF(?p580_precision = 9, STR(YEAR(?p580)), 1/0), IF(?p580_precision = 8, CONCAT(STR(FLOOR(YEAR(?p580)/10)*10), "s"), 1/0), IF(?p580_precision = 7, CONCAT(STR(FLOOR((YEAR(?p580)+99)/100)), " century"), 1/0), IF(?p580_precision = 6, CONCAT(STR(FLOOR((YEAR(?p580)+999)/1000)), " milleium"), 1/0), "Unhandled precision" ) AS ?p580_edited) BIND ( IF(?p580_precision = 11, "","prec" ) AS ?p580pr)

BIND ( IF(?p580_edited = ?p585_edited, "data=inici", IF(?p582_edited = ?p585_edited, "data=final","" )) AS ?igual_1) BIND ( IF(?p580_edited = ?p582_edited, "inici=final","" ) AS ?igual_2)

} LIMIT 900

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX psv: <http://www.wikidata.org/prop/statement/value/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#Classe ELECCIONS amb P580, mostrant P582 i P585
SELECT distinct ?eleccions ?eleccionsLabel ?igual_1
?p585_edited ?p585pr
?p580_edited ?p580pr
?p582_edited ?p582pr ?igual_2
 WHERE {
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
  ?eleccions (wdt:P31/(wdt:P279*)) wd:Q18669875;
    wdt:P580 ?data_d_inici.

 OPTIONAL { ?eleccions p:P585 ?p585_statement .
  ?p585_statement psv:P585 ?p585_value .
  ?p585_value wikibase:timeValue ?p585 .
  ?p585_value wikibase:timePrecision ?p585_precision .
  BIND (COALESCE(
    IF(?p585_precision = 11, CONCAT(STR(DAY(?p585)), "-", STR(MONTH(?p585)), "-", STR(YEAR(?p585))), 1/0),
    IF(?p585_precision = 10, CONCAT(STR(MONTH(?p585)), "-", STR(YEAR(?p585))), 1/0),
    IF(?p585_precision =  9, STR(YEAR(?p585)), 1/0),
    IF(?p585_precision =  8, CONCAT(STR(FLOOR(YEAR(?p585)/10)*10), "s"), 1/0),
    IF(?p585_precision =  7, CONCAT(STR(FLOOR((YEAR(?p585)+99)/100)), " century"), 1/0),
    IF(?p585_precision =  6, CONCAT(STR(FLOOR((YEAR(?p585)+999)/1000)), " milleium"), 1/0),
    "Unhandled precision"
    ) AS ?p585_edited)
            BIND (
IF(?p585_precision = 11,
 "","prec"
    ) AS ?p585pr)

            }

 OPTIONAL { ?eleccions p:P582 ?p582_statement .
  ?p582_statement psv:P582 ?p582_value .
  ?p582_value wikibase:timeValue ?p582 .
  ?p582_value wikibase:timePrecision ?p582_precision .
  BIND (COALESCE(
    IF(?p582_precision = 11, CONCAT(STR(DAY(?p582)), "-", STR(MONTH(?p582)), "-", STR(YEAR(?p582))), 1/0),
    IF(?p582_precision = 10, CONCAT(STR(MONTH(?p582)), "-", STR(YEAR(?p582))), 1/0),
    IF(?p582_precision =  9, STR(YEAR(?p582)), 1/0),
    IF(?p582_precision =  8, CONCAT(STR(FLOOR(YEAR(?p582)/10)*10), "s"), 1/0),
    IF(?p582_precision =  7, CONCAT(STR(FLOOR((YEAR(?p582)+99)/100)), " century"), 1/0),
    IF(?p582_precision =  6, CONCAT(STR(FLOOR((YEAR(?p582)+999)/1000)), " milleium"), 1/0),
    "Unhandled precision"
    ) AS ?p582_edited)
            BIND (
IF(?p582_precision = 11,
 "","prec"
    ) AS ?p582pr)

            }
   ?eleccions p:P580 ?p580_statement .
  ?p580_statement psv:P580 ?p580_value .
  ?p580_value wikibase:timeValue ?p580 .
  ?p580_value wikibase:timePrecision ?p580_precision .
  BIND (COALESCE(
    IF(?p580_precision = 11, CONCAT(STR(DAY(?p580)), "-", STR(MONTH(?p580)), "-", STR(YEAR(?p580))), 1/0),
    IF(?p580_precision = 10, CONCAT(STR(MONTH(?p580)), "-", STR(YEAR(?p580))), 1/0),
    IF(?p580_precision =  9, STR(YEAR(?p580)), 1/0),
    IF(?p580_precision =  8, CONCAT(STR(FLOOR(YEAR(?p580)/10)*10), "s"), 1/0),
    IF(?p580_precision =  7, CONCAT(STR(FLOOR((YEAR(?p580)+99)/100)), " century"), 1/0),
    IF(?p580_precision =  6, CONCAT(STR(FLOOR((YEAR(?p580)+999)/1000)), " milleium"), 1/0),
    "Unhandled precision"
    ) AS ?p580_edited)
BIND (
IF(?p580_precision = 11,
 "","prec"
    ) AS ?p580pr)

BIND (
IF(?p580_edited = ?p585_edited, "data=inici",
IF(?p582_edited = ?p585_edited, "data=final",""
    )) AS ?igual_1)
BIND (
IF(?p580_edited = ?p582_edited,
 "inici=final",""
    ) AS ?igual_2)

}
LIMIT 900

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v2("?data_d_inici") v1("?eleccions"):::projected v21("?igual_1"):::projected v22("?igual_2"):::projected v17("?p580") v19("?p580_edited"):::projected v18("?p580_precision") v15("?p580_statement") v16("?p580_value") v20("?p580pr"):::projected v11("?p582") v13("?p582_edited"):::projected v12("?p582_precision") v9("?p582_statement") v10("?p582_value") v14("?p582pr"):::projected v5("?p585") v7("?p585_edited"):::projected v6("?p585_precision") v3("?p585_statement") v4("?p585_value") v8("?p585pr"):::projected a1((" ")) c7(["wd:Q18669875"]):::iri c2(["bd:serviceParam"]):::iri c4(["#91;AUTO_LANGUAGE#93;,en"]):::literal subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c2 --"wikibase:language"--> c4 end v1 --"p:direct/P31"--> a1 a1 --"p:direct/P279"--> c7 v1 --"p:direct/P580"--> v2 subgraph optional0["(optional)"] style optional0 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P585".-> v3 v3 --"p:statement/value/P585"--> v4 v4 --"wikibase:timeValue"--> v5 v4 --"wikibase:timePrecision"--> v6 bind0[/"if(?p585_precision = '11^^xsd:integer',concat(str(day-from-dateTime(?p585)),'-',str(month-from-dateTime(?p585)),'-',str(year-from-dateTime(?p585))),'1^^xsd:integer' / '0^^xsd:integer')if(?p585_precision = '10^^xsd:integer',concat(str(month-from-dateTime(?p585)),'-',str(year-from-dateTime(?p585))),'1^^xsd:integer' / '0^^xsd:integer')if(?p585_precision = '9^^xsd:integer',str(year-from-dateTime(?p585)),'1^^xsd:integer' / '0^^xsd:integer')if(?p585_precision = '8^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p585) / '10^^xsd:integer') * '10^^xsd:integer'),'s'),'1^^xsd:integer' / '0^^xsd:integer')if(?p585_precision = '7^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p585) + '+99^^xsd:integer' / '100^^xsd:integer')),' century'),'1^^xsd:integer' / '0^^xsd:integer')if(?p585_precision = '6^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p585) + '+999^^xsd:integer' / '1000^^xsd:integer')),' milleium'),'1^^xsd:integer' / '0^^xsd:integer')'Unhandled precision'"/] v6 --o bind0 v5 --o bind0 bind0 --as--o v7 bind1[/"if(?p585_precision = '11^^xsd:integer','','prec')"/] v6 --o bind1 bind1 --as--o v8 end subgraph optional1["(optional)"] style optional1 fill:#bbf,stroke-dasharray: 5 5; v1 -."p:P582".-> v9 v9 --"p:statement/value/P582"--> v10 v10 --"wikibase:timeValue"--> v11 v10 --"wikibase:timePrecision"--> v12 bind2[/"if(?p582_precision = '11^^xsd:integer',concat(str(day-from-dateTime(?p582)),'-',str(month-from-dateTime(?p582)),'-',str(year-from-dateTime(?p582))),'1^^xsd:integer' / '0^^xsd:integer')if(?p582_precision = '10^^xsd:integer',concat(str(month-from-dateTime(?p582)),'-',str(year-from-dateTime(?p582))),'1^^xsd:integer' / '0^^xsd:integer')if(?p582_precision = '9^^xsd:integer',str(year-from-dateTime(?p582)),'1^^xsd:integer' / '0^^xsd:integer')if(?p582_precision = '8^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p582) / '10^^xsd:integer') * '10^^xsd:integer'),'s'),'1^^xsd:integer' / '0^^xsd:integer')if(?p582_precision = '7^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p582) + '+99^^xsd:integer' / '100^^xsd:integer')),' century'),'1^^xsd:integer' / '0^^xsd:integer')if(?p582_precision = '6^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p582) + '+999^^xsd:integer' / '1000^^xsd:integer')),' milleium'),'1^^xsd:integer' / '0^^xsd:integer')'Unhandled precision'"/] v12 --o bind2 v11 --o bind2 bind2 --as--o v13 bind3[/"if(?p582_precision = '11^^xsd:integer','','prec')"/] v12 --o bind3 bind3 --as--o v14 end v1 --"p:P580"--> v15 v15 --"p:statement/value/P580"--> v16 v16 --"wikibase:timeValue"--> v17 v16 --"wikibase:timePrecision"--> v18 bind4[/"if(?p580_precision = '11^^xsd:integer',concat(str(day-from-dateTime(?p580)),'-',str(month-from-dateTime(?p580)),'-',str(year-from-dateTime(?p580))),'1^^xsd:integer' / '0^^xsd:integer')if(?p580_precision = '10^^xsd:integer',concat(str(month-from-dateTime(?p580)),'-',str(year-from-dateTime(?p580))),'1^^xsd:integer' / '0^^xsd:integer')if(?p580_precision = '9^^xsd:integer',str(year-from-dateTime(?p580)),'1^^xsd:integer' / '0^^xsd:integer')if(?p580_precision = '8^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p580) / '10^^xsd:integer') * '10^^xsd:integer'),'s'),'1^^xsd:integer' / '0^^xsd:integer')if(?p580_precision = '7^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p580) + '+99^^xsd:integer' / '100^^xsd:integer')),' century'),'1^^xsd:integer' / '0^^xsd:integer')if(?p580_precision = '6^^xsd:integer',concat(str(numeric-floor(year-from-dateTime(?p580) + '+999^^xsd:integer' / '1000^^xsd:integer')),' milleium'),'1^^xsd:integer' / '0^^xsd:integer')'Unhandled precision'"/] v18 --o bind4 v17 --o bind4 bind4 --as--o v19 bind5[/"if(?p580_precision = '11^^xsd:integer','','prec')"/] v18 --o bind5 bind5 --as--o v20 bind6[/"if(?p580_edited = ?p585_edited,'data=inici',if(?p582_edited = ?p585_edited,'data=final',''))"/] v19 --o bind6 v7 --o bind6 v13 --o bind6 bind6 --as--o v21 bind7[/"if(?p580_edited = ?p582_edited,'inici=final','')"/] v19 --o bind7 v13 --o bind7 bind7 --as--o v22