Template:Progress Graph
Appearance
{{#widget:SPARQLquery|code=
- defaultView:Graph
PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/>
- progress graph -> get all items in sessions + mark besprochen(using date) + completed
SELECT DISTINCT ?sessionDate ?today ?interest ?complete ?item ?itemLabel ?rgb1 ?shape1 ?link ?linkLabel ?rgb2 ?shape2 WHERE {
# get all items in all sessions of course
wd:Q468 wdt:P14 ?session. # use current
?session wdt:P3 wd:Q427.
?session wdt:P19 ?sessionDate.
?session wdt:P14 ?item.
?item wdt:P1 ?link. # get links between items
BIND(now() as ?today)
?user rdfs:label "{{#username:Max Mustermann}}"@en.
# STYLING
OPTIONAL { ?user wdt:P23 ?item. BIND("true" as ?interest) }
OPTIONAL { ?user wdt:P12 ?item.
?session wdt:P14 ?item. ?session wdt:P19 ?sessionDate.
BIND(IF(?sessionDate < now(), "past", "future") as ?complete) }
# --- color --- #
BIND( IF(BOUND(?complete) && ?complete = "past", "B9CEB6", # grey green if completed in past session
IF(BOUND(?complete) && ?complete = "future", "CBFDBB", # light green if completed in future session
IF(?sessionDate < ?today, "CCCCCC", "FFFFFF" ))) as ?rgb1) # grey if in past session
BIND( IF(BOUND(?complete) && ?complete = "past", "B9CEB6",
IF(BOUND(?complete) && ?complete = "future", "CBFDBB",
IF(?sessionDate < ?today, "CCCCCC", "FFFFFF" ))) as ?rgb2)
# --- shape --- #
BIND( IF(BOUND(?interest), "star", # star if interested
IF(?sessionDate < ?today, "ellipse", "box" )) as ?shape1) # box if in future session
BIND( IF(BOUND(?interest), "star",
IF(?sessionDate < ?today, "ellipse", "box" )) as ?shape2)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } | caption={{#username:Max Mustermann}}'s progress graph for Q468 }}
Usage
{{Progress Graph|course=Q468}}
Can also be included into a page using:
{{Special:RunQuery/Progress Graph}}
or something like
{{#queryformlink:form=ProgressGraph|link text=Try running the query :D|link type=button|tooltip=This is a test}}