Wikidata:WikiProject Mineralogy/Queries

From Wikidata
Jump to navigation Jump to search

This is page that gathers useful and interesting queries.

Maintenance[edit]

# List all items that are a subclass of mineral and are missing a label in German
SELECT ?item ?itemLabel WHERE {
	?item wdt:P279* wd:Q7946 .
	filter not exists { ?item rdfs:label ?missinglabel filter (lang(?missinglabel) = "de") } .
  	SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
	}
}

Try it!

# List all items that are a subclass of mineral and are missing a picture statement
SELECT ?item ?itemLabel WHERE {
	?item wdt:P279* wd:Q7946 .
	filter not exists { ?item wdt:P18 ?x } .
  	SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
	}
}

Try it!

# List all items that are in the subclass-tree of mineral
SELECT ?item ?itemLabel WHERE {
	?item wdt:P279* wd:Q7946 .
  	SERVICE wikibase:label {
		bd:serviceParam wikibase:language "en" .
	}
}

Try it!

#Author name strings 
SELECT ?item ?itemLabel
{
  ?item wdt:P2093 "Jane Doe" .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Try it!

Example, gadolinite-(Ce): cerium dominant analogue of gadolinite-(Y); translates to 'named after', cerium, gadolinite-REE, 'mineral series'.

# List all items that have a named after (P138) mineral series (Q24241569)
SELECT ?item ?itemLabel (GROUP_CONCAT(?namedAfterItemLabel; separator=', ') AS ?namedAfter) WHERE {
  ?item wdt:P138 wd:Q24241569; wdt:P138 ?namedAfterItem .
  OPTIONAL {
    ?namedAfterItem rdfs:label ?namedAfterItemLabel .
    FILTER(LANG(?namedAfterItemLabel) = 'en') .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?item ?itemLabel

Try it!

Notes: Mineralogical Society of America (MSA), Handbook of Mineralogy (HOM) and mindat.org are avoided as reference. It is assumed that the description of the type specimen cites the naming rationale and if it is untrue then it is the 'type locality' (the only name cited in the description in this case). One exception is suhailite: Andalusia has old names of arabic origin and Suhail is the old arabic name for Fuengirola. Another exception is the Chinese literature before Deng Xiaoping: 'type localities' and so 'naming localities' were considered state secrets. Reference, before 1896: A Dictionary of the Names of Minerals.

# List all items that have a named after (P138) naming locality (Q22815296)
SELECT ?item ?itemLabel (GROUP_CONCAT(?namedAfterItemLabel; separator=', ') AS ?namedAfter) WHERE {
  ?item wdt:P138 wd:Q22815296; wdt:P138 ?namedAfterItem .
  OPTIONAL {
    ?namedAfterItem rdfs:label ?namedAfterItemLabel .
    FILTER(LANG(?namedAfterItemLabel) = 'en') .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?item ?itemLabel

Try it!

# List all items that have a named after (P138) naming region (Q28837448)
SELECT ?item ?itemLabel (GROUP_CONCAT(?namedAfterItemLabel; separator=', ') AS ?namedAfter) WHERE {
  ?item wdt:P138 wd:Q28837448; wdt:P138 ?namedAfterItem .
  OPTIONAL {
    ?namedAfterItem rdfs:label ?namedAfterItemLabel .
    FILTER(LANG(?namedAfterItemLabel) = 'en') .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?item ?itemLabel

Try it!

# List all items that have a named after (P138) chemical composition (Q1263816)
SELECT ?item ?itemLabel (GROUP_CONCAT(?namedAfterItemLabel; separator=', ') AS ?namedAfter) WHERE {
  ?item wdt:P138 wd:Q1263816; wdt:P138 ?namedAfterItem .
  OPTIONAL {
    ?namedAfterItem rdfs:label ?namedAfterItemLabel .
    FILTER(LANG(?namedAfterItemLabel) = 'en') .
  }
  SERVICE wikibase:label { bd:serviceParam wikibase:language 'en' }
} GROUP BY ?item ?itemLabel

Try it!


# List all subject of: mineralogy AND species nova
SELECT ?item  WHERE {
   ?item wdt:P921 wd:Q83353 .
   ?item wdt:P921 wd:Q27652812 .
}

Try it!


# List all subject of: mineralogy AND type description
SELECT ?item  WHERE {
   ?item wdt:P921 wd:Q83353 .
   ?item wdt:P921 wd:Q56241591 .
}

Try it!


Type localities[edit]

Notes (list of show mines): most type localities are historical, past status. Meteorites were collected; Ivigtut cryolite deposit is empty (even the jetty and the dumps were sorted a second time); Mount Vesuvius is quiet, but volcanoes are waking up worldwide (2019-2024); Karnasurt underground mine (the Palitra pegmatite (7 by 1.5 m) was possibly removed); Michael Mine, Weiler/ Southern part (adit is inaccessible and the dump has been landscaped), Silbereckle mine/ Northern part (adit is visible); New Cliffe Hill granite quarry (the 'copper lode' and associated secondary mineralisation was removed in the late 1990's); the Crestmore quarries were used by the Riverside Portland Cement Company; Jacupiranga open pit mines apatite for agricultural use, it delivers calcareous rock for the cement production as well (it uses flotation as an enrichment step); Kintore opencut, Broken Hill South mine swallowed the old Kintore shaft, the Block 10 mine, almost the Central mine (Block 9) and a portion of the [Broken] Proprietary mine workings (Blocks 9-11); Block 14 opencut, Broken Hill swallowed much of the British mine (Blocks 15 & 16), and the Proprietary mine; Falun copper mine, Cap Garonne and Gonzen are museum mines; Tsumeb is only extracting specimens for mineral collectors; etc. On the other side, new mineral species can be found in San Juan Co., UT; wayneburnhamite was found in the Crestmore quarries and hitachiite was found in the Hitachi mine. Comercial viable ore and the source of new minerals (contact zones) are actually on different locations. The workload gets smaller by using a low resolution (sometimes up to county level; instead of up to mine level), the use of the MinDat database as reference was avoided since the 1st half of 2017. Caution: Glocker E F (1847) redefined the names rocksalt and halite (ancient Greek for rocksalt/ "Steinsalz"), Vauquelin L N (1798) redefined emerald and beryl, Scheele C W (1779) redefined molybdenite and graphite, etc.; these papers are not a full description of a type specimen from a type locality.


# List all items that have a type locality
select ?item ?itemLabel ?imaLabel ?locLabel where
{
  ?item wdt:P579 ?ima .
  ?item wdt:P2695 ?loc .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY ?item

Try it!

# Find all mineral type localities and sort them by most minerals defined
SELECT ?locality ?name (COUNT(DISTINCT ?mineral) AS ?count)
WHERE
{
    ?mineral wdt:P579 ?status .
    ?mineral wdt:P2695 ?locality .          # Where a locality statement exists
   
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en" .
        ?locality rdfs:label ?name
    }
}
GROUP BY ?locality ?name
ORDER BY DESC(?count)

Try it!

# Find all mineral type localities and which you can render as a map
SELECT ?locality ?name ?location
WHERE
{
    ?mineral wdt:P579 ?status .
    ?mineral wdt:P2695 ?locality .          # Where a locality statement exists
   
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en" .
        ?locality rdfs:label ?name
    }
     ?locality wdt:P625 ?location 
}
GROUP BY ?locality ?name ?location

Try it!

# Find all mineral type localities that are meteorites and sort them by defined minerals
SELECT ?locality ?name (COUNT(DISTINCT ?mineral) AS ?count)
WHERE
{
    ?mineral wdt:P579 ?status .
    ?mineral wdt:P2695 ?locality .    # Where a locality statement exists
    ?locality wdt:P31 ?thing .        # Where the locality is the instance of a thing (helper)
    ?thing wdt:279* wd:Q60186 .       # And the thing is in the subclass tree of meteorite (Should also work if p31 = iron meteorite for example)
  
    SERVICE wikibase:label {
        bd:serviceParam wikibase:language "en" .
        ?locality rdfs:label ?name
    }
}
GROUP BY ?locality ?name
ORDER BY DESC(?count)

Try it!

Showcase[edit]

#Minerals and their commons colors
#defaultView:Graph
SELECT DISTINCT ?mineral ?mineralLabel ?rgb ?color ?colorLabel
WHERE
{
  ?mineral wdt:P279* wd:Q7946 ;
           wdt:P462 ?color .
  ?color wdt:P465 ?rgb .
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}

Try it!