Courses/CGBV SS24/Graph: Difference between revisions
m →All Categories: fix typo |
→Items: add orphan query |
||
| Line 32: | Line 32: | ||
== Items == | == Items == | ||
=== Orphans === | |||
Returns all items included in the course, that don't depend on other items and aren't depended on by other items. | |||
{{#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 ?source ?sourceLabel ?dependency | |||
WHERE { | |||
wd:Q932 wdt:P14/wdt:P14 ?source. | |||
MINUS {?dependency wdt:P1 ?source}. # Remove all items that have the ?source as a dependency | |||
MINUS {?source wdt:P1 ?dependency}. # Remove all ?source's that have a dependency | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
=== Resources === | === Resources === | ||
==== All Resources ==== | ==== All Resources ==== | ||
Revision as of 07:21, 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. {{#widget:SPARQLquery|code=
- defaultView:Graph
PREFIX wdt: <https://graphit.ur.de/prop/direct/> PREFIX wd: <https://graphit.ur.de/entity/> select distinct ?session ?sessionLabel ?rgb ?shape ?date ?item ?itemLabel ?image # ?res ?resLabel where {
wd:Q932 wdt:P14 ?session.
?session wdt:P3 wd:Q427.
?session wdt:P19 ?date.
OPTIONAL {?session wdt:P14 ?item.
OPTIONAL {?item wdt:P11 ?image } }
# styling
BIND("ECEDFF" as ?rgb)
BIND("box" as ?shape)
service wikibase:label { bd:serviceParam wikibase:language "en".}
} |caption=All existing CGBV SS24 sessions with included topics }}
All Categories
Returns a graph with all categories included in the course. See the query here
Items
Orphans
Returns all items included in the course, that don't depend on other items and aren't depended on by other items. {{#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 ?source ?sourceLabel ?dependency WHERE {
wd:Q932 wdt:P14/wdt:P14 ?source.
MINUS {?dependency wdt:P1 ?source}. # Remove all items that have the ?source as a dependency
MINUS {?source wdt:P1 ?dependency}. # Remove all ?source's that have a dependency
service wikibase:label { bd:serviceParam wikibase:language "en" }
} }}
Resources
All Resources
Returns a table with all resources that are linked to from inside the course.
{{#if: CGBV 24SS (Q932) | Items used: CGBV 24SS (Q932) | }}
{{#if: includes (P14), resource (P21), url (P20), instance of (P3) | Properties used: includes (P14), resource (P21), url (P20), instance of (P3) | }}
{{#if:|
{{ safesubst:p{{ safesubst:#ifeq:|eq|1|2}}|{{ safesubst:p{{ safesubst:#ifeq:|
PREFIX p: <https://graphit.ur.de/prop/>|1|2}}||}}|{{ safesubst:p{{ safesubst:#if:|1|2}}|
PREFIX p: <https://graphit.ur.de/prop/>|}}}}{{ safesubst:p{{ safesubst:#ifeq:|eq|1|2}}|{{ safesubst:p{{ safesubst:#ifeq:|
PREFIX q: <https://graphit.ur.de/prop/qualifier/>|1|2}}||}}|{{ safesubst:p{{ safesubst:#if:|1|2}}|
PREFIX q: <https://graphit.ur.de/prop/qualifier/>|}}}}{{ safesubst:p{{ safesubst:#ifeq:|eq|1|2}}|{{ safesubst:p{{ safesubst:#ifeq:|
PREFIX v: <https://graphit.ur.de/prop/statement/>|1|2}}||}}|{{ safesubst:p{{ safesubst:#if:|1|2}}|
PREFIX v: <https://graphit.ur.de/prop/statement/>|}}}}{{ safesubst:p{{ safesubst:#ifeq:|eq|1|2}}|{{ safesubst:p{{ safesubst:#ifeq:|
|1|2}}||}}|{{ safesubst:p{{ safesubst:#if:|1|2}}|
|}}}}
}}#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)
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". }
} }}