Project:SPARQL/examples

From WikiFur Data
Revision as of 02:48, 17 April 2021 by GreenReaper (talk | contribs) (+Convention series with data and logo, Convention instances, including postponements)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Conventions

PREFIX wfd: <http://furry.wiki.opencura.com/entity/>
PREFIX wfdt: <http://furry.wiki.opencura.com/prop/direct/>

SELECT ?itemLabel ?creationDate (CONCAT("https://en.wikifur.com/w/images/", substr(?logoMD5, 1, 1), "/", substr(?logoMD5, 1, 2), "/", ?logoFileName) AS ?logoURL)
WHERE
{
    ?item wfdt:P2 wfd:Q2 .
    ?item wfdt:P6 ?creationDate .
    OPTIONAL {
      ?item wfdt:P15 ?logoFileName.
      BIND(MD5(?logoFileName) as ?logoMD5).
    }
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}


Convention instances, including postponements

PREFIX wfd: <http://furry.wiki.opencura.com/entity/>
PREFIX wfdt: <http://furry.wiki.opencura.com/prop/direct/>
PREFIX wfp: <http://furry.wiki.opencura.com/prop/>
PREFIX wfps: <http://furry.wiki.opencura.com/prop/statement/>
PREFIX wfpq: <http://furry.wiki.opencura.com/prop/qualifier/>
SELECT ?eventInstanceLabel ?eventStart ?eventEnd ?eventRank ?eventSeriesLabel 
WHERE 
{
  #                subclass of furcons
  ?eventSeries     wfdt:P2 wfd:Q2.
  #                instance of specific furcon
  ?eventInstance   wfdt:P1 ?eventSeries;
  #                duplicate for each start time property
  #                (not wfdt: to get single eventStart)
                   wfp:P6 ?eventStartProp.
  #                populate start time for the row with  this property
  ?eventStartProp  wfps:P6 ?eventStart.
  #                normal or deprecated (rescheduled/cancelled)
  ?eventStartProp  wikibase:rank ?eventRank.
  #                grab end time as qualifier if present (else, one-day event)
  OPTIONAL {?eventStartProp wfpq:P7 ?eventEnd}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
ORDER BY DESC(?eventInstanceLabel) DESC(?eventStart) DESC(?eventRank)