Sandbox: Difference between revisions

(→‎Personal Section: test alternative external data syntax)
 
(3 intermediate revisions by the same user not shown)
Line 129: Line 129:
== Personal Section ==
== Personal Section ==
(Test for EIMI)
(Test for EIMI)
<!--
{{#get_web_data:url=http://query.graphit.ur.de/proxy/wdqs/bigdata/namespace/wdq/sparql?query=%23defaultView%3ATable%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fgraphit.ur.de%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fgraphit.ur.de%2Fprop%2Fdirect%2F%3E%0ASELECT%20DISTINCT%20%3Fcompletions%20%3Fitems%20WHERE%20%7B%0A%20%20%20%20%20%20%0A%20%20%7B%20SELECT%20(COUNT%20(DISTINCT%20%3Fcomplete)%20AS%20%3Fcompletions)%20WHERE%20%7B%0A%20%20%20%20%3Fuser%20rdfs%3Alabel%20%22%7B%7B%23username%3AMax%20Mustermann%7D%7D%22%40en.%0A%20%20%20%20wd%3AQ2113%20wdt%3AP14%2Fwdt%3AP14%20%3Fcomplete.%0A%20%20%20%20%3Fuser%20wdt%3AP12%20%3Fcomplete.%0A%20%20%7D%7D%0A%20%20%0A%20%20%7B%20SELECT%20(COUNT%20(DISTINCT%20%3Fitem)%20AS%20%3Fitems)%20WHERE%20%7B%0A%20%20%20%20wd%3AQ2113%20wdt%3AP14%2Fwdt%3AP14%20%3Fitem.%0A%20%20%7D%20%7D%0A%20%20%20%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D&format=json
|format=json
|use jsonpath
|data=
completions=$.results.bindings[0].completions.value,
items=$.results.bindings[0].items.value,
}}
-->


