Skip to content

Commit 36d134d

Browse files
authored
Merge pull request #37 from adrigomez6/master
Assignment4
2 parents 7fef0c2 + 555f090 commit 36d134d

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

Assignment4/Adrian_Gomez_24C026/task06.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@
4141
4242
"""
4343

44-
# TO DO
4544
g.add((person.Person, RDF.type, RDFS.Class))
4645
g.add((person.Person, RDFS.label, Literal("Person", datatype=XSD.string)))
4746
g.add((person.Professor, RDF.type, RDFS.Class))
@@ -66,7 +65,6 @@
6665

6766
"""**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)**"""
6867

69-
# TO DO
7068
g.add((person.hasName, RDF.type, RDF.Property))
7169
g.add((person.hasName, RDFS.label, Literal("hasName", datatype=XSD.string)))
7270
g.add((person.hasName, RDFS.domain, person.Person))
@@ -90,7 +88,6 @@
9088

9189
"""**TASK 6.3: Create the individuals shown in slide 36 under "Datos". Link them with the same relationships shown in the diagram."**"""
9290

93-
# TO DO
9491
data=Namespace("http://oeg.fi.upm.es/resource/person/")
9592

9693
g.add((data.Raul, RDF.type, person.InterimAssociateProfessor))
@@ -115,7 +112,6 @@
115112
116113
"""
117114

118-
# TO DO
119115
vcard=Namespace("http://www.w3.org/2001/vcard-rdf/3.0/")
120116
foaf=Namespace("http://xmlns.com/foaf/0.1/")
121117

@@ -131,6 +127,7 @@
131127
g.add((data.Oscar, vcard.Family, Literal("Corcho García")))
132128
g.add((data.Oscar, vcard.Given, Literal("Oscar")))
133129
g.add((data.Oscar, foaf.email, Literal("ocorcho@fi.upm.es")))
130+
134131
# Visualize the results
135132
for s, p, o in g:
136133
print(s,p,o)

Assignment4/Adrian_Gomez_24C026/task07.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
# Visualize the results
3535
result = [(c, g.value(subject=c, predicate=RDFS.subClassOf, object=None)) for c,p,o in g.triples((None, RDF.type, RDFS.Class))]
36+
3637
for r in result:
3738
print(r)
3839

@@ -67,6 +68,7 @@ def get_subclasses(clase):
6768

6869
classes=get_subclasses(ns.Person)
6970
classes.append(ns.Person)
71+
7072
for cl in classes:
7173
individuals += [per for per,p,o in g.triples((None, RDF.type, cl))]
7274

@@ -116,6 +118,7 @@ def get_subclasses(clase):
116118
print(r.name)
117119

118120

121+
119122
## Validation: Do not remove
120123
report.validate_07_04(g,query)
121124
report.save_report("_Task_07")

Assignment4/Adrian_Gomez_24C026/validation.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,3 +256,4 @@ def validate_07_04(self, g, query):
256256
error = True
257257
if not error:
258258
self.__add_to_report("TASK 7.4 OK")
259+

0 commit comments

Comments
 (0)