Courses/CGBV SS24/Graph: Difference between revisions

(→‎Resources: add query)
(added degree query)
(4 intermediate revisions by the same user not shown)
Line 28: Line 28:


== All Categories ==
== All Categories ==
Returns a graph with all '''included in''' the course.
Returns a graph with all categories '''included in''' the course.
See the query '''[https://tinyurl.com/yorv5zu2 here]'''
See the query '''[https://tinyurl.com/yorv5zu2 here]'''
== Indegrees ==
Returns a graph that uses the indegrees to size items. I.e. the size of a node depends on how many prerequisites it has.
{{#widget:SPARQLquery|code=
#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
?tCount
# ?category ?categoryLabel ?rgb3 ?shape3
WHERE {
  wd:Q932 wdt:P14/wdt:P14 ?topic.
  OPTIONAL { ?topic wdt:P1 ?dependency }
 
  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).
 
  # STYLING #
  BIND (if(?dCount = 0, "FFFFFF", # white
          if(?dCount = 1, "e6e6e6",
          if(?dCount = 2, "DFDFDF",
          if(?dCount = 3, "b3b3b3", 
          if(?dCount = 4, "9F9F9F",
          if(?dCount = 5, "808080",
          if(?dCount = 6,  "606060",
          if(?dCount = 7, "4d4d4d",
          if(?dCount = 8, "333333",
          if(?dCount = 9, "1919191",
          if(?dCount = 10, "202020", 
          if(?dCount > 10, "292929", 
      "FFFFFF" )))))))))))) as ?rgb1).
 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}}
<small> Nodes that aren't cicles are items, that are linked to course-items, but are themselves not included in the course.</small>


== Items ==
== Items ==
=== Orphans ===
<!-- Floated Table that contains both orphan queries(32.5em)-->
{| class="wikitable"
! '''Unlinked Items''' !! '''No dependencies'''
|-
<!-- Linke Spalte -->
| style="width: 50%" | {{#widget:SPARQLquery|code=
# All items that don't link to another item (no dependency)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel # ?dependency
WHERE {
  wd:Q932 wdt:P14/wdt:P14 ?item.
 
  MINUS {?dependency wdt:P1 ?item}. # Remove all items that have the ?source as a dependency
  MINUS {?item wdt:P1 ?dependency}. # Remove all ?source's that have a dependency
 
  service wikibase:label { bd:serviceParam wikibase:language "en" }
}
|caption=Items that don't depend on and aren't depended on
|height=25vh
}}
<!-- Rechte Spalte -->
| style="width: 50%" | {{#widget:SPARQLquery|code=
#defaultView:Table
# sources that don't -depend-on-> other item
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel # ?dependency
WHERE {
  wd:Q932 wdt:P14/wdt:P14 ?item.
  MINUS {?item wdt:P1 ?dependency.}
 
  service wikibase:label { bd:serviceParam wikibase:language "en" }
}
|caption=Items that don't depend on other items
|height=25vh
}}
|-
<!-- Linke Spalte -->
| [https://tinyurl.com/2aryewso Link to the query]
<!-- Rechte Spalte -->
| [https://tinyurl.com/2c2sm43y Link to the query]
|}
=== Resources ===
=== Resources ===
==== All Resources ====
Returns a table with all resources that are linked to from inside the course.
Returns a table with all resources that are linked to from inside the course.
{{#widget:SPARQLquery|code=
 
{{SPARQL2|query=
#defaultView:Table
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
Line 50: Line 144:
   service wikibase:label { bd:serviceParam wikibase:language "en" }
   service wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY ASC(?resourceLabel)
} ORDER BY ASC(?resourceLabel)
}}
==== Items without Resources ====
Returns a table with all items in the CGBV 24SS course, that don't link to a resource.
{{#widget:SPARQLquery|code=
#All CGBV-SS24 Items with no linked resources
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel ?resource ?resourceLabel
WHERE {
  wd:Q932 wdt:P14/wdt:P14 ?item. # select al course items
  MINUS {?item wdt:P21 ?resource.} # remove all with resources
 
  service wikibase:label { bd:serviceParam wikibase:language "en". }
}
}}
}}

Revision as of 09:04, 3 May 2024

Contains queries about the graph of the "CGBV SS24" course to help debug and structure it.

All Sessions

Returns a graph containing all sessions included in the course, as well as all included topics.
Warning: touch(): Utime failed: Permission denied in /var/www/html/extensions/Widgets/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php on line 178

All existing CGBV SS24 sessions with included topics

All Categories

Returns a graph with all categories included in the course. See the query here

Indegrees

Returns a graph that uses the indegrees to size items. I.e. the size of a node depends on how many prerequisites it has.

Nodes that aren't cicles are items, that are linked to course-items, but are themselves not included in the course.

Items

Orphans

Unlinked Items No dependencies

Items that don't depend on and aren't depended on

Items that don't depend on other items

Link to the query Link to the query

Resources

All Resources

Returns a table with all resources that are linked to from inside the course.

Items used: CGBV 24SS (Q932)

Properties used: includes (P14), resource (P21), url (P20), instance of (P3)

#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel ?resource ?resourceLabel ?alias ?url ?type ?typeLabel # ?resLabelLength 
WHERE {
  wd:Q932 wdt:P14/wdt:P14 ?item.
  ?item wdt:P21 ?resource.
  OPTIONAL {?resource wdt:P20 ?link.
            BIND("true" as ?url) }
  
  OPTIONAL {?resource wdt:P3 ?type.}
  OPTIONAL {?resource skos:altLabel ?alias.}

  service wikibase:label { bd:serviceParam wikibase:language "en" }
} ORDER BY ASC(?resourceLabel)

Try it!


Items without Resources

Returns a table with all items in the CGBV 24SS course, that don't link to a resource.
Warning: touch(): Utime failed: Permission denied in /var/www/html/extensions/Widgets/vendor/smarty/smarty/libs/sysplugins/smarty_template_compiled.php on line 178