{{#get_web_data:url=http://query.graphit.ur.de/proxy/wdqs/bigdata/namespace/wdq/sparql?query=%23defaultView%3ATable%0APREFIX%20wd%3A%20%3Chttps%3A%2F%2Fgraphit.ur.de%2Fentity%2F%3E%0APREFIX%20wdt%3A%20%3Chttps%3A%2F%2Fgraphit.ur.de%2Fprop%2Fdirect%2F%3E%0ASELECT%20DISTINCT%20%3Fcompletions%20%3Fitems%20WHERE%20%7B%0A%20%20%0A%20%20%7B%20SELECT%20(COUNT%20(DISTINCT%20%3Fcomplete)%20AS%20%3Fcompletions)%20WHERE%20%7B%0A%20%20%20%20%3Fuser%20rdfs%3Alabel%20%22%7B%7B%23username%3AMax%20Mustermann%7D%7D%22%40en.%0A%20%20%20%20wd%3AQ2113%20wdt%3AP14%2Fwdt%3AP14%20%3Fcomplete.%0A%20%20%20%20%3Fuser%20wdt%3AP12%20%3Fcomplete.%0A%20%20%7D%20%7D%0A%20%20%0A%20%20%7B%20SELECT%20(COUNT%20(DISTINCT%20%3Fitem)%20AS%20%3Fitems)%20WHERE%20%7B%0A%20%20%20%20wd%3AQ2113%20wdt%3AP14%2Fwdt%3AP14%20%3Fitem.%0A%20%20%7D%20%7D%0A%20%20%20%20%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22.%20%7D%0A%7D&format=json
{{#get_web_data:url=http://query.graphit.ur.de/proxy/wdqs/bigdata/namespace/wdq/sparql?query={{urlencode:PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT DISTINCT ?completions ?items WHERE { 
  { SELECT (COUNT (DISTINCT ?complete) AS ?completions) WHERE {
    ?user rdfs:label "{{#username:Max Mustermann}}"@en.
    wd:Q2113 wdt:P14/wdt:P14 ?complete.
    ?user wdt:P12 ?complete.
  } }
  { SELECT (COUNT (DISTINCT ?item) AS ?items) WHERE {
    wd:Q2113 wdt:P14/wdt:P14 ?item.
  } }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}}}&format=json
|format=json
|format=json
|use jsonpath
|use jsonpath
Line 137: Line 158:
items=$.results.bindings[0].items.value,
items=$.results.bindings[0].items.value,
}}
}}
Du ({{#username:Max Mustermann}}) hast '''{{#external_value:completions}}''' von {{#external_value:items}} Lerninhalten geschafft.
Du ({{#username:Max Mustermann}}) hast '''{{#external_value:completions}}''' von {{#external_value:items}} Lerninhalten geschafft.
<progress value="{{#external_value:completions}}" max="{{#external_value:items}}"> {{#external_value:completions}} </progress>
'''{{#external_value:completions}}''' / {{#external_value:items}} Lerninhalten


<progress value="{{#external_value:completions}}" max="{{#external_value:items}}"> {{#external_value:completions}} </progress>
{{#widget:Progressbar|value={{#external_value:completions}}|max={{#external_value:items}}|text={{#external_value:completions}} }}


{{#widget:SPARQLquery|code=
#defaultView:Timeline
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX p: <https://graphit.ur.de/prop/>
PREFIX ps: <https://graphit.ur.de/prop/statement/>
PREFIX pq: <https://graphit.ur.de/prop/qualifier/>
SELECT DISTINCT ?topic ?topicLabel ?image ?date WHERE {
  ?user rdfs:label "{{#username:Max Mustermann}}"@en.


  # filter by course
{{#widget:Progressbar|value=4|max=10|text=test}}
  BIND (wd:Q2113 as ?course)
  ?course wdt:P14/wdt:P14 ?topic.
 
  ?user p:P12 ?statement.
  ?statement ps:P12 ?topic.
  OPTIONAL {?statement pq:P19 ?date.}
  OPTIONAL {?topic wdt:P11 ?image.}
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
|caption=Timeline of all your ({{#username:Max Mustermann}}) completed items for EIMI 25/26 WS
}}





Latest revision as of 15:20, 3 November 2025


⚠️ A test text


Test
About this image


External Data

Info for Q654:

via: https://discoursedb.org/wiki/Wikidata_querying_demo



Anzahl Items: 2640

Course Query

Items used: Wissenschaftliches Arbeiten 23/24WS (Q468), Session (Q427), Instrumente und Methoden (Q472), Was ist Wissenschaft (Q473), Ablauf Bachelorarbeit (Q474), Statistik (Q475), Wissenschaftliches Schreiben (Q476), Studiendesign und -durchführung (Q477), Literaturrecherche (Q478)

Properties used: includes (P14), instance of (P3), depends on (P1)

#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". }
}
}

Try it!


Items used: Wissenschaftliches Arbeiten 23/24WS (Q468), Session (Q427), Instrumente und Methoden (Q472), Was ist Wissenschaft (Q473), Ablauf Bachelorarbeit (Q474), Statistik (Q475), Wissenschaftliches Schreiben (Q476), Studiendesign und -durchführung (Q477), Literaturrecherche (Q478)

Properties used: includes (P14), instance of (P3)

#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". }
}

Try it!



Linked RunQuery

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


Run query

Embedded RunQuery

Item:


Full Graph

Run this query to get the full graph


Personal Section

(Test for EIMI)


Du (Max Mustermann) hast 3 von 391 Lerninhalten geschafft. <progress value="3" max="391"> 3 </progress>

3 / 391 Lerninhalten



Items used: EIMI 25/26WS (Q2113), Session (Q427)

Properties used: includes (P14), instance of (P3), depends on (P1), has completed (P12)

#defaultView:Graph
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT distinct ?item ?itemLabel ?shape1 ?rgb1
?dependency ?dependencyLabel ?rgb2 ?shape2
WHERE {
  wd:Q2113 wdt:P14 ?session.
  ?session wdt:P3 wd:Q427.
  ?session wdt:P14 ?item.
  ?user rdfs:label "Max Mustermann"@en.
  
  OPTIONAL{
    ?item wdt:P1 ?dependency.
    ?session wdt:P14 ?dependency.     
    BIND (IF(EXISTS{?user wdt:P12 ?dependency}, "008F0E", "ffffff") as ?rgb2)
    BIND (IF(EXISTS{?user wdt:P12 ?dependency}, "dot", "ellipse") as ?shape2)
  }

  BIND (IF(EXISTS{?user wdt:P12 ?item}, "008F0E", "ffffff") as ?rgb1)
  BIND (IF(EXISTS{?user wdt:P12 ?item}, "dot", "ellipse") as ?shape1)
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} LIMIT 500

Try it!


Items used: EIMI 25/26WS (Q2113)

Properties used: includes (P14), depends on (P1), has completed (P12)

#defaultView:Graph
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT distinct 
?topic ?topicLabel ?rgb1 ?shape1
?dCount 
?dependency ?dependencyLabel ?rgb2 ?shape2
WHERE {
  # size the items according to their indegrees and mark all "completed" items of a user green
  
  ?user rdfs:label "Leonie"@en.

  { wd:Q2113 wdt:P14/wdt:P14 ?topic. 
    OPTIONAL { 
      ?topic wdt:P1 ?dependency 
      BIND (IF(EXISTS{?user wdt:P12 ?dependency}, "008F0E", "ffffff") as ?rgb2)
    }
  } UNION {
    # get all dependencies not directly included ( for sizing they need to be in the same column as ?topic ()
    wd:Q2113 wdt:P14/wdt:P14 ?item.
    ?item wdt:P1 ?topic.
    FILTER NOT EXISTS {  wd:Q2113 wdt:P14/wdt:P14 ?topic. } 
  }
     
  OPTIONAL {
    SELECT ?topic ?topicLabel (COUNT(DISTINCT ?pre) as ?dCount) WHERE {
      ?pre wdt:P1 ?topic.
    } GROUP BY ?topic ?topicLabel
  } # number of items that -depend-on-> ?topic 
  BIND(IF(!BOUND(?dCount), 0, ?dCount) as ?dCount).
  
  BIND (IF(EXISTS{?user wdt:P12 ?topic}, "008F0E", "ffffff") as ?rgb1)
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}

Try it!