Jump to content

Sandbox: Difference between revisions

Leonie (talk | contribs)
wpRunQuery
Leonie (talk | contribs)
added 2 course queries (for testing)
Line 1: Line 1:
== Linked RunQuery ==
== Course Query ==
{{#queryformlink:form=Learning Path|link text=Try running the query :D|link type=button|tooltip=This is a test}}
{{#widget:SPARQLquery|code=
#defaultView:Graph
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT distinct ?topic ?topicLabel ?rgb ?dependency ?dependencyLabel ?category ?categoryLabel
WHERE {
{
  # get all categories of the course
  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.
    }
  }
  }
  Union
  # get all dependencies of the topics
  { SELECT ?topic ?topicLabel ?dependency ?dependencyLabel WHERE {
    {
    ?topic wdt:P1 ?dependency. 
    }
  }
  }
  ?category wdt:P14 ?topic.
  ?topic wdt:P1 ?dependency.
 
  bind (if(?category = wd:Q472, "e8fcff", # (blue)  f3fdff
          if(?category = wd:Q473, "e3ffd9", # (green)
          if(?category = wd:Q474, "ffeec2", # (orange)
          if(?category = wd:Q475, "DCCDE0", # (purple)
          if(?category = wd:Q476, "F9DCDF", # (pink)
          if(?category = wd:Q477, "E7DEDA", # (brown)
          if(?category = wd:Q478,  "ECEDFF", # (lavender)
      "FFFFFF" ))))))) as ?rgb).
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
| caption=Query includes dependencies between items
}}


{{#widget:SPARQLquery|code=
#defaultView:Graph
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT distinct
?category ?categoryLabel ?topic ?topicLabel ?rgb
WHERE {
  BIND (wd:Q468 as ?course).
  ?course wdt:P14 ?category.
  Minus {?category wdt:P3 wd:Q427}
  BIND (rdf:type as ?id)
  ?category wdt:P14 ?topic.
 
  # Color coding
    bind (if(?category = wd:Q472, "e8fcff", # (blue)  f3fdff
          if(?category = wd:Q473, "e3ffd9", # (green)
          if(?category = wd:Q474, "ffeec2", # (orange)
          if(?category = wd:Q475, "DCCDE0", # (purple)
          if(?category = wd:Q476, "F9DCDF", # (pink)
          if(?category = wd:Q477, "E7DEDA", # (brown)
          if(?category = wd:Q478,  "ECEDFF", # (lavender)
      "FFFFFF" ))))))) as ?rgb).
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
| caption=Query shows the included items in a category
}}


{{#queryformlink:form=Learning Path|link text=Try running the query :D|link type=button|tooltip=This is a test|wpRunQuery=true}}


== Linked RunQuery ==
{{#queryformlink:form=Learning Path|link text=Try running the query :D|link type=button|tooltip=This is a test}}


Follow https://graphit.ur.de/wiki/Special:RunQuery/Learning_Path?Learning_Path[quiz]=Q444&_run for preloaded query
Follow https://graphit.ur.de/wiki/Special:RunQuery/Learning_Path?Learning_Path[quiz]=Q444&_run for preloaded query

Revision as of 15:13, 22 November 2023

Course Query

{{#widget:SPARQLquery|code=

  1. defaultView:Graph

PREFIX wd: <https://graphit.ur.de/entity/> PREFIX wdt: <https://graphit.ur.de/prop/direct/> SELECT distinct ?topic ?topicLabel ?rgb ?dependency ?dependencyLabel ?category ?categoryLabel WHERE { {

 # get all categories of the course
 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.
   }
 }
 }
 Union
 # get all dependencies of the topics
 { SELECT ?topic ?topicLabel ?dependency ?dependencyLabel WHERE {
   {
    ?topic wdt:P1 ?dependency.  
   } 
 }
 }
 ?category wdt:P14 ?topic.
 ?topic wdt:P1 ?dependency.
 
 bind (if(?category = wd:Q472, "e8fcff", # (blue)  f3fdff
         if(?category = wd:Q473, "e3ffd9", # (green) 
         if(?category = wd:Q474, "ffeec2", # (orange)
         if(?category = wd:Q475, "DCCDE0", # (purple) 
         if(?category = wd:Q476, "F9DCDF", # (pink)
         if(?category = wd:Q477, "E7DEDA", # (brown) 
         if(?category = wd:Q478,  "ECEDFF", # (lavender)
      "FFFFFF" ))))))) as ?rgb).
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} } | caption=Query includes dependencies between items }}

{{#widget:SPARQLquery|code=

  1. defaultView:Graph

PREFIX wd: <https://graphit.ur.de/entity/> PREFIX wdt: <https://graphit.ur.de/prop/direct/> SELECT distinct ?category ?categoryLabel ?topic ?topicLabel ?rgb WHERE {

 BIND (wd:Q468 as ?course). 
 ?course wdt:P14 ?category.
 Minus {?category wdt:P3 wd:Q427}
 BIND (rdf:type as ?id) 
 ?category wdt:P14 ?topic.
 
 # Color coding 
   bind (if(?category = wd:Q472, "e8fcff", # (blue)  f3fdff
         if(?category = wd:Q473, "e3ffd9", # (green) 
         if(?category = wd:Q474, "ffeec2", # (orange)
         if(?category = wd:Q475, "DCCDE0", # (purple) 
         if(?category = wd:Q476, "F9DCDF", # (pink)
         if(?category = wd:Q477, "E7DEDA", # (brown) 
         if(?category = wd:Q478,  "ECEDFF", # (lavender)
      "FFFFFF" ))))))) as ?rgb).
 
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} | caption=Query shows the included items in a category }}


Linked RunQuery

{{#queryformlink:form=Learning Path|link text=Try running the query :D|link type=button|tooltip=This is a test}}

Follow https://graphit.ur.de/wiki/Special:RunQuery/Learning_Path?Learning_Path[quiz]=Q444&_run for preloaded query


{{#queryformlink:form=Learning Path|query string=Learning_Path[quiz]=Q444&_run}}

Embedded RunQuery

Special:RunQuery/Learning Path2

Full Graph

Run this query to get the full graph Special:RunQuery/FullGraph