Daniel-Mietchen / ideas

A dumping ground for halfbaked ideas, some of which will hopefully be worked on soon
Other
25 stars 6 forks source link

Think about how to link values in Wikidata statements with the corresponding numbers #742

Open Daniel-Mietchen opened 6 years ago

Daniel-Mietchen commented 6 years ago

Not sure this makes sense for all numbers, but at least for some integers that already have a Wikidata item, it seems reasonable to consider keeping track of these values somehow bu linking them to the corresponding Wikidata item of that number.

For instance, this query

SELECT ?item ?itemLabel ?property ?propertyLabel WHERE {
   ?item ?property "1024".
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

currently yields 1067 results for statements with the value "1024", which could be tied to the entry Q849003 for the decimal number 1024.

Example result: The Dom Płócienników in Lubomierz has the Polish cultural heritage register number 1024.

Daniel-Mietchen commented 6 years ago

To get an idea which numbers would be good for experimentation in this area, I tried to sort numbers by how often they appears as values in statements but didn't get to anything useful, so I requested help.

Daniel-Mietchen commented 6 years ago

Here's a query that came out of this help thread:

SELECT ?numberItem ?type ?value (COUNT(*) AS ?cnt) WITH {
  SELECT ?numberItem ?type ?value WHERE {
    ?numberItem wdt:P31/wdt:P279 wd:Q12503; p:P1181/psv:P1181/wikibase:quantityAmount ?numericalValue .
    FILTER(?numericalValue > 9000) . # optional to prevent timeouts
#depending on the statement data type, un-comment one of the four following lines. You may have to adjust the FILTER value above to yield results.
    BIND(?numericalValue AS ?value) . BIND(wikibase:Quantity AS ?type) . # numerical data type properties
#    BIND(STR(?numericalValue) AS ?value) . BIND(wikibase:String AS ?type) . # string data type properties
#    BIND(STR(?numericalValue) AS ?value) . BIND(wikibase:ExternalId AS ?type) . # external-id data type properties; technically also plain strings
#    BIND(STRLANG(STR(?numericalValue), 'en') AS ?value) . BIND(wikibase:Monolingualtext AS ?type) . # monolingualtext data type properties for language code 'en'
  }
} AS %subquery WHERE {
  INCLUDE %subquery .
  ?type ^wikibase:propertyType/wikibase:directClaim ?wdt .
  [] ?wdt ?value .
} GROUP BY ?numberItem ?type ?value HAVING (?cnt > 10)