query-f9f8db2915751802710d502adc0211e2

rq turtle/ttl

exemplo the uso de regexp, rank

Use at

PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX bd: <http://www.bigdata.com/rdf#>
SELECT ?item ?itemLabel ?value  ?rank
WHERE
{
    {
        SELECT ?item ?value ?rank
        WHERE
        {
            ?item p:P345 [ ps:P345 ?value; wikibase:rank ?rank ]
            FILTER( REGEX( STR( ?value ), "^(ch)\\d{7}$" )  ) .
            FILTER( ?rank != wikibase:DeprecatedRank ) 
            FILTER( ?item NOT IN ( wd:Q4115189, wd:Q13406268, wd:Q15397819 ) ) .
        } 
    } .
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" } .
}

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v1("?item"):::projected v2("?rank"):::projected v3("?value"):::projected a1((" ")) c10(["bd:serviceParam"]):::iri c12(["en"]):::literal f0[["?item != 'wd:Q4115189'?item != 'wd:Q13406268'?item != 'wd:Q15397819'"]] f0 --> v1 f1[["?rank != 'wikibase:DeprecatedRank'"]] f1 --> v2 f2[["regex(str(?value),'^(ch)\d{7}$')"]] f2 --> v3 a1 --"p:statement/P345"--> v3 a1 --"wikibase:rank"--> v2 v1 --"p:P345"--> a1 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c10 --"wikibase:language"--> c12 end