Skip to content

Commit

Permalink
Added a CiTO example (Wikidata)
Browse files Browse the repository at this point in the history
  • Loading branch information
egonw committed Nov 17, 2024
1 parent 9f8902e commit fb2c386
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
32 changes: 32 additions & 0 deletions examples/Wikidata - CiTO/001.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
@prefix ex: <https://bigcat-um.github.io/sparql-examples/WikiPathways/> .
@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#> .

ex:001 a sh:SPARQLExecutable,
sh:SPARQLSelectExecutable ;
rdfs:comment "Lists journals that have CiTO citation intentions defined and returns the number of citation statements as well as the number of citing articles."@en ;
sh:prefixes _:sparql_examples_prefixes ;
sh:select """PREFIX wd: <https://compoundcloud.wikibase.cloud/entity/>
PREFIX wdt: <https://compoundcloud.wikibase.cloud/prop/direct/>
PREFIX wikibase: <http://wikiba.se/ontology#>
PREFIX bd: <http://www.bigdata.com/rdf#>
PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX p: <http://www.wikidata.org/prop/>
PREFIX ps: <http://www.wikidata.org/prop/statement/>
PREFIX pq: <http://www.wikidata.org/prop/qualifier/>
SELECT ?journal ?journalLabel (CONCAT("/venue/", SUBSTR(STR(?journal), 32), "#cito") AS ?journalUrl)
(COUNT(DISTINCT ?citationStatement) AS ?citations)
(COUNT(DISTINCT ?citingArticle) AS ?articles) WHERE {
?citingArticle p:P2860 ?citationStatement ;
wdt:P1433 ?journal .
?citationStatement pq:P3712 ?intention ;
ps:P2860 ?citedArticle .
?intention wdt:P31 wd:Q96471816 .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],mul,en". }
} GROUP BY ?journal ?journalLabel
ORDER BY DESC(?citations)""" ;
schema:target <https://query.wikidata.org/sparql> ;
schema:keywords "journal", "CiTO", "citation" .
13 changes: 13 additions & 0 deletions examples/Wikidata - CiTO/prefixes.ttl
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 ] .

0 comments on commit fb2c386

Please sign in to comment.