forked from sib-swiss/sparql-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
71 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@prefix q: <https://bigcat-um.github.io/sparql-examples/Scholia/> . | ||
@prefix dcterms: <http://purl.org/dc/terms/> . | ||
@prefix dc: <http://purl.org/dc/elements/1.1/> . | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix schema: <https://schema.org/> . | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix scholia: <http://scholia.toolforge.org/ns/> . | ||
@prefix scholiaAspect: <http://scholia.toolforge.org/ns/aspect/> . | ||
@prefix wd: <http://wikidata.org/entity/> . | ||
#@prefix scholiaView: <http://scholia.toolforge.org/ns/view/> . | ||
|
||
q:002 a sh:SPARQLExecutable, | ||
sh:SPARQLSelectExecutable; | ||
sh:select '''#defaultView:Timeline | ||
PREFIX wd: <http://wikidata.org/entity/> | ||
PREFIX wdt: <http://www.wikidata.org/prop/direct/> | ||
PREFIX p: <http://www.wikidata.org/prop/> | ||
PREFIX pq: <http://www.wikidata.org/prop/qualifier/> | ||
PREFIX ps: <http://www.wikidata.org/prop/statement/> | ||
PREFIX target: <http://www.wikidata.org/entity/{{ q }}> | ||
SELECT | ||
(xsd:integer(?count_) AS ?count) | ||
(CONCAT("Total chemicals with ", ?description_) AS ?description) | ||
WHERE { | ||
BIND("haswbstatement:P31=Q113145171|P31=Q59199015" AS ?constraint) | ||
VALUES (?description_ ?property_query_term) { | ||
("or without stereochemistry" "") | ||
("fully defined stereochemistry" "P31=Q113145171") | ||
("undefined stereochemistry" "P31=Q59199015") | ||
("CAS registry number" "P231") | ||
("canonical SMILES" "P233") | ||
("InChI" "P234") | ||
("InChIKey" "P235") | ||
("chemical formula" "P274") | ||
("PubChem ID" "P662") | ||
("ChEBI ID" "P683") | ||
("found in taxon" "P703") | ||
("isomeric SMILES" "P2017") | ||
("crystal structure" "haswbstatement:P3636|P11375") | ||
("safety classification and labelling" "P4952") | ||
("mass spectrum" "haswbstatement:P4964|P6689|P12472") | ||
("NMR spectrum" "P9405") | ||
("pKa" "linksto:Property:P1117") | ||
("mass" "linksto:Property:P2067") | ||
("solubility" "linksto:Property:P2177") | ||
("melting point" "linksto:Property:P2101") | ||
("boiling point" "linksto:Property:P2102") | ||
("electric dipole moment" "linksto:Property:P2201") | ||
("ionization energy" "linksto:Property:P2260") | ||
} | ||
BIND(CONCAT(?property_query_term, " ", ?constraint) AS ?search_query) | ||
SERVICE wikibase:mwapi { | ||
bd:serviceParam wikibase:endpoint "www.wikidata.org" ; | ||
wikibase:api "Search" ; | ||
wikibase:limit "once" ; | ||
mwapi:srsearch ?search_query; | ||
mwapi:srlimit "1". | ||
?count_ wikibase:apiOutput "//searchinfo[1]/@totalhits". | ||
} | ||
} | ||
ORDER BY DESC(?count)'''; | ||
scholia:variable "{{ q }}" ; | ||
scholia:aspect scholiaAspect:Work ; | ||
scholia:aspectExample wd:Q28942417 ; | ||
scholia:variableExample "Q28942417" ; | ||
schema:target <https://query.wikidata.org/sparql> ; | ||
dcterms:license <https://www.gnu.org/licenses/gpl-3.0> ; | ||
dc:contributor "Egon Willighagen", "Adriano Rutz", "César Alfredo Uribe León" . |