Jump to content

SPARQL examples: Difference between revisions

No edit summary
add stubs for interesting queries
Line 5: Line 5:
{{#widget:SPARQLquery|code=
{{#widget:SPARQLquery|code=
#defaultView:Graph
#defaultView:Graph
PREFIX grt: <https://graphit.ur.de/prop/direct/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
SELECT ?item ?itemLabel ?class ?classLabel ?image ?dependency ?dependencyLabel WHERE {
SELECT ?item ?itemLabel ?class ?classLabel ?image ?dependency ?dependencyLabel WHERE {
   ?item grt:P1 ?dependency.
   ?item wdt:P1 ?dependency.
   ?item grt:P2 ?class
   ?item wdt:P2 ?class
   OPTIONAL{ ?item grt:P9 ?image.}
   OPTIONAL{ ?item wdt:P9 ?image.}
   OPTIONAL{ ?class grt:P9 ?image.}
   OPTIONAL{ ?class wdt:P9 ?image.}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
}}
}}
=== All topics in the CGBV course ===
=== Educational resources for learning Python ===
=== Stuff you need to learn if you want to write a tool that counts objects in an image ===
=== Central topics (topics with a high number of dependencies) ===
=== Advanced topics (topics with a high number of prerequisites) ===
=== Topics that Max Mustermann wants to complete ===


=== Topics that Max Mustermann has completed ===
=== Topics that Max Mustermann has completed ===
{{#widget:SPARQLquery|code=
{{#widget:SPARQLquery|code=
#defaultView:Timeline
#defaultView:Timeline
PREFIX gr: <https://graphit.ur.de/entity/>
PREFIX wd: <https://graphit.ur.de/entity/>
PREFIX grs: <https://graphit.ur.de/entity/statement/>
PREFIX wds: <https://graphit.ur.de/entity/statement/>
PREFIX grv: <https://graphit.ur.de/value/>
PREFIX wdv: <https://graphit.ur.de/value/>
PREFIX grt: <https://graphit.ur.de/prop/direct/>
PREFIX wdt: <https://graphit.ur.de/prop/direct/>
PREFIX p: <https://graphit.ur.de/prop/>
PREFIX p: <https://graphit.ur.de/prop/>
PREFIX ps: <https://graphit.ur.de/prop/statement/>
PREFIX ps: <https://graphit.ur.de/prop/statement/>
PREFIX pq: <https://graphit.ur.de/prop/qualifier/>
PREFIX pq: <https://graphit.ur.de/prop/qualifier/>
SELECT ?topic ?topicLabel ?image ?date WHERE {
SELECT ?topic ?topicLabel ?image ?date WHERE {
   BIND(gr:Q157 as ?user).
   BIND(wd:Q157 as ?user).
   ?user p:P12 ?statement.
   ?user p:P12 ?statement.
   ?statement ps:P12 ?topic.
   ?statement ps:P12 ?topic.
   ?statement pq:P19 ?date.
   ?statement pq:P19 ?date.
   OPTIONAL{ ?topic grt:P11 ?image.}
   OPTIONAL{ ?topic wdt:P11 ?image.}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
}
}}
}}

Revision as of 16:29, 5 May 2023

This page is automatically parsed by the query page to provide examples.

Simple Queries

Complete Dependency Graph

{{#widget:SPARQLquery|code=

  1. defaultView:Graph

PREFIX wdt: <https://graphit.ur.de/prop/direct/> SELECT ?item ?itemLabel ?class ?classLabel ?image ?dependency ?dependencyLabel WHERE {

 ?item wdt:P1 ?dependency.
 ?item wdt:P2 ?class
 OPTIONAL{ ?item wdt:P9 ?image.}
 OPTIONAL{ ?class wdt:P9 ?image.}
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} }}

All topics in the CGBV course

Educational resources for learning Python

Stuff you need to learn if you want to write a tool that counts objects in an image

Central topics (topics with a high number of dependencies)

Advanced topics (topics with a high number of prerequisites)

Topics that Max Mustermann wants to complete

Topics that Max Mustermann has completed

{{#widget:SPARQLquery|code=

  1. defaultView:Timeline

PREFIX wd: <https://graphit.ur.de/entity/> PREFIX wds: <https://graphit.ur.de/entity/statement/> PREFIX wdv: <https://graphit.ur.de/value/> 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 ?topic ?topicLabel ?image ?date WHERE {

 BIND(wd:Q157 as ?user).
 ?user p:P12 ?statement.
 ?statement ps:P12 ?topic.
 ?statement pq:P19 ?date.
 OPTIONAL{ ?topic wdt:P11 ?image.}
 SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

} }}