150 likes | 162 Views
This exercise provides a description and diagram of the zoo ontology, including RDFS, RDF data, and RQL queries.
E N D
ΗΥ-566ΔΙΑΧΕΙΡΙΣΗ ΓΝΩΣΗΣ ΣΤΟ ΔΙΑΔΙΚΤΥΟΑσκηση 1 Πεδρο, Κατη και Μπεριτ Ελενη
The zoo ontology • Description and diagram of the domain. • RDFS. • RDF Data. • RQL Queries.
Description and diagram • .diagrams_and_concepts.pdf
RDFS (1 of 4) <rdfs:Class rdf:ID="Person"> <rdfs:comment>The class of all the persons.</rdfs:comment> </rdfs:Class> <rdf:Property rdf:ID="firstName"> <rdfs:comment>Implemets the first name of Person.</rdfs:comment> <rdfs:domain rdf:resource="#Person"/> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf- schema#Literal"/> </rdf:Property> <rdf:Property rdf:ID="telephoneNumber"> <rdfs:comment>Person's phone number.</rdfs:comment> <rdfs:domain rdf:resource="#Person"/> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/> </rdf:Property>
RDFS (2 of 4) <rdfs:Class rdf:ID="Employee"> <rdfs:comment> The class of Employee is a subclass ofPerson </rdfs:comment> <rdfs:subClassOf rdf:resource="#Person"/> </rdfs:Class> <rdf:Property rdf:ID="EmployeeID"> <rdfs:comment>The id for the Employee.</rdfs:comment> <rdfs:domain rdf:resource="#Employee"/> <rdfs:range rdf:resource="http://www.w3.org/2000/01/rdf-schema#Literal"/> </rdf:Property>
RDFS (3 of 4) <rdfs:Class rdf:ID="AnimalWorker"> <rdfs:comment> The class AnimalWorker is a sublass of Employee </rdfs:comment> <rdfs:subClassOf rdf:resource="#Employee"/> </rdfs:Class> <rdfs:Class rdf:ID="Animal"> <rdfs:comment>This is the class of the Animals.</rdfs:comment> </rdfs:Class> <rdfs:Class rdf:ID="Cage"> <rdfs:comment> The class of all the Cages for the Animals </rdfs:comment> </rdfs:Class>
RDFS (4 of 4) <rdf:Property rdf:ID="takesCareOf"> <rdfs:comment>Property which makes a relation between an AnimalWorker and an Animal. An AnimalWorker can take care of one or more Animals.</rdfs:comment> <rdfs:domain rdf:resource="#AnimalWorker"/> <rdfs:range rdf:resource="#Animal"/> </rdf:Property> <rdf:Property rdf:ID="cleans"> <rdfs:comment>Property which makes a relation between an AnimalWorker and a Cage. An AnimalWorker can clean one or more Cages.</rdfs:comment> <rdfs:domain rdf:resource="#AnimalWorker"/> <rdfs:range rdf:resource="#Cage"/> </rdf:Property> <rdf:Property rdf:ID="livesIn"> <rdfs:comment>Property which makes a relation between an Animal and a Cage. One Animal lives in one Cage.</rdfs:comment> <rdfs:domain rdf:resource="#Animal"/> <rdfs:range rdf:resource="#Cage"/> </rdf:Property>
RDF Data (1 of 3) <rdf:RDF xml:lang="en" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:zoo="myZoo"> <zoo:Cage rdf:ID="cage2" zoo:cageID="002" zoo:size="10x10x10" zoo:buildingDate="12/12/2000" /> <zoo:AnimalWorker zoo:firstName="Janis" zoo:lastName="Halkiadakis" zoo:telephoneNumber="123456789" zoo:addressStreet="Dimokratias 22" zoo:addressCity="Iraklion" zoo:addressCountry="Greece" zoo:dateOfBirth="21/11/71" zoo:sex="male"
RDF Data (2 of 3) zoo:employeeID="0004" zoo:salary="1000" zoo:absentDays="44" zoo:hiredDate="12/12/2000" zoo:contractType="Full time" zoo:specialization="land" zoo:freeDay="Tuesday" zoo:animalPreferences="cats“> <zoo:cleans rdf:resource="#cage1“/> <zoo:belongsTo rdf:resource="#dept3“/> <zoo:takesCareOfrdf:resource="#animal1“/> </zoo:AnimalWorker>
RDF Data (3 of 3) <zoo:WaterAnimal rdf:ID="animal2“ zoo:animalID="0002" zoo:latinName="Fishus" zoo:englishName="Fish" zoo:birthDate="12/12/2001" zoo:length="1m" zoo:weight="8kg" zoo:height="10cm" zoo:arrivalDate="12/12/2001" zoo:plantEater="yes" zoo:threatened="no" zoo:dailyFoodAmount="1kg" zoo:temperature="33" zoo:poisonous="no" zoo:saltPercentageInWater=“3" zoo:minVolumeInWater="90“> <zoo:livesIn rdf:resource="#cage2“/> </zoo:WaterAnimal>
RQL (1 of 4) -Find english name of all animals who are threatened: select N from Animal{X}, {Y}englishName{N}, {Z}threatened{P} where X=Y and X=Z and P="true" -Find first and last name of all animal workers who takes care of poisonous animals: select F,L from AnimalWorker{X}, {Y}firstName{F}, {Z}lastName{L}, AnimalWorker{S}.takesCareOf{T}, {U}poisonous{V} where X=Y and X=Z and X=S and T=U and V="true"
RQL (2 of 4) -Find first name, last name and telephone number of employees more than 5 absent days: select F,L,PH from Employee{X}, {Y}firstName{F}, {Z}lastName{L}, {U}telephoneNumber{PH}, {V}absentDays{W} where X=Y and X=Z and X=U and X=V and W>5 -Find all classes: Class
RQL (3 of 4) -Find the animal workers (first and last name), and the animals (animal ID) they take care of: select F,L,AID from AnimalWorker{X}.takesCareOf{Y}, {V}firstName{F}, {W}lastName{L}, {U}animalID{AID} where Y=U and X=V and X=W - Find which animal (animal ID) lives in the cage with id="cage1": select AID from Animal{X}.livesIn{Y}, {Z}cageID{W}, {U}animalID{AID} where Y=Z and W="cage1“ and X=U
RQL (4 of 4) - The employees (first and last name) who works in the department with id="01": select F,L from Employee{X}, {U}belongsTo{B}, {Z}deptID{W},{V}firstName{F}, {S}lastName{L} where X=U and B=Z and W="01 and V=X and S=X - Find the english name for the animal which is taken care of by the animal worker with ID=“0001" select N from animal{A}.isTreatedBy{W}, {C}englishName{N}, {W}employeeID{X} where X=“0001" and A=C