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
2 changed files
with
118 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,105 @@ | ||
@prefix q: <https://github.com/WDScholia/scholia/scholia/app/templates/> . | ||
@prefix dcterms: <http://purl.org/dc/terms/> . | ||
@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:001 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 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 <https://query.wikidata.org/sparql> ; | ||
dcterms:license <https://www.gnu.org/licenses/gpl-3.0> . |
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,13 @@ | ||
@prefix sh: <http://www.w3.org/ns/shacl#> . | ||
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . | ||
@prefix owl: <http://www.w3.org/2002/07/owl#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
|
||
_: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 ] . |