Editing
Query/Examples
Jump to navigation
Jump to search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Example data queries that visualize the data model == === Overview of all classes and their subclasses === {{SPARQL|query= #defaultView:Graph SELECT Distinct ?classes ?classesLabel ?subclasses ?subclassesLabel WHERE { SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } {?classes owl:equivalentClass ?x.} Union {?subclasses tibt:P2 ?classes.} } }} === Overview of types of of human-made objects and instances === {{SPARQL|query= #defaultView:Tree SELECT ?class ?classLabel ?type ?typeLabel ?item ?itemLabel WHERE { VALUES ?class {tib:Q6} ?item tibt:P1 ?class. ?item tibt:P97 ?type. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } }} === Overview of types of conceptual objects and instances === {{SPARQL|query= #defaultView:Tree SELECT ?class ?classLabel ?type ?typeLabel ?item ?itemLabel WHERE { VALUES ?class {tib:Q17} ?item tibt:P1 ?class. ?item tibt:P97 ?type. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } }} == Example data queries that showcase items from the case study == === All paintings from the cycle "Belagerungsszenen des Langen Türkenkriegs" with some properties === {{SPARQL|query= PREFIX tib: <https://wikibase.semantic-kompakkt.de/entity/> PREFIX tibt: <https://wikibase.semantic-kompakkt.de/prop/direct/> PREFIX tibp: <https://wikibase.semantic-kompakkt.de/prop/> PREFIX tibps: <https://wikibase.semantic-kompakkt.de/prop/statement/> PREFIX tibpq: <https://wikibase.semantic-kompakkt.de/prop/qualifier/> PREFIX tibpqv: <https://wikibase.semantic-kompakkt.de/prop/qualifier/value/> #All paintings from "Belagerungsszenen des Langen Türkenkriegs" SELECT ?item ?itemLabel ?creationDateStart ?creationDateEnd ?inscription ?materialLabel ?techniqueLabel WHERE { ?item tibt:P6 tib:Q376. OPTIONAL { ?item tibp:P8 [ tibps:P8 tib:Q25; tibpqv:P10 [wikibase:timePrecision "9"^^xsd:integer ; wikibase:timeValue ?creationDateStart ] ]. } OPTIONAL { ?item tibp:P8 [ tibps:P8 tib:Q25; tibpqv:P11 [wikibase:timePrecision "9"^^xsd:integer ; wikibase:timeValue ?creationDateEnd ] ]. } OPTIONAL { ?item tibt:P25 ?inscription. } OPTIONAL { ?item tibt:P22 ?material. } OPTIONAL { ?item tibt:P65 ?technique. } SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } } }} === Items that share an Iconclass notation === {{SPARQL|query= #defaultView:Graph SELECT ?item1 ?item1Label ?iconclassLabel ?iconclass ?rgb ?rgb2 WHERE { ?item1 tibt:P64 ?iconclass. ?item2 tibt:P64 ?iconclass. BIND('D88888' as ?rgb) SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } FILTER(?item1 != ?item2) . } }} == Example federated queries == === Simple query to get more information about Weikersheim castle (via owl:sameAs method) === {{SPARQL|query= PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wdqs: <https://query.wikidata.org/sparql> SELECT ?weikersheim ?weikersheimLabel ?VIAF ?image WHERE{ ?weikersheim tibt:P97 tib:Q201. ?weikersheim owl:sameAs ?WDMatch. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } SERVICE wdqs: { ?WDMatch wdt:P214 ?VIAF. ?WDMatch wdt:P18 ?image } } }} === Simple query to get more information about Weikersheim castle (via GND external ID method) === {{SPARQL|query= PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wdqs: <https://query.wikidata.org/sparql> SELECT ?weikersheim ?weikersheimLabel ?GNDMatch ?image WHERE{ ?weikersheim tibt:P97 tib:Q201. ?weikersheim tibt:P102 ?GNDMatch. SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } SERVICE wdqs: { ?WDMatch wdt:P227 ?GNDMatch. ?WDMatch wdt:P18 ?image } } }} === Castles of Renaissance architectural style within 100km of Weikersheim castle === {{SPARQL|query= #defaultView:Map # Find all castles in the Wikibase; look on Wikidata for other renaissance castles nearby PREFIX wd: <http://www.wikidata.org/entity/> PREFIX wdt: <http://www.wikidata.org/prop/direct/> PREFIX wdqs: <https://query.wikidata.org/sparql> SELECT ?castle ?castleLabel ?location ?image WHERE { #Find all castles and their coordinates ?item tibt:P97 tib:Q201. ?item tibt:P37 ?coordinates. #Query wikidata SERVICE wdqs: { #Find castles with renaissance architectural style ?castle wdt:P31 wd:Q751876. ?castle wdt:P149 wd:Q236122. #Look for those castles in a radius of 100km around our castle SERVICE wikibase:around { ?castle wdt:P625 ?location . bd:serviceParam wikibase:center ?coordinates . bd:serviceParam wikibase:radius "100" . } #Get labels from Wikidata ?castle rdfs:label ?castleLabel. OPTIONAL { ?castle wdt:P18 ?image. } FILTER((LANG(?castleLabel)) = "de") } } }}
Summary:
Please note that all contributions to MyWiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
MyWiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Templates used on this page:
Template:SPARQL
(
edit
)
Template:SPARQLText
(
edit
)
Special:Badtitle/NS828:ConcatArgs
(
edit
)
Navigation menu
Personal tools
Not logged in
Talk
Contributions
Create account
Log in
Namespaces
Page
Discussion
English
Views
Read
Edit
Edit source
View history
More
Search
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Wikibase
New item
New property
New schema
List properties
Query service
Tools
What links here
Related changes
Special pages
Page information