query-706816f4d2e252b6af6e2a3094e3bb2f

rq turtle/ttl

properties by countryThis query plots the cumulative number of properties for each country as our set has developed. I'm hoping for help with the x-axis. At the moment I have to turn it into a hacky string (see the current "BIND"s), but it doesn't work if I switch them over to the simple integers I would expect to plot. Table view looks ok, but I want to make the lineChart work.

Use at

PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX wdt: <http://www.wikidata.org/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/>
PREFIX bd: <http://www.bigdata.com/rdf#>
#defaultView:LineChart
SELECT ?pid (COUNT(?property1) as ?count) ?countryLabel


    WHERE {
       {
      SELECT DISTINCT ?property ?pid (SAMPLE(?country) AS ?country) WHERE {
        ?property wdt:P31/wdt:P279* wd:Q18616576 .
        ?property wdt:P17 ?country .
        BIND (STR(10000+xsd:integer(SUBSTR(STR(?property),33,99))) AS ?pid)
        #BIND (xsd:integer(SUBSTR(STR(?property),33,99)) AS ?pid)
      }
      GROUP BY ?property ?pid
    }.
       {
      SELECT DISTINCT ?property1 ?pid1 ?country WHERE {
        ?property1 wdt:P31/wdt:P279* wd:Q18616576.
        ?property1 wdt:P17 ?country .
        BIND (STR(10000+xsd:integer(SUBSTR(STR(?property1),33,99))) AS ?pid1)
        #BIND (xsd:integer(SUBSTR(STR(?property1),33,99)) AS ?pid1)
      }
    }.
      FILTER(?pid1 < ?pid) .
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
    } 
  GROUP BY ?property ?pid ?countryLabel

Query found at

graph TD classDef projected fill:lightgreen; classDef literal fill:orange; classDef iri fill:yellow; v6("?count") v5("?country") v5("?pid"):::projected v6("?pid1") v3("?property") v5("?property1"):::projected a1((" ")) a2((" ")) c6(["bd:serviceParam"]):::iri c8(["#91;AUTO_LANGUAGE#93;"]):::literal c3(["wd:Q18616576"]):::iri f0[["?pid1 < ?pid"]] f0 --> v6 f0 --> v5 v3 --"wdt:P31"--> a1 a1 --"wdt:P279"--> c3 v3 --"wdt:P17"--> v5 bind1[/"str('10000^^xsd:integer' + http://www.w3.org/2001/XMLSchema#integer(substring(str(?property),'33^^xsd:integer','99^^xsd:integer')))"/] v3 --o bind1 bind1 --as--o v5 bind3[/"sample(?country)"/] v5 --o bind3 bind3 --as--o v5 v5 --"wdt:P31"--> a2 a2 --"wdt:P279"--> c3 v5 --"wdt:P17"--> v5 bind4[/"str('10000^^xsd:integer' + http://www.w3.org/2001/XMLSchema#integer(substring(str(?property1),'33^^xsd:integer','99^^xsd:integer')))"/] v5 --o bind4 bind4 --as--o v6 subgraph s1["http://wikiba.se/ontology#label"] style s1 stroke-width:4px; c6 --"wikibase:language"--> c8 end bind6[/"count(?property1)"/] v5 --o bind6 bind6 --as--o v6