DebugQueries: Difference between revisions
m (added: Orphans) |
m (→Item overlaps: fix link) |
||
(46 intermediate revisions by 2 users not shown) | |||
Line 2: | Line 2: | ||
__TOC__ | __TOC__ | ||
= Useful Queries = | |||
A List of accessible queries, that are useful to understand the structure of the graph and identify problems, such as missing links. They can be changed as needed. | |||
== Backlinks == | |||
'''A query that finds all backlinks to a specific item.''' | |||
{{SPARQL2|query= | |||
#defaultView:Graph | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?subject ?subjectLabel ?item ?itemLabel { # ?property ?propertyLabel | |||
values (?item) {(wd:Q108)} | |||
?subject ?predicate ?item . | |||
?property wikibase:directClaim ?predicate | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== Duplicates == | |||
Returns a list of items that have the exact same label. | |||
''Note: query might take a while.'' | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT ?i ?i2 | |||
WHERE { | |||
?i rdfs:label ?iLabel. # Select all item with labels | |||
?i2 rdfs:label ?i2Label. | |||
FILTER (str(?iLabel) = str(?i2Label)). # Only items with same label | |||
FILTER (?i != ?i2). | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== All Items == | |||
'''Returns a list of all items and how they are categorized in alphabetical order.''' In this case categories are all items that are used to structure the graph, such as [[Item:Q233|Article]] or [[Item:Q1|Markers]]. This list can help spot duplicates or similiar items. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel { | |||
?item ?predicate ?dependency. | |||
?property wikibase:directClaim ?predicate | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
order by asc(UCASE(str(?itemLabel))) | |||
}} | |||
== Language Labels == | |||
'''Returns the english or german labels for all items.''' | |||
Items should all have a english label and can have an optional german label. | |||
This query can also be used to check if items are missing labels in a language. ''See explanatory comments in query''. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT ?i ?label_en ?label_de | |||
WHERE { | |||
?i rdfs:label ?label. # Select all item with labels. | |||
OPTIONAL {?i rdfs:label ?label_en filter (lang(?label_en) = "en").} | |||
# Remove OPTIONAL here to get items with en label and optional de label | |||
OPTIONAL {?i rdfs:label ?label_de filter (lang(?label_de) = "de").} | |||
# Remove OPTIONAL here to get items with de label and optional en label | |||
} order by ?label_en | |||
}} | |||
---- | |||
= Missing Properties = | = Missing Properties = | ||
== No Resources == | == Resources == | ||
=== No Resources === | |||
'''Returns all Items, that don't have any [[Property:P21|resource]] that they link to.''' | '''Returns all Items, that don't have any [[Property:P21|resource]] that they link to.''' | ||
{{#widget:SPARQLquery|code= | {{#widget:SPARQLquery|code= | ||
#All Items with no linked resources | #All Items with no linked resources | ||
Line 13: | Line 88: | ||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | PREFIX wdt: <https://graphit.ur.de/prop/direct/> | ||
PREFIX wd: <https://graphit.ur.de/entity/> | PREFIX wd: <https://graphit.ur.de/entity/> | ||
SELECT ?source ?sourceLabel ?resource ?resourceLabel | SELECT DISTINCT ?source ?sourceLabel ?resource ?resourceLabel | ||
WHERE { | WHERE { | ||
# | # Select all items | ||
?source wdt:P1 ?dependency. | |||
?source wdt:P2 ?class. | ?source wdt:P2 ?class. | ||
MINUS {?source wdt:P21 ?resource. } | MINUS {?source wdt:P21 ?resource.} | ||
service wikibase:label { bd:serviceParam wikibase:language "en". } | |||
} | |||
}} | |||
=== Unlinked Resources === | |||
'''Returns all resources, that have not been linked to any item yet.''' | |||
{{#widget:SPARQLquery|code= | |||
#Resources that aren't linked | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT ?resource ?resourceLabel ?url ?type ?typeLabel | |||
WHERE { | |||
# select all resources (they have urls) | |||
?resource wdt:P20 ?url. # 151 | |||
MINUS { | |||
?dependency wdt:P21 ?resource. | |||
} | |||
MINUS {?resource rdfs:label "Resource"@en.} # rm the Dummy-Item Resource (Q446) | |||
OPTIONAL { ?resource wdt:P3 ?type } | |||
service wikibase:label { bd:serviceParam wikibase:language "en". } | service wikibase:label { bd:serviceParam wikibase:language "en". } | ||
Line 23: | Line 120: | ||
}} | }} | ||
- | === Instance-less Resources === | ||
'''Returns all Resources that have no Property [[Property:P3|instance of]].''' | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT ?resource ?resourceLabel ?instanceOf | |||
WHERE { | |||
?source wdt:P21 ?resource. | |||
MINUS {?resource wdt:P3 ?instanceOf} | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== No Subclass == | == No Subclass == | ||
'''Returns all Items, that don't have a property [[Property:P2|subclass]].''' | '''Returns all Items, that don't have a property [[Property:P2|subclass]].''' | ||
{{ | {{SPARQL2|query= | ||
#defaultView:Table | #defaultView:Table | ||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | PREFIX wdt: <https://graphit.ur.de/prop/direct/> | ||
PREFIX wd: <https://graphit.ur.de/entity/> | PREFIX wd: <https://graphit.ur.de/entity/> | ||
SELECT ?source ?sourceLabel ? | SELECT DISTINCT ?source ?sourceLabel ?subclass | ||
WHERE { | WHERE { | ||
?source wdt:P1 ?dependency. | ?source wdt:P1 ?dependency. | ||
Line 40: | Line 149: | ||
} | } | ||
}} | }} | ||
== No Dependencies == | == No Dependencies == | ||
'''Returns all Items, that don't link any other items as dependency.''' | '''Returns all Items, that don't link any other items as dependency.''' | ||
These items don't have a property [[Property:P1|depends on]]. This could mean, that they are a | These items don't have a property [[Property:P1|depends on]]. This could mean, that they are the begining of a path. | ||
{{ | {{SPARQL2|query= | ||
#defaultView:Table | #defaultView:Table | ||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | PREFIX wdt: <https://graphit.ur.de/prop/direct/> | ||
PREFIX wd: <https://graphit.ur.de/entity/> | PREFIX wd: <https://graphit.ur.de/entity/> | ||
SELECT ?source ?sourceLabel ? | SELECT ?source ?sourceLabel ?dependency | ||
WHERE { | WHERE { | ||
Line 62: | Line 168: | ||
}} | }} | ||
== No Links == | |||
== | ''' Returns all Graph-items, that don't link to any other items and are not linked to in return.''' Does not return items used to structure the graph, such as [[Item:Q325|Essential]] | ||
''' Returns all items, that don't link to any other items and are not linked to in return.''' | |||
{{#widget:SPARQLquery|code= | {{#widget:SPARQLquery|code= | ||
# All items that don't linkt to another item (no dependency) | # All items that don't linkt to another item (no dependency) | ||
Line 72: | Line 175: | ||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | PREFIX wdt: <https://graphit.ur.de/prop/direct/> | ||
PREFIX wd: <https://graphit.ur.de/entity/> | PREFIX wd: <https://graphit.ur.de/entity/> | ||
SELECT ?source ?sourceLabel ? | SELECT ?source ?sourceLabel ?dependency | ||
WHERE { | WHERE { | ||
Line 81: | Line 184: | ||
service wikibase:label { bd:serviceParam wikibase:language "en" } | service wikibase:label { bd:serviceParam wikibase:language "en" } | ||
} | } | ||
}} | |||
== No Description == | |||
'''Returns all items without a description.''' | |||
{{SPARQL2|query= | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT ?item ?itemLabel ?itemDescription | |||
WHERE { | |||
?item wdt:P2 ?class. | |||
MINUS {?item schema:description ?itemDescription } | |||
service wikibase:label { bd:serviceParam wikibase:language "en". } | |||
} | |||
}} | |||
== No Instance == | |||
'''Returns all items that have no Property [[Property:P3|instance of]].''' Shows which items are not, e.g. Applications. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel ?instance ?instanceLabel { | |||
?item wdt:P2 ?class. | |||
optional { ?item wdt:P3 ?instance } | |||
# MINUS { ?item wdt:P3 ?instance } # Removes items with instance | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
---- | |||
= Access to Items = | |||
Queries that find items with specific proterties for an easier overview. | |||
== Quizzes == | |||
'''Returns all Items that are Quizzes.''' | |||
{{#widget:SPARQLquery|code= | |||
#All Items that are a Quiz | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT ?source ?sourceLabel ?url | |||
WHERE { | |||
# All Items that are an instance of Property Quiz | |||
?source wdt:P3 wd:Q162. | |||
?source wdt:P20 ?url. | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== Resources == | |||
'''Returns all Resources.''' | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT ?resource ?resourceLabel ?labelLength | |||
WHERE { | |||
?resource wdt:P20 ?url. | |||
?resource rdfs:label ?resourceLabel. | |||
BIND (strlen(str(?resourceLabel)) AS ?labelLength) | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== Labels == | |||
'''Returns the items with the longest Labels (50).''' Doesn't return Resources. | |||
Here it could be useful to find shorter alias for the items, for easier viewing in a visualisation. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel ?length ?alias { # ?property ?propertyLabel | |||
# ?item wdt:P2 ?class. | |||
?item rdfs:label ?itemLabel. | |||
MINUS {?item wdt:P20 ?url} | |||
MINUS {?item wdt:P3 wd:Q167} # no Students | |||
BIND (strlen(str(?itemLabel)) AS ?length) | |||
OPTIONAL {?item skos:altLabel ?alias} | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
ORDER BY DESC(strlen(str(?itemLabel))) LIMIT 50 | |||
}} | |||
== Orphans == | |||
'''Returns all items that have no Properties.''' Excludes all Property-Items, such as [[Property:P1|depends on]] | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT ?item ?itemLabel ?property | |||
WHERE { | |||
?item rdfs:label ?itemLabel. # Select all item with labels | |||
MINUS {?item ?predicate ?value. | |||
?property wikibase:directClaim ?predicate} | |||
MINUS {?item wikibase:directClaim ?property} # remove Properties | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== Categories == | |||
'''Returns all [[Item:Q169|Categories]] and their sub-items.''' | |||
{{SPARQL2|query= | |||
#defaultView:Graph | |||
#get all Items of a category | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel ?category ?categoryLabel { | |||
?category wdt:P3 wd:Q169. | |||
?item wdt:P2 ?category. | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
=== No Categories === | |||
'''Returns all items, that are are [[Property:P14|included]] in a course, but not a category.''' | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:All items, included in a course, but not in a category | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?course ?courseLabel ?item ?itemLabel # ?category ?categoryLabel | |||
{ | |||
?course wdt:P3 wd:Q170. | |||
?course wdt:P14/wdt:P14 ?item. | |||
FILTER NOT EXISTS { ?category wdt:P3 wd:Q169; wdt:P14 ?item } | |||
MINUS {?item wdt:P20 ?url} # remove ressources | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} LIMIT 100 | |||
}} | |||
=== Only Categories === | |||
'''Returns all items, that are part of a course, but are only [[Property:P14|included]] in a category.''' This means, that the items being returned are part of a category, that a course includes, but aren't included in a session of that course. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:Items of a course only in its categories | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT DISTINCT | |||
?category ?categoryLabel ?item ?itemLabel | |||
?session ?sessionLabel ?sessionAltLabel | |||
WHERE { | |||
# Check which items of a category are included in a sessions of the course | |||
BIND (wd:Q1330 as ?course) | |||
# Get all items of a category | |||
?course wdt:P14 ?category. | |||
?category wdt:P14 ?item. | |||
# Exclude Items not included in sessions | |||
FILTER NOT EXISTS { | |||
?course wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427. | |||
?session wdt:P14 ?item. | |||
} | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} LIMIT 500 | |||
}} | |||
=== All Items of Category === | |||
'''Returns all items (and sessions they're [[Property:P14|included]] in) of a specific category.''' | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:Items of a specific category (& sessions of a course) | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT DISTINCT | |||
?category ?categoryLabel ?item ?itemLabel | |||
?session ?sessionLabel ?sessionAltLabel | |||
WHERE { | |||
# Check which items of a category are included in a sessions of the course | |||
BIND (wd:Q932 as ?course) | |||
BIND (wd:Q10 as ?category) | |||
# Get all items of a category | |||
?category wdt:P14 ?item. # 87 Results | |||
# Return the session, if it exists | |||
OPTIONAL { | |||
?course wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427. | |||
?item ^wdt:P14 ?session. | |||
} | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} | |||
}} | |||
== Sessions == | |||
'''Returns all [[Item:Q427|Sessions]], all Items that they include and the [[Item:Q170|Course]] that includes them.''' Excludes all items that are resources. | |||
{{SPARQL2|query= | |||
#defaultView:Graph | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel ?session ?sessionLabel ?course ?courseLabel ?edgeLabel | |||
where { | |||
?session wdt:P14 ?item. | |||
MINUS {?item wdt:P20 ?url.} | |||
MINUS {?session wdt:P3 wd:Q162.} | |||
service wikibase:label { bd:serviceParam wikibase:language "en".} | |||
} | |||
}} | |||
=== Not in Sessions === | |||
'''Returns all items that are not (yet) part of a [[Item:Q427|Session]].''' | |||
{{#widget:SPARQLquery|code= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel ?session ?sessionLabel | |||
WHERE { | |||
?item wdt:P1 ?dependency. | |||
MINUS {?session wdt:P14 ?item}. | |||
MINUS {?item wdt:P3 wd:Q169}. | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
=== Check "inclusion" in Session === | |||
'''Returns the [[Item:Q427|Sessions]] specified Items are [[Property:P14|included]] in.''' | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:Verify "inclusion" of item(s) | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT DISTINCT | |||
?session ?sessionLabel ?item ?itemLabel | |||
WHERE { | |||
# Check if item(s) are "included" in a session of course(s) | |||
VALUES ?item {wd:905 wd:Q20 wd:Q92 wd:Q124 wd:Q36} | |||
?course wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427; wdt:P14 ?item. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} ORDER BY ?itemLabel | |||
}} | |||
---- | |||
= Courses = | |||
Queries for checking courses | |||
== General Info == | |||
'''Returns different item ''counts'' for existing courses.''' | |||
{{#widget:SPARQLquery|code= | |||
#defaultView:Table | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT DISTINCT ?course ?courseLabel ?items ?dependencies ?resources ?sessions | |||
WHERE { | |||
# number of items per course | |||
?course wdt:P3 wd:Q170. | |||
# ?item wdt:P14/wdt:P14 ?course. | |||
# count number of items in course | |||
{ SELECT ?course ?courseLabel (COUNT(DISTINCT ?item) as ?items) WHERE { | |||
?course wdt:P14/wdt:P14 ?item. | |||
} GROUP BY ?course ?courseLabel | |||
} | |||
# count number of resources in course | |||
{ SELECT ?course ?courseLabel (COUNT(DISTINCT ?resource) as ?resources) WHERE { | |||
?course wdt:P14/wdt:P14 ?item. | |||
?item wdt:P21 ?resource. | |||
} GROUP BY ?course ?courseLabel | |||
} | |||
# count dependencies within course | |||
{ SELECT ?course ?courseLabel (COUNT(DISTINCT ?dependency) as ?dependencies) WHERE { | |||
?course wdt:P14/wdt:P14 ?item. | |||
?item wdt:P1 ?dependency. | |||
} GROUP BY ?course ?courseLabel | |||
} | |||
# count sessions within course | |||
{ SELECT ?course ?courseLabel (COUNT(DISTINCT ?session) as ?sessions) WHERE { | |||
?course wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427. | |||
} GROUP BY ?course ?courseLabel | |||
} | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
}|height=25vh | |||
}} | |||
== Course Overlaps == | |||
Queries that check for overlaps between courses. | |||
== Item overlaps == | |||
'''Returns the number of items [[Property:P14|included]] in a [[Item:Q427|Session]] of a course, and the number of items that are [[Proprerty:P14|included]] in [[Item:Q427|Sessions]] of both courses. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:Overlaps of two courses | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT DISTINCT | |||
?course1 ?course1Label ?course2 ?course2Label ?items1 ?items2 ?overlapItems | |||
WHERE { | |||
# List of courses to compare | |||
VALUES ?course1 {wd:Q932 wd:1330 wd:Q1022} | |||
VALUES ?course2 {wd:Q932 wd:Q1330 wd:Q1022} | |||
# count number of items in course1 | |||
{ SELECT ?course1 ?course1Label (COUNT(DISTINCT ?item) as ?items1) WHERE { | |||
?course1 wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427; wdt:P14 ?item. | |||
} GROUP BY ?course1 ?course1Label | |||
} | |||
# count number of items in course2 | |||
{ SELECT ?course2 ?course2Label (COUNT(DISTINCT ?item) as ?items2) WHERE { | |||
?course2 wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427; wdt:P14 ?item. | |||
} GROUP BY ?course2 ?course2Label | |||
} | |||
# overlapped items | |||
OPTIONAL { | |||
{ SELECT ?course1 ?course1Label ?course2 ?course2Label (COUNT(DISTINCT ?item) as ?overlapItems) WHERE { | |||
?course1 wdt:P14 ?session1. | |||
?session1 wdt:P3 wd:Q427; wdt:P14 ?item. | |||
?course2 wdt:P14 ?session2. | |||
?session2 wdt:P3 wd:Q427; wdt:P14 ?item. | |||
} GROUP BY ?course1 ?course1Label ?course2 ?course2Label } | |||
} | |||
BIND(IF (BOUND(?overlapItems), ?overlapItems, 0) as ?overlapItems) | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} | |||
}} | |||
== List of overlap items== | |||
'''Returns a list of all items [[Property:P14|included]] two courses.''' This means, that an item listed here is part of at least one session of each course. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:Get all items included in sessions of both courses | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct | |||
?item ?itemLabel | |||
?session1 ?session1Label ?session2 ?session2Label | |||
where { | |||
# bind the courses | |||
BIND(wd:Q932 as ?course1) | |||
BIND(wd:Q1330 as ?course2) | |||
?course1 wdt:P14 ?session1. | |||
?session1 wdt:P3 wd:Q427; wdt:P14 ?item. | |||
?course2 wdt:P14 ?session2. | |||
?session2 wdt:P3 wd:Q427; wdt:P14 ?item. | |||
service wikibase:label { bd:serviceParam wikibase:language "en".} | |||
} ORDER BY ?itemLabel | |||
}} | |||
== Dependency Overlaps == | |||
'''Returns a list of the overlaps between dependencies of two courses.''' <span style="color: green">''?dependency1''</span> are all dependencies of items included in sessions of <span style="color: green">''?course1''</span>, that are only discussed in sessions of <span style="color: green">''?course2''</span> aka ''d(c1 → c2)''. Vice versa for <span style="color: green">''?dependency2''</span>. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
#title:Dependency overlaps of two courses | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT DISTINCT | |||
?dependency1 ?dependency1Label # dependencies of course1 only "included" in course2 | |||
?dependency2 ?dependency2Label # dependencies of course2 only "included" in course1 | |||
WHERE { | |||
# List of courses to compare | |||
BIND(wd:Q932 as ?course1) # CGBV | |||
BIND(wd:Q1330 as ?course2) # MMT | |||
{ # get dependencies of course1 only in course2 | |||
?course1 wdt:P14 ?session1. | |||
?session1 wdt:P3 wd:Q427; wdt:P14 ?item1. | |||
?item1 wdt:P1 ?dependency1. | |||
?course2 wdt:P14 ?session2. | |||
?session2 wdt:P3 wd:Q427; wdt:P14 ?dependency1. | |||
FILTER NOT EXISTS { | |||
?dependency1 ^wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427. | |||
?session ^wdt:P14 ?course1. | |||
} | |||
} | |||
UNION | |||
{ # get dependencies of course2 only in course1 | |||
?course2 wdt:P14 ?session2. | |||
?session2 wdt:P3 wd:Q427; wdt:P14 ?item2. | |||
?item2 wdt:P1 ?dependency2. | |||
?course1 wdt:P14 ?session1. | |||
?session1 wdt:P3 wd:Q427; wdt:P14 ?dependency2. | |||
FILTER NOT EXISTS { | |||
?dependency2 ^wdt:P14 ?session. | |||
?session wdt:P3 wd:Q427. | |||
?session ^wdt:P14 ?course2. | |||
} } | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} ORDER BY ?dependency2Label | |||
}} | |||
= Miscellaneous = | |||
== Circular Dependencies == | |||
'''Returns items that directly link back towards each other''', creating a circular dependency. | |||
(Circular dependencies with larger radii are not found with this query) | |||
{{#widget:SPARQLquery|code= | |||
#defaultView:Graph | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?item ?itemLabel ?dependency ?dependencyLabel { | |||
# Items that link to each other | |||
?item wdt:P1 ?dependency. | |||
?dependency wdt:P1 ?item. | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== Categories with Resources == | |||
'''Returns all Categories that link to resources.''' This could be a sign to create new items or find better item to properly link these resources to. | |||
{{SPARQL2|query= | |||
#defaultView:Graph | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
select distinct ?category ?categoryLabel ?resource ?resourceLabel { # ?property ?propertyLabel | |||
?category wdt:P3 wd:Q169. | |||
?category wdt:P21 ?resource. | |||
service wikibase:label { bd:serviceParam wikibase:language "en" } | |||
} | |||
}} | |||
== Tags == | |||
'''Returns all Tags that are attached to a Module(position).''' Query returns the german lable (change "de" to "en" in last row) | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
SELECT DISTINCT | |||
?module ?moduleLabel | |||
?tag ?tagLabel ?rgb | |||
WHERE { | |||
wd:Q790 wdt:P14 ?module. | |||
?module wdt:P3 wd:Q791. | |||
?module wdt:P14 ?position. | |||
OPTIONAL{?module wdt:P35 ?tag.} | |||
OPTIONAL{?position wdt:P35 ?tag.} | |||
BIND (IF(BOUND(?tag), "ffeec2","FFFFFF") as ?rgb) | |||
service wikibase:label { bd:serviceParam wikibase:language "de".} | |||
} | |||
}} | |||
== CGBV 23SS categories == | |||
'''Returns a list of all categories used for the 23SS course of CGBV and all the items that are subclasses of those categories.''' Categories have been use in 23SS CGBV if they '''don't''' ''include'' any items. | |||
{{SPARQL2|query= | |||
#defaultView:Table | |||
PREFIX wd: <https://graphit.ur.de/entity/> | |||
PREFIX wdt: <https://graphit.ur.de/prop/direct/> | |||
SELECT ?category ?categoryLabel ?item ?itemLabel | |||
WHERE { | |||
?category wdt:P3 wd:Q169. | |||
wd:Q932 wdt:P14 ?category. | |||
# get items that link to category | |||
?item wdt:P2 ?category. | |||
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } | |||
} ORDER BY ASC(?categoryLabel) | |||
}} | }} |
Latest revision as of 12:07, 22 April 2025
This page contains several SPARQL-Queries to help debug the graph.
Useful Queries
A List of accessible queries, that are useful to understand the structure of the graph and identify problems, such as missing links. They can be changed as needed.
Backlinks
A query that finds all backlinks to a specific item.
Items used: Polygons (Q108)
#defaultView:Graph
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?subject ?subjectLabel ?item ?itemLabel { # ?property ?propertyLabel
values (?item) {(wd:Q108)}
?subject ?predicate ?item .
?property wikibase:directClaim ?predicate
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
Duplicates
Returns a list of items that have the exact same label. Note: query might take a while.
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?i ?i2
WHERE {
?i rdfs:label ?iLabel. # Select all item with labels
?i2 rdfs:label ?i2Label.
FILTER (str(?iLabel) = str(?i2Label)). # Only items with same label
FILTER (?i != ?i2).
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
All Items
Returns a list of all items and how they are categorized in alphabetical order. In this case categories are all items that are used to structure the graph, such as Article or Markers. This list can help spot duplicates or similiar items.
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?item ?itemLabel {
?item ?predicate ?dependency.
?property wikibase:directClaim ?predicate
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
order by asc(UCASE(str(?itemLabel)))
Language Labels
Returns the english or german labels for all items. Items should all have a english label and can have an optional german label. This query can also be used to check if items are missing labels in a language. See explanatory comments in query.
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?i ?label_en ?label_de
WHERE {
?i rdfs:label ?label. # Select all item with labels.
OPTIONAL {?i rdfs:label ?label_en filter (lang(?label_en) = "en").}
# Remove OPTIONAL here to get items with en label and optional de label
OPTIONAL {?i rdfs:label ?label_de filter (lang(?label_de) = "de").}
# Remove OPTIONAL here to get items with de label and optional en label
} order by ?label_en
Missing Properties
Resources
No Resources
Returns all Items, that don't have any resource that they link to.
Unlinked Resources
Returns all resources, that have not been linked to any item yet.
Instance-less Resources
Returns all Resources that have no Property instance of.
Properties used: resource (P21), instance of (P3)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT ?resource ?resourceLabel ?instanceOf
WHERE {
?source wdt:P21 ?resource.
MINUS {?resource wdt:P3 ?instanceOf}
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
No Subclass
Returns all Items, that don't have a property subclass.
Properties used: depends on (P1), subclass of (deprecated) (P2)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?source ?sourceLabel ?subclass
WHERE {
?source wdt:P1 ?dependency.
MINUS {?source wdt:P2 ?class. }
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
No Dependencies
Returns all Items, that don't link any other items as dependency.
These items don't have a property depends on. This could mean, that they are the begining of a path.
Properties used: subclass of (deprecated) (P2), depends on (P1)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT ?source ?sourceLabel ?dependency
WHERE {
?source wdt:P2 ?class.
MINUS {?source wdt:P1 ?dependency.}
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
No Links
Returns all Graph-items, that don't link to any other items and are not linked to in return. Does not return items used to structure the graph, such as Essential
No Description
Returns all items without a description.
Properties used: subclass of (deprecated) (P2)
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel ?itemDescription
WHERE {
?item wdt:P2 ?class.
MINUS {?item schema:description ?itemDescription }
service wikibase:label { bd:serviceParam wikibase:language "en". }
}
No Instance
Returns all items that have no Property instance of. Shows which items are not, e.g. Applications.
Properties used: subclass of (deprecated) (P2), instance of (P3)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?item ?itemLabel ?instance ?instanceLabel {
?item wdt:P2 ?class.
optional { ?item wdt:P3 ?instance }
# MINUS { ?item wdt:P3 ?instance } # Removes items with instance
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
Access to Items
Queries that find items with specific proterties for an easier overview.
Quizzes
Returns all Items that are Quizzes.
Resources
Returns all Resources.
Properties used: url (P20)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?resource ?resourceLabel ?labelLength
WHERE {
?resource wdt:P20 ?url.
?resource rdfs:label ?resourceLabel.
BIND (strlen(str(?resourceLabel)) AS ?labelLength)
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
Labels
Returns the items with the longest Labels (50). Doesn't return Resources.
Here it could be useful to find shorter alias for the items, for easier viewing in a visualisation. Items used: Student (Q167)
Properties used: subclass of (deprecated) (P2), 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 ?length ?alias { # ?property ?propertyLabel
# ?item wdt:P2 ?class.
?item rdfs:label ?itemLabel.
MINUS {?item wdt:P20 ?url}
MINUS {?item wdt:P3 wd:Q167} # no Students
BIND (strlen(str(?itemLabel)) AS ?length)
OPTIONAL {?item skos:altLabel ?alias}
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
ORDER BY DESC(strlen(str(?itemLabel))) LIMIT 50
Orphans
Returns all items that have no Properties. Excludes all Property-Items, such as depends on
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT ?item ?itemLabel ?property
WHERE {
?item rdfs:label ?itemLabel. # Select all item with labels
MINUS {?item ?predicate ?value.
?property wikibase:directClaim ?predicate}
MINUS {?item wikibase:directClaim ?property} # remove Properties
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
Categories
Returns all Categories and their sub-items.
Items used: Category (Q169)
Properties used: instance of (P3), subclass of (deprecated) (P2)
#defaultView:Graph
#get all Items of a category
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?item ?itemLabel ?category ?categoryLabel {
?category wdt:P3 wd:Q169.
?item wdt:P2 ?category.
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
No Categories
Returns all items, that are are included in a course, but not a category.
Items used: Course (Q170), Category (Q169)
Properties used: instance of (P3), includes (P14), url (P20)
#defaultView:Table
#title:All items, included in a course, but not in a category
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?course ?courseLabel ?item ?itemLabel # ?category ?categoryLabel
{
?course wdt:P3 wd:Q170.
?course wdt:P14/wdt:P14 ?item.
FILTER NOT EXISTS { ?category wdt:P3 wd:Q169; wdt:P14 ?item }
MINUS {?item wdt:P20 ?url} # remove ressources
service wikibase:label { bd:serviceParam wikibase:language "en" }
} LIMIT 100
Only Categories
Returns all items, that are part of a course, but are only included in a category. This means, that the items being returned are part of a category, that a course includes, but aren't included in a session of that course.
Items used: MMT 24/25WS (Q1330), Session (Q427)
Properties used: includes (P14), instance of (P3)
#defaultView:Table
#title:Items of a course only in its categories
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT DISTINCT
?category ?categoryLabel ?item ?itemLabel
?session ?sessionLabel ?sessionAltLabel
WHERE {
# Check which items of a category are included in a sessions of the course
BIND (wd:Q1330 as ?course)
# Get all items of a category
?course wdt:P14 ?category.
?category wdt:P14 ?item.
# Exclude Items not included in sessions
FILTER NOT EXISTS {
?course wdt:P14 ?session.
?session wdt:P3 wd:Q427.
?session wdt:P14 ?item.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} LIMIT 500
All Items of Category
Returns all items (and sessions they're included in) of a specific category.
Items used: CGBV 24SS (Q932), Mathematical Foundations (Q10), Session (Q427)
Properties used: includes (P14), instance of (P3)
#defaultView:Table
#title:Items of a specific category (& sessions of a course)
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT DISTINCT
?category ?categoryLabel ?item ?itemLabel
?session ?sessionLabel ?sessionAltLabel
WHERE {
# Check which items of a category are included in a sessions of the course
BIND (wd:Q932 as ?course)
BIND (wd:Q10 as ?category)
# Get all items of a category
?category wdt:P14 ?item. # 87 Results
# Return the session, if it exists
OPTIONAL {
?course wdt:P14 ?session.
?session wdt:P3 wd:Q427.
?item ^wdt:P14 ?session.
}
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Sessions
Returns all Sessions, all Items that they include and the Course that includes them. Excludes all items that are resources.
Items used: Quiz (Q162)
Properties used: includes (P14), url (P20), instance of (P3)
#defaultView:Graph
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?item ?itemLabel ?session ?sessionLabel ?course ?courseLabel ?edgeLabel
where {
?session wdt:P14 ?item.
MINUS {?item wdt:P20 ?url.}
MINUS {?session wdt:P3 wd:Q162.}
service wikibase:label { bd:serviceParam wikibase:language "en".}
}
Not in Sessions
Returns all items that are not (yet) part of a Session.
Check "inclusion" in Session
Returns the Sessions specified Items are included in.
Items used: Blur Filters (Q20), Matrices (Q92), Rotation Matrix (3D) (Q124), Computer Graphics Pipeline (Q36), Session (Q427)
Properties used: includes (P14), instance of (P3)
#defaultView:Table
#title:Verify "inclusion" of item(s)
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT DISTINCT
?session ?sessionLabel ?item ?itemLabel
WHERE {
# Check if item(s) are "included" in a session of course(s)
VALUES ?item {wd:905 wd:Q20 wd:Q92 wd:Q124 wd:Q36}
?course wdt:P14 ?session.
?session wdt:P3 wd:Q427; wdt:P14 ?item.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?itemLabel
Courses
Queries for checking courses
General Info
Returns different item counts for existing courses.
Course Overlaps
Queries that check for overlaps between courses.
Item overlaps
Returns the number of items included in a Session of a course, and the number of items that are included in Sessions of both courses.
Items used: CGBV 24SS (Q932), ASE 24/25WS (Q1022), MMT 24/25WS (Q1330), Session (Q427)
Properties used: includes (P14), instance of (P3)
#defaultView:Table
#title:Overlaps of two courses
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT DISTINCT
?course1 ?course1Label ?course2 ?course2Label ?items1 ?items2 ?overlapItems
WHERE {
# List of courses to compare
VALUES ?course1 {wd:Q932 wd:1330 wd:Q1022}
VALUES ?course2 {wd:Q932 wd:Q1330 wd:Q1022}
# count number of items in course1
{ SELECT ?course1 ?course1Label (COUNT(DISTINCT ?item) as ?items1) WHERE {
?course1 wdt:P14 ?session.
?session wdt:P3 wd:Q427; wdt:P14 ?item.
} GROUP BY ?course1 ?course1Label
}
# count number of items in course2
{ SELECT ?course2 ?course2Label (COUNT(DISTINCT ?item) as ?items2) WHERE {
?course2 wdt:P14 ?session.
?session wdt:P3 wd:Q427; wdt:P14 ?item.
} GROUP BY ?course2 ?course2Label
}
# overlapped items
OPTIONAL {
{ SELECT ?course1 ?course1Label ?course2 ?course2Label (COUNT(DISTINCT ?item) as ?overlapItems) WHERE {
?course1 wdt:P14 ?session1.
?session1 wdt:P3 wd:Q427; wdt:P14 ?item.
?course2 wdt:P14 ?session2.
?session2 wdt:P3 wd:Q427; wdt:P14 ?item.
} GROUP BY ?course1 ?course1Label ?course2 ?course2Label }
}
BIND(IF (BOUND(?overlapItems), ?overlapItems, 0) as ?overlapItems)
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
List of overlap items
Returns a list of all items included two courses. This means, that an item listed here is part of at least one session of each course.
Items used: CGBV 24SS (Q932), MMT 24/25WS (Q1330), Session (Q427)
Properties used: includes (P14), instance of (P3)
#defaultView:Table
#title:Get all items included in sessions of both courses
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct
?item ?itemLabel
?session1 ?session1Label ?session2 ?session2Label
where {
# bind the courses
BIND(wd:Q932 as ?course1)
BIND(wd:Q1330 as ?course2)
?course1 wdt:P14 ?session1.
?session1 wdt:P3 wd:Q427; wdt:P14 ?item.
?course2 wdt:P14 ?session2.
?session2 wdt:P3 wd:Q427; wdt:P14 ?item.
service wikibase:label { bd:serviceParam wikibase:language "en".}
} ORDER BY ?itemLabel
Dependency Overlaps
Returns a list of the overlaps between dependencies of two courses. ?dependency1 are all dependencies of items included in sessions of ?course1, that are only discussed in sessions of ?course2 aka d(c1 → c2). Vice versa for ?dependency2.
Items used: CGBV 24SS (Q932), MMT 24/25WS (Q1330), Session (Q427)
Properties used: includes (P14), instance of (P3), depends on (P1)
#defaultView:Table
#title:Dependency overlaps of two courses
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT DISTINCT
?dependency1 ?dependency1Label # dependencies of course1 only "included" in course2
?dependency2 ?dependency2Label # dependencies of course2 only "included" in course1
WHERE {
# List of courses to compare
BIND(wd:Q932 as ?course1) # CGBV
BIND(wd:Q1330 as ?course2) # MMT
{ # get dependencies of course1 only in course2
?course1 wdt:P14 ?session1.
?session1 wdt:P3 wd:Q427; wdt:P14 ?item1.
?item1 wdt:P1 ?dependency1.
?course2 wdt:P14 ?session2.
?session2 wdt:P3 wd:Q427; wdt:P14 ?dependency1.
FILTER NOT EXISTS {
?dependency1 ^wdt:P14 ?session.
?session wdt:P3 wd:Q427.
?session ^wdt:P14 ?course1.
}
}
UNION
{ # get dependencies of course2 only in course1
?course2 wdt:P14 ?session2.
?session2 wdt:P3 wd:Q427; wdt:P14 ?item2.
?item2 wdt:P1 ?dependency2.
?course1 wdt:P14 ?session1.
?session1 wdt:P3 wd:Q427; wdt:P14 ?dependency2.
FILTER NOT EXISTS {
?dependency2 ^wdt:P14 ?session.
?session wdt:P3 wd:Q427.
?session ^wdt:P14 ?course2.
} }
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ?dependency2Label
Miscellaneous
Circular Dependencies
Returns items that directly link back towards each other, creating a circular dependency. (Circular dependencies with larger radii are not found with this query)
Categories with Resources
Returns all Categories that link to resources. This could be a sign to create new items or find better item to properly link these resources to. Items used: Category (Q169)
Properties used: instance of (P3), resource (P21)
#defaultView:Graph
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
select distinct ?category ?categoryLabel ?resource ?resourceLabel { # ?property ?propertyLabel
?category wdt:P3 wd:Q169.
?category wdt:P21 ?resource.
service wikibase:label { bd:serviceParam wikibase:language "en" }
}
Tags
Returns all Tags that are attached to a Module(position). Query returns the german lable (change "de" to "en" in last row) Items used: Media informatics B.A. UR (Q790), Module (Q791)
Properties used: includes (P14), instance of (P3), has tag (P35)
#defaultView:Table
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX wd: <https://graphit.ur.de/entity/>
SELECT DISTINCT
?module ?moduleLabel
?tag ?tagLabel ?rgb
WHERE {
wd:Q790 wdt:P14 ?module.
?module wdt:P3 wd:Q791.
?module wdt:P14 ?position.
OPTIONAL{?module wdt:P35 ?tag.}
OPTIONAL{?position wdt:P35 ?tag.}
BIND (IF(BOUND(?tag), "ffeec2","FFFFFF") as ?rgb)
service wikibase:label { bd:serviceParam wikibase:language "de".}
}
CGBV 23SS categories
Returns a list of all categories used for the 23SS course of CGBV and all the items that are subclasses of those categories. Categories have been use in 23SS CGBV if they don't include any items.
Items used: Category (Q169), CGBV 24SS (Q932)
Properties used: instance of (P3), includes (P14), subclass of (deprecated) (P2)
#defaultView:Table
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT ?category ?categoryLabel ?item ?itemLabel
WHERE {
?category wdt:P3 wd:Q169.
wd:Q932 wdt:P14 ?category.
# get items that link to category
?item wdt:P2 ?category.
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
} ORDER BY ASC(?categoryLabel)