From 5ca8a94d02ea9523b7bb35a4fe85f312cf7f93db Mon Sep 17 00:00:00 2001 From: Egon Willighagen Date: Sun, 17 Nov 2024 10:32:24 +0100 Subject: [PATCH] Added a Scholia example --- examples/Scholia/001.ttl | 105 ++++++++++++++++++++++++++++++++++ examples/Scholia/prefixes.ttl | 13 +++++ 2 files changed, 118 insertions(+) create mode 100644 examples/Scholia/001.ttl create mode 100644 examples/Scholia/prefixes.ttl diff --git a/examples/Scholia/001.ttl b/examples/Scholia/001.ttl new file mode 100644 index 000000000..ef1259ad4 --- /dev/null +++ b/examples/Scholia/001.ttl @@ -0,0 +1,105 @@ +@prefix q: . +@prefix dcterms: . +@prefix rdf: . +@prefix rdfs: . +@prefix schema: . +@prefix sh: . +@prefix scholia: . +@prefix scholiaAspect: . +@prefix wd: . +#@prefix scholiaView: . + +q:001 a sh:SPARQLExecutable, + sh:SPARQLSelectExecutable; + sh:select '''#defaultView:Timeline +PREFIX wd: +PREFIX wdt: +PREFIX p: +PREFIX pq: +PREFIX ps: + +PREFIX target: + +SELECT DISTINCT ?datetime ?description WHERE { + { + target: wdt:P577 ?datetime . + BIND("🌞 publication date" AS ?description) + } + UNION + { + target: wdt:P2507 / wdt:P577 ?datetime . + BIND("❗ erratum" AS ?description) + } + UNION + { + target: wdt:P5824 / wdt:P577 ?datetime . + BIND("⛔ retracted" AS ?description) + } + UNION + { + target: p:P793 ?event_statement . + ?event_statement ps:P793 ?event_type . + ?event_type rdfs:label ?description_ . + ?event_statement pq:P585 ?datetime . + FILTER (LANG(?description_) = "en") + + # Warning icon for retraction + BIND( + IF( + ?event_type = wd:Q45203135, + CONCAT("⛔ ", ?description_), + IF( + ?event_type = wd:Q56478588, + CONCAT("❓ ", ?description_), + ?description_ + ) + ) AS ?description) + } + UNION + { + SELECT ?datetime ?description WHERE { + target: wdt:P2860 / wdt:P577 ?datetime + BIND("📖➡️ cited work with earliest publication date" AS ?description) + } + ORDER BY ?datetime + LIMIT 1 + } + UNION + { + SELECT ?datetime ?description WHERE { + target: wdt:P2860 / wdt:P577 ?datetime + BIND("📖➡️ cited work with latest publication date" AS ?description) + } + ORDER BY DESC(?datetime) + LIMIT 1 + } + UNION + { + SELECT ?datetime ?description WHERE { + target: ^wdt:P2860 / wdt:P577 ?datetime + BIND("📖⬅️ citing work with earliest publication date" AS ?description) + } + ORDER BY ?datetime + LIMIT 1 + } + UNION + { + SELECT ?datetime ?description WHERE { + target: ^wdt:P2860 / wdt:P577 ?datetime + BIND("📖⬅️ citing work with latest publication date" AS ?description) + } + ORDER BY DESC(?datetime) + LIMIT 1 + } + UNION + { + target: (wdt:P747 | ^wdt:P629) / wdt:P577 ?datetime + BIND("🌞 Publication of edition" AS ?description) + } +}'''; + scholia:variable "{{ q }}" ; + scholia:aspect scholiaAspect:Work ; + scholia:aspectExample wd:Q28942417 ; + scholia:variableExample "Q28942417" ; + schema:target ; + dcterms:license . diff --git a/examples/Scholia/prefixes.ttl b/examples/Scholia/prefixes.ttl new file mode 100644 index 000000000..006e19845 --- /dev/null +++ b/examples/Scholia/prefixes.ttl @@ -0,0 +1,13 @@ +@prefix sh: . +@prefix xsd: . +@prefix owl: . +@prefix rdfs: . + +_:vhp4safety_sparql_examples_prefixes a owl:Ontology ; + rdfs:comment """This is a collection of Wikidata SPARQL prefixes that are needed for the examples for use on different websites.""" ; + owl:imports sh: ; + sh:declare [ sh:prefix "wd" ; sh:namespace "http://wikidata.org/entity/"^^xsd:anyURI ] ; + sh:declare [ sh:prefix "wdt" ; sh:namespace "http://wikidata.org/prop/direct/"^^xsd:anyURI ] ; + sh:declare [ sh:prefix "wikibase" ; sh:namespace "http://wikiba.se/ontology#"^^xsd:anyURI ] ; + sh:declare [ sh:prefix "bd" ; sh:namespace "http://www.bigdata.com/rdf#"^^xsd:anyURI ] ; + sh:declare [ sh:prefix "rdfs" ; sh:namespace "http://www.w3.org/1999/02/22-rdf-syntax-ns#"^^xsd:anyURI ] .