You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""**TASK 6.1: Reproduce the taxonomy of classes shown in slide 34 in class (all the classes under "Vocabulario", Slidedeck: 01a.RDF(s)-SPARQL). Add labels for each of them as they are in the diagram (exactly) with no language tags. Remember adding the correct datatype (xsd:String) when appropriate**
"""**TASK 6.2: Add the 3 properties shown in slide 36. Add labels for each of them (exactly as they are in the slide, with no language tags), and their corresponding domains and ranges using RDFS. Remember adding the correct datatype (xsd:String) when appropriate. If a property has no range, make it a literal (string)**"""
"""**TASK 6.4: Add to the individual person:Oscar the email address, given and family names. Use the properties already included in example 4 to describe Jane and John (https://raw.githubusercontent.com/FacultadInformatica-LinkedData/Curso2025-2026/master/Assignment4/course_materials/rdf/example4.rdf). Do not import the namespaces, add them manually**
"""**TASK 7.1a: For all classes, list each classURI. If the class belogs to another class, then list its superclass.**
31
+
**Do the exercise in RDFLib returning a list of Tuples: (class, superclass) called "result". If a class does not have a super class, then return None as the superclass**
"""**TASK 7.2b: Repeat the same exercise in SPARQL, returning the individual URIs in a variable ?ind**"""
89
+
90
+
query="""
91
+
PREFIX ns: <http://oeg.fi.upm.es/def/people#>
92
+
93
+
SELECT ?ind WHERE {
94
+
?ind rdf:type/rdfs:subClassOf* ns:Person .
95
+
}
96
+
"""
97
+
98
+
forring.query(query):
99
+
print(r.ind)
100
+
# Visualize the results
101
+
102
+
## Validation: Do not remove
103
+
report.validate_07_02b(g, query)
104
+
105
+
"""**TASK 7.3: List the name and type of those who know Rocky (in SPARQL only). Use name and type as variables in the query**"""
106
+
107
+
query="""
108
+
PREFIX ns: <http://oeg.fi.upm.es/def/people#>
109
+
SELECT ?name ?type WHERE {
110
+
?x ns:knows ns:Rocky .
111
+
?x rdfs:label ?name .
112
+
?x a ?type .
113
+
}
114
+
"""
115
+
# TO DO
116
+
# Visualize the results
117
+
forring.query(query):
118
+
print(r.name, r.type)
119
+
120
+
## Validation: Do not remove
121
+
report.validate_07_03(g, query)
122
+
123
+
"""**Task 7.4: List the name of those entities who have a colleague with a dog, or that have a collegue who has a colleague who has a dog (in SPARQL). Return the results in a variable called name**"""
"""Tarea: lista todos los elementos de la clase Person en el primer grafo (data01.rdf) y completa los campos (given name, family name y email) que puedan faltar con los datos del segundo grafo (data02.rdf). Puedes usar consultas SPARQL o iterar el grafo, o ambas cosas."""
"""Busca individuos en los dos grafos y enlázalos mediante la propiedad OWL:sameAs, inserta estas coincidencias en g3. Consideramos dos individuos iguales si tienen el mismo apodo y nombre de familia. Ten en cuenta que las URI no tienen por qué ser iguales para un mismo individuo en los dos grafos."""
0 commit comments