Template:Learning Path2: Difference between revisions
Appearance
→Usage: update with #queryformlink |
add border |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
<div style="border: solid 5px #d2d6e0; background-color:#eaecf0;"> | |||
{{#widget:SPARQLquery|code= | {{#widget:SPARQLquery|code= | ||
#defaultView:Graph | #defaultView:Graph | ||
| Line 13: | Line 14: | ||
?goal wdt:P1+ ?topic. | ?goal wdt:P1+ ?topic. | ||
} UNION { | } UNION { | ||
VALUES ?topic { wd:Q149 } # we also want to include the root node itself | VALUES ?topic { wd:{{{item|Q149}}} } # we also want to include the root node itself | ||
} | } | ||
| Line 49: | Line 50: | ||
} |caption=The direct learning path to {{{item|Q149}}} | } |caption=The direct learning path to {{{item|Q149}}} | ||
}} | }} | ||
</div> | |||
Latest revision as of 12:18, 9 April 2025
{{#widget:SPARQLquery|code=
- defaultView:Graph
- prerequisite -> topic -> postrequisite
PREFIX wd: <https://graphit.ur.de/entity/> PREFIX wdt: <https://graphit.ur.de/prop/direct/> SELECT distinct ?v ?vLabel ?rgb ?link ?linkLabel WHERE { {
{ SELECT * WHERE {
{ SELECT ?goal ?goalLabel ?topic ?topicLabel WHERE {
{
BIND (wd:Q149 as ?goal).
?goal wdt:P1+ ?topic.
} UNION {
VALUES ?topic { wd:Q149 } # we also want to include the root node itself
}
}
}
?topic wdt:P1 ?pre.
BIND (?topic as ?v). # + add all ?pre that are not yet in ?topic
BIND (?pre as ?link).
bind (if(?v = wd:Q149, "FBBC74", "FFEDD8") as ?rgb).
}
}
Union
{ SELECT * WHERE {
{ SELECT ?topic ?topicLabel ?goal ?goalLabel WHERE {
{
BIND (wd:Q149 as ?topic).
?goal wdt:P1+ ?topic.
} UNION {
VALUES ?topic { wd:Q149 } # we also want to include the root node itself
}
}
}
?post wdt:P1 ?topic.
BIND (?post as ?v).
BIND (?topic as ?link).
bind ("F68C13" as ?rgb).
}
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} } |caption=The direct learning path to Q149 }}
Usage
{{Learning Path2|item=Q149}}
To be used mostly using
{{Special:RunQuery/Learning Path2}}
or something like
{{#queryformlink:form=Learning Path|link text=Try running the query :D|link type=button|tooltip=This is a test}}