INS-Projekt/data/sparql.txt

56 lines
1.5 KiB
Plaintext
Raw Normal View History

2017-11-20 19:58:45 +01:00
# Common prefixes across all queries
PREFIX : <http://example.com/ins_uebung/#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
PREFIX rev: <http://purl.org/stuff/rev#>
2017-11-20 20:09:17 +01:00
# How many consoles did Nintendo produce?
2017-11-20 19:58:45 +01:00
SELECT COUNT(?console) AS ?numConsoles
WHERE {
?console :madeBy ?organization .
}
GROUP BY ?organization
2017-11-20 20:09:17 +01:00
# Which console(s) made by Nintendo came out after 1997?
SELECT ?console
WHERE {
?console :madeBy :Nintendo .
?console :releaseYear ?releaseYear .
FILTER(?releaseYear > 1997)
}
# About which consoles do we not know their number of supported controllers yet if they are NOT portable game consoles?
SELECT ?console
WHERE {
?console rdf:type :GameConsole .
FILTER NOT EXIST { ?console rdf:type :PortableGameConsole . }
FILTER NOT EXIST { ?console :numOfSupportedControllers ?anyNumber . }
}
# Is there a game console without a review?
ASK {
?console rdf:type :GameConsole .
FILTER NOT EXIST { ?console rev:hasReview ?anyReview . }
}
# Show all Consoles that have at least one review
SELECT DISTINCT ?console
WHERE {
?console rev:hasReview ?anyReview .
}
2017-11-20 20:18:46 +01:00
# Construct triples for something different
# Map CEO to consoles
CONSTRUCT {
?ceo :isRelatedToConsole ?console .
}
WHERE {
?console rdf:type :GameConsole .
?console :madeBy ?org .
?org :ceo ?ceo .
?ceo rdf:type foaf:Person .
}