wikidata-chemistry-curation

P592UniqueValue.rq

Code examples: curl

SPARQL

# Unique value constraint report for P592: report by value

SELECT
    ?value (SAMPLE(?ct) AS ?ct)
    (GROUP_CONCAT(DISTINCT(STRAFTER(STR(?item), "/entity/")); separator=", ") AS ?items)
    (GROUP_CONCAT(DISTINCT(?itemLabel); separator=", ") AS ?labels)
WHERE
{
  	{ 	SELECT ?value (COUNT(DISTINCT ?item) as ?ct)
  		WHERE
  		{
  			?item wdt:P592 ?value
		}
    	GROUP BY ?value HAVING (?ct>1)
    	ORDER BY DESC(?ct)
    	LIMIT 100
	}
  	?item wdt:P592 ?value .
	SERVICE wikibase:label {
    	bd:serviceParam wikibase:language "en, mul" .
    	?item rdfs:label ?itemLabel .
  	}
}
GROUP BY ?value
ORDER BY DESC(?ct)

Execute or Edit

Output

value ct items labels
CHEMBL521177 2 Q6469057, Q105287434 lactucin, 4-epi-lactucin
CHEMBL1206440 2 Q2130929, Q27124801 cyclamic acid, cyclamate
CHEMBL2303614 2 Q408014, Q74511001 chondroitin sulfate, (2S,3S,4S,5R,6S)-6-[[(2R,3R,4S,5R,6S)-3-Acetamido-2,6-bis(hydroxymethyl)-5-(sulfomethyl)oxan-4-yl]methoxymethyl]-4,5-dihydroxy-3-(hydroxymethyl)oxane-2-carboxylic acid
CHEMBL1433 2 Q422442, Q82982262 doxycycline, doxycycline tautomer
CHEMBL91 2 Q410534, Q75163056 miconazole, rac-miconazole
CHEMBL1201341 2 Q4352952, Q27077150 echothiophate
CHEMBL1201668 2 Q6997373, Q66360952 nesiritide, brain natriuretic peptide
CHEMBL2110884 2 Q27284343, Q76005793 cetocycline, cetocycline tautomer
CHEMBL1685065 2 Q27157614, Q82124319 1,2-dihexadecanoyl-sn-glycero-3-phospho-(1D-myo-inositol-3,4,5-trisphosphate)
CHEMBL1591 2 Q2736402, Q76728423 demeclocycline, (4S,4aS,5aS,6S,12aR)-7-chloro-4-(dimethylamino)-1,6,10,11,12a-pentahydroxy-3,12-dioxo-4a,5,5a,6-tetrahydro-4H-tetracene-2-carboxamide
CHEMBL1233322 2 Q27093187, Q106570944 2-amino-6-(hydroxymethyl)-7,8-dihydropteridin-4-ol, 6-Hydroxymethyl-7,8-dihydropterin
CHEMBL2008411 2 Q5629606, Q112931028 HHTDD, hexaazatricyclododecanedione
CHEMBL435170 2 Q4680659, Q113940477 adaprolol, deucravacitinib
CHEMBL268697 2 Q15409437, Q82913190 hemicholinium-3 dibromide, 2,2'-([1,1'-Biphenyl]-4,4'-diyl)bis(2-hydroxy-4,4-dimethylmorpholin-4-ium)
CHEMBL1201414 2 Q411198, Q20817252 tinzaparin sodium, tinzaparin

Code examples

curl

curl -o P592UniqueValue.rq https://raw.githubusercontent.com/egonw/SARS-CoV-2-Queries/master/sparql/P592UniqueValue.rq
curl -H "Accept: text/tab-separated-values" -G https://query.wikidata.org/bigdata/namespace/wdq/sparql --data-urlencode query@P592UniqueValue.rq

This SPARQL query is available under CCZero.