Template:CourseQuery: Difference between revisions
Appearance
created template |
update query to include categories |
||
| Line 3: | Line 3: | ||
PREFIX wd: <https://graphit.ur.de/entity/> | PREFIX wd: <https://graphit.ur.de/entity/> | ||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | PREFIX wdt: <https://graphit.ur.de/prop/direct/> | ||
SELECT distinct ?topic ?topicLabel ? | SELECT distinct ?dependency ?dependencyLabel ?topic ?topicLabel ?category ?categoryLabel ?rgb | ||
WHERE { | WHERE { | ||
{ | { | ||
BIND (wd: | BIND (wd:Q468 as ?course). | ||
?course wdt:P14 ?category. | ?course wdt:P14 ?category. | ||
Minus {?category wdt:P3 wd:Q427} | Minus {?category wdt:P3 wd:Q427} | ||
| Line 26: | Line 26: | ||
?topic wdt:P1 ?dependency. | ?topic wdt:P1 ?dependency. | ||
BIND(if(BOUND(?category), "FBBC74", "FFEDD8") as ?rgb). | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | ||
Revision as of 09:46, 22 November 2023
{{#widget:SPARQLquery|code=
- defaultView:Graph
PREFIX wd: <https://graphit.ur.de/entity/> PREFIX wdt: <https://graphit.ur.de/prop/direct/> SELECT distinct ?dependency ?dependencyLabel ?topic ?topicLabel ?category ?categoryLabel ?rgb WHERE { {
BIND (wd:Q468 as ?course).
?course wdt:P14 ?category.
Minus {?category wdt:P3 wd:Q427}
{ SELECT ?category ?categoryLabel ?topic ?topicLabel WHERE {
{
?category wdt:P14 ?topic.
BIND(?dependency as ?topic).
}
}
}
Union
{ SELECT ?topic ?topicLabel ?dependency ?dependencyLabel WHERE {
{
?topic wdt:P1 ?dependency.
}
}
}
?category wdt:P14 ?topic.
?topic wdt:P1 ?dependency.
BIND(if(BOUND(?category), "FBBC74", "FFEDD8") as ?rgb).
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} } | caption=All dependencies for the course Q468 }}
Usage
Simple:
{{CourseQuery|item=Q468}}
Use with PageForms:
{{Special:RunQuery/CourseQuery}}
or
{{#queryformlink:form=CourseQuery|link text=Run|link type=button|tooltip=All items and their links}}