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

Assignment3 #231

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
76 changes: 76 additions & 0 deletions Assignment3/JaviRguezz-Assignment3/Consultas.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@

----------------------

Exercise 1 --> Get all the properties that can be applied to instances of the Politician class

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

Result :

https://es.dbpedia.org/sparql?default-graph-uri=&query=SELECT+DISTINCT+%3FProperty%0D%0AWHERE%7B+%0D%0A+%3Finstance+a+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FPolitician%3E+.%0D%0A+%3Finstance+%3FProperty+%3Fvalue+.%0D%0A%7D+&should-sponge=&format=text%2Fhtml&timeout=0&debug=on&run=+Run+Query+

----------------------

Exercise 2 --> Get all the properties, except rdf:type, that can be applied to instances of the Politician class

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

Result :

https://es.dbpedia.org/sparql?default-graph-uri=&query=SELECT+DISTINCT+%3Fproperty+%0D%0AWHERE+%7B%0D%0A++%3Finstance+a+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FPolitician%3E+.%0D%0A++%3Finstance+%3Fproperty+%3Fvalue+.%0D%0A++FILTER+%28%3Fproperty+%21%3D+rdf%3Atype%29%0D%0A%7D&should-sponge=&format=text%2Fhtml&timeout=0&debug=on&run=+Run+Query+

----------------------

Exercise 3 --> Which different values exist for the properties, except for rdf:type, applicable to the instances of Politician?

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

Result :

https://es.dbpedia.org/sparql?default-graph-uri=&query=SELECT+DISTINCT+%3Fproperty+%3Fvalue+%0D%0AWHERE+%7B%0D%0A++%3Finstance+a+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FPolitician%3E+.%0D%0A++%3Finstance+%3Fproperty+%3Fvalue+.%0D%0A++FILTER+%28%3Fproperty+%21%3D+rdf%3Atype%29%0D%0A%7D&should-sponge=&format=text%2Fhtml&timeout=0&debug=on&run=+Run+Query+

----------------------

Ejercicio 4 --> For each of these applicable properties, except for rdf:type, which different values do they take globally for all those instances?

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

Result :

https://es.dbpedia.org/sparql?default-graph-uri=&query=SELECT+%3Fproperty+%28GROUP_CONCAT%28DISTINCT+%3Fvalue+%3B+separator%3D%22%2C+%22%29+AS+%3FdistinctValues%29%0D%0AWHERE+%7B%0D%0A++%3Finstance+a+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FPolitician%3E+.%0D%0A++%3Finstance+%3Fproperty+%3Fvalue+.%0D%0A++FILTER+%28%3Fproperty+%21%3D+rdf%3Atype%29%0D%0A%7D&should-sponge=&format=text%2Fhtml&timeout=10000&debug=on&run=+Run+Query+

----------------------

Ejercicio 5 --> For each of these applicable properties, except for rdf:type, how many distinct values do they take globally for all those instances?

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

Result :

https://es.dbpedia.org/sparql?default-graph-uri=&query=SELECT+%3Fproperty+%28COUNT%28DISTINCT+%3Fvalue%29+AS+%3FnumDistinctValues%29%0D%0AWHERE+%7B%0D%0A++%3Finstance+a+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FPolitician%3E+.%0D%0A++%3Finstance+%3Fproperty+%3Fvalue+.%0D%0A++FILTER+%28%3Fproperty+%21%3D+rdf%3Atype%29%0D%0A%7D%0D%0AGROUP+BY+%3Fproperty&should-sponge=&format=text%2Fhtml&timeout=0&debug=on&run=+Run+Query+