Project:SPARQL/examples: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
<sparql tryit="1" list="1"> | <sparql tryit="1" list="1"> | ||
PREFIX wbt: <http://trex-taxonomy.wiki.opencura.com/prop/direct/> | |||
PREFIX wbt: <http:// | |||
SELECT | SELECT DISTINCT ?class ?classLabel (COUNT(?class) AS ?counts) WHERE { | ||
?item wbt:P1 ?class | ?item wbt:P1 ?class . | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} | } | ||
GROUP BY ?class ?classLabel | |||
</sparql> | |||
== Jeremy's visualization == | |||
<sparql tryit="1" list="1"> | |||
#defaultView:Dimensions | |||
PREFIX ps: <http://trex-taxonomy.wiki.opencura.com/prop/statement/> | |||
PREFIX p: <http://trex-taxonomy.wiki.opencura.com/prop/> | |||
PREFIX pr: <http://trex-taxonomy.wiki.opencura.com/prop/reference/> | |||
PREFIX wdt: <http://trex-taxonomy.wiki.opencura.com/prop/direct/> | |||
PREFIX wd: <http://trex-taxonomy.wiki.opencura.com/entity/> | |||
SELECT ?taxonLabel ?scientific_nameLabel ?authorityLabel ?doi ?year WHERE { | |||
?taxon wdt:P1 wd:Q19 ; | |||
wdt:P8 ?scientific_name . | |||
?specimen wdt:P1 wd:Q24 ; | |||
p:P8 [ | |||
ps:P8 ?scientific_name ; | |||
prov:wasDerivedFrom [ | |||
pr:P31 ?authority ; | |||
] | |||
] . | |||
?authority wdt:P7 ?date ; | |||
wdt:P19 ?doi . | |||
bind (str(year(?date)) as ?year) | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} ORDER BY ?year | |||
</sparql> | </sparql> |
Latest revision as of 10:32, 3 January 2021
Counts of classes
The following query uses these:
PREFIX wbt: <http://trex-taxonomy.wiki.opencura.com/prop/direct/>
SELECT DISTINCT ?class ?classLabel (COUNT(?class) AS ?counts) WHERE {
?item wbt:P1 ?class .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?class ?classLabel
Jeremy's visualization
The following query uses these:
#defaultView:Dimensions
PREFIX ps: <http://trex-taxonomy.wiki.opencura.com/prop/statement/>
PREFIX p: <http://trex-taxonomy.wiki.opencura.com/prop/>
PREFIX pr: <http://trex-taxonomy.wiki.opencura.com/prop/reference/>
PREFIX wdt: <http://trex-taxonomy.wiki.opencura.com/prop/direct/>
PREFIX wd: <http://trex-taxonomy.wiki.opencura.com/entity/>
SELECT ?taxonLabel ?scientific_nameLabel ?authorityLabel ?doi ?year WHERE {
?taxon wdt:P1 wd:Q19 ;
wdt:P8 ?scientific_name .
?specimen wdt:P1 wd:Q24 ;
p:P8 [
ps:P8 ?scientific_name ;
prov:wasDerivedFrom [
pr:P31 ?authority ;
]
] .
?authority wdt:P7 ?date ;
wdt:P19 ?doi .
bind (str(year(?date)) as ?year)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?year