Bureaucrats, emailconfirmed, Administrators
272
edits
GreenReaper (talk | contribs) (+description (and warning); add order by for first example) |
GreenReaper (talk | contribs) m (→Convention instances, including postponements: switch to universal wfd prefix) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
These [[wikipedia:SPARQL|SPARQL]] queries [//furry. | These [[wikipedia:SPARQL|SPARQL]] queries [//furry.wikibase.cloud/query/ can be used] in the local [[wikidata:Wikidata:SPARQL query service|Query Service]]. See [[wikidata:Wikidata:SPARQL tutorial|Wikidata's tutorial]] for an overview. The custom prefix declarations are required, and do not autocomplete (<code>wd:</code> does, but actually queries Wikidata). | ||
==Conventions== | ==Conventions== | ||
===Convention series with data and logo URL=== | ===Convention series with data and logo URL=== | ||
<SPARQL> | <SPARQL> | ||
PREFIX wfd: < | PREFIX wfd: <https://furry.wikibase.cloud/entity/> | ||
PREFIX wfdt: < | PREFIX wfdt: <https://furry.wikibase.cloud/prop/direct/> | ||
SELECT ?itemLabel ?creationDate (CONCAT("https://en.wikifur.com/w/images/", substr(?logoMD5, 1, 1), "/", substr(?logoMD5, 1, 2), "/", ?logoFileName) AS ?logoURL) | SELECT ?itemLabel ?creationDate (CONCAT("https://en.wikifur.com/w/images/", substr(?logoMD5, 1, 1), "/", substr(?logoMD5, 1, 2), "/", ?logoFileName) AS ?logoURL) | ||
Line 23: | Line 23: | ||
===Convention instances, including postponements=== | ===Convention instances, including postponements=== | ||
<SPARQL> | <SPARQL> | ||
PREFIX wfd: < | PREFIX wfd: <https://furry.wikibase.cloud/entity/> | ||
PREFIX wfdt: < | PREFIX wfdt: <https://furry.wikibase.cloud/prop/direct/> | ||
PREFIX | PREFIX wfdp: <https://furry.wikibase.cloud/prop/> | ||
PREFIX | PREFIX wfdps: <https://furry.wikibase.cloud/prop/statement/> | ||
PREFIX | PREFIX wfdpq: <https://furry.wikibase.cloud/prop/qualifier/> | ||
SELECT ?eventInstanceLabel ?eventStart ?eventEnd ?eventRank ?eventSeriesLabel | SELECT ?eventInstanceLabel ?eventStart ?eventEnd ?eventRank ?eventSeriesLabel | ||
WHERE | WHERE | ||
Line 37: | Line 37: | ||
# duplicate for each start time property | # duplicate for each start time property | ||
# (not wfdt: to get single eventStart) | # (not wfdt: to get single eventStart) | ||
wfdp:P6 ?eventStartProp. | |||
# populate start time for the row with this property | # populate start time for the row with this property | ||
?eventStartProp | ?eventStartProp wfdps:P6 ?eventStart. | ||
# normal or deprecated (rescheduled/cancelled) | # normal or deprecated (rescheduled/cancelled) | ||
?eventStartProp wikibase:rank ?eventRank. | ?eventStartProp wikibase:rank ?eventRank. | ||
# grab end time as qualifier if present (else, one-day event) | # grab end time as qualifier if present (else, one-day event) | ||
OPTIONAL {?eventStartProp | OPTIONAL {?eventStartProp wfdpq:P7 ?eventEnd} | ||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | ||
} | } | ||
ORDER BY DESC(?eventInstanceLabel) DESC(?eventStart) DESC(?eventRank) | ORDER BY DESC(?eventInstanceLabel) DESC(?eventStart) DESC(?eventRank) | ||
</SPARQL> | </SPARQL> |