Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assignment 3 aajodar #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions Assignment3/aajodar-22A243/aajodar-queries.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# 1. Get all the properties that can be applied to instances of the Politician class (<http://dbpedia.org/ontology/Politician>)

PREFIX db: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?property
WHERE {
?instance a db:Politician .
?instance ?property ?value .
}



# 2. Get all the properties, except rdf:type, that can be applied to instances of the Politician class

PREFIX db: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?property
WHERE {
?instance a db:Politician .
?instance ?property ?value .
FILTER (?property != rdf:type)
}



# 3. Which different values exist for the properties, except rdf:type, of the instances of the Politician class?

PREFIX db: <http://dbpedia.org/ontology/>
SELECT DISTINCT ?property ?value
WHERE {
?instance a db:Politician .
?instance ?property ?value .
FILTER (?property != rdf:type)
}



# 4. For each of the properties, except rdf:type, that can be applied to instances of the Politician class, which different values do they take in those instances?

PREFIX db: <http://dbpedia.org/ontology/>
SELECT ?property (GROUP_CONCAT(DISTINCT ?value; separator=" , ") AS ?distinctValues)
WHERE {
?instance a db:Politician .
?instance ?property ?value .
FILTER (?property != rdf:type)
}
GROUP BY ?property



# 5. For each of the properties, except rdf:type, that can be applied to instances of the Politician class, how many distinct values do they take in those instances?

PREFIX db: <http://dbpedia.org/ontology/>
SELECT ?property (COUNT(DISTINCT ?value) AS ?countDistinctValues)
WHERE {
?instance a db:Politician .
?instance ?property ?value .
FILTER (?property != rdf:type)
}
GROUP BY ?property