lab09-sol

.pdf

School

Concordia University *

*We aren’t endorsed by this school

Course

6721

Subject

Computer Science

Date

Dec 6, 2023

Type

pdf

Pages

11

Uploaded by CaptainMaskWildcat29

Report
COMP 6721 Applied Artificial Intelligence (Fall 2023) Lab Exercise #09: Knowledge Graphs, Part II Solutions Question 1 Analyze and reason about RDF Schema class hierarchies and property inheri- tance in a theoretical context. This exercise focuses on your understanding of the concepts without the need to write RDF triples or code. a) Describe the relationships and reasoning within a class hierarchy that in- cludes Person , Employee , Manager , and Intern , where Manager and Intern are subclasses of Employee , and Employee is a subclass of Person . Hierarchy Description: Manager and Intern are depicted as subclasses of Employee , indicating a direct relationship. Employee is a subclass of Person , showing that all employees are persons by definition in the hierarchy. Reasoning: An individual identified as a Manager would inherit properties and characteristics of both Employee and Person , due to the subclass relationships in RDFS. b) Discuss the implications of assigning a property worksAt , with a domain of Employee and a range of Organization , to an individual of type Intern in terms of property inheritance in RDFS. Property Inheritance: The worksAt property, when applied to Employee , inherently extends to Intern , as Intern is a subclass of Employee . Explanation: This demonstrates how RDFS handles property inheritance, allowing subclasses to inherit properties from their superclasses, thus an Intern is understood to have the worksAt property. c) Conceptualize an advanced RDF Schema with a complex class hierarchy involving Person , Author , Academic , Student , GraduateStudent , and so on, and discuss the inferencing capabilities offered by such a schema. Schema Design Description: The schema would present GraduateStudent as a subclass of both Student and Academic . Further, Academic could be positioned as a subclass of Author , which is a subclass of Person . Inferencing Discussion: Such a schema enables inferencing at multiple levels, allowing the identification of a GraduateStudent as also being a Student , Academic , Author , and Person , illustrating the rich inferencing potential in RDFS. 1
Question 2 We’ll now continue the knowledge graph exercise from the previous week. Your next task is to develop a new vocabulary using RDF Schema (RDFS): The Friends-of-Concordia-University (FOCU) schema. This vocabulary should be able to express: (i) Classes for Student and Professor , both of which are subclasses of foaf:Person (ii) A University class, which is a subclass of foaf:Organization (iii) A property describing that a Student is enrolled at a University (iv) A property describing that a Professor teaches Students You can start with the following template (in Turtle format): @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix focu: <http://focu.io/schema#> . @prefix focudata: <http://focu.io/data#> . # RDF Schema for the FOCU Vocabulary focu:[CLASSNAME] a rdfs:Class ; rdfs:label "[LABEL]"@en . focu:[OTHERCLASSNAME] a rdfs:Class ; rdfs:subClassOf foaf:[CLASS] ; rdfs:label "[LABEL]"@en . focu:[PROPERTY] a rdf:Property ; rdfs:label "[LABEL]"@en ; rdfs:comment "[COMMENT]"@en ; rdfs:domain uni:[DOMAIN _ CLASS] ; rdfs:range uni:[RANGE _ CLASS] . (a) Add your RDFS triples for the four definitions above by filling in the missing parts in [square brackets] . (b) Validate your new RDF schema using the tools mentioned in last week’s lab and visualize them in form of a graph. (c) Now add some triples using your new FOCU vocabulary that describe yourself as a student at Concordia. Add information about yourself (age, email) using the FOAF vocabulary as we did on the lecture Worksheet #8. 2
(d) Again, validate and visualize your triples. Some notes: There are of course existing vocabularies for universities etc. and in a real system you would not create a new vocabulary duplicating existing definitions (just like we re-use FOAF to describe a person here). This is just for exercise purposes, so that you see how to define a minimal, working RDF Schema. We are using focu.io as the authority (domain name): This is again bad practice, since you do not control this domain name and thus cannot publish anything using this authority. The template above defines focudata: as the namespace for the triples describing university people; you could use another namespace here, like the example.org we’ve used before. The point here is that it is not good practice to mix schema information (in this case your FOCU schema) with data described using this schema into the same namespace. In other words, you want to be able to load the schema and the data separately from each other into a system. Can you add a triple that relates your new University definition to an existing concept in the FOAF vocabulary? Here’s a possible solution: @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix xsd: <http://www.w3.org/2001/XMLSchema#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix focu: <http://focu.io/schema#> . @prefix focudata: <http://focu.io/data#> . # RDF Schema for the FOCU Vocabulary focu:Student a rdfs:Class ; rdfs:subClassOf foaf:Person ; rdfs:label "Student"@en . focu:Professor a rdfs:Class ; rdfs:subClassOf foaf:Person ; rdfs:label "Professor"@en . focu:University a rdfs:Class ; rdfs:subClassOf foaf:Organization ; 3
rdfs:label "University"@en . focu:teaches a rdf:Property ; rdfs:label "teaches"@en ; rdfs:comment "Relationship showing professors teach the students."@en ; rdfs:domain focu:Professor ; rdfs:range focu:Student . focu:enrolledAt a rdf:Property ; rdfs:label "enrolled at"@en ; rdfs:comment "Relationship showing students enrolled at a university."@en ; rdfs:domain focu:Student ; rdfs:range focu:University . focudata:cu a focu:University ; owl:sameAs <http://dbpedia.org/resource/Concordia _ University> . focudata:john a focu:Student ; foaf:givenName "John" ; foaf:familyName "Smith" ; focu:enrolledAt focudata:cu . focudata:rene a focu:Professor ; foaf:givenName "Rene" ; foaf:familyName "Witte" ; focu:teaches focudata:john . Some notes: (i) Class Hierarchy : focu:Student and focu:Professor are defined as subclasses of foaf:Person to leverage the well-established FOAF vocabulary. focu:University as a subclass of foaf:Organization provides con- text within the Semantic Web. (ii) Property Definitions : focu:teaches establishes a teaching relationship, with focu:Professor as domain and focu:Student as range. focu:enrolledAt links students to universities, indicating educational affiliation. 4
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help