Skip to content

Commit

Permalink
Added a second example
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Nov 17, 2024
1 parent d6229cd commit 8a78837
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions examples/Scholia/002.ttl
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" .

0 comments on commit 8a78837

Please sign in to comment.