lubianat / ideas

A dumping ground for halfbaked ideas, some of which will hopefully be worked on soon (based on https://github.com/Daniel-Mietchen/ideas)
Creative Commons Zero v1.0 Universal
1 stars 0 forks source link

Wikidata analyzer portal for the props used for a type of thing (e.g. P279* celll) #141

Open lubianat opened 4 weeks ago

lubianat commented 4 weeks ago

A query like

SELECT ?prop_base ?prop_baseLabel (COUNT(?value) AS ?valueCount)
WHERE {
  # Find subclasses of 'cell' (Q7868)
  ?subclass wdt:P279* wd:Q7868 .

  # Retrieve the properties used in these subclasses
  ?subclass ?property ?value .

  ?prop_base wikibase:directClaim ?property .

  # Filter out properties specific to instances
  FILTER(STRSTARTS(STR(?property), "http://www.wikidata.org/prop/direct/")) .

  # Get the data type of the property
  ?prop_base wikibase:propertyType ?propertyType .

  # Exclude properties where the data type is external identifier
  FILTER(?propertyType != wikibase:ExternalId) .
  # Some IDs have other data types for legacy issues
  MINUS {
    ?prop_base wdt:P31 wd:Q19847637 .
  }

  # Get the labels for properties
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?prop_base ?prop_baseLabel
ORDER BY DESC(?valueCount)

But where you can click each property and get the statements using it.

lubianat commented 4 weeks ago

Input of the user should just be the type or the root of the P279* tree or a query that gets the items to be analyzed.