Скачать презентацию Web technologies weekly exercises Answers 1 1 Скачать презентацию Web technologies weekly exercises Answers 1 1

6caafbab80fbeacd77d8b5b76cfe8768.ppt

  • Количество слайдов: 59

Web – technologies / weekly exercises Answers (1/1) <person> <name> <first_name>Alan</first_name> <last_name>Turing></last_name> </name> <profession>computer Web – technologies / weekly exercises Answers (1/1) Alan Turing> computer scientists mathematician cryptographer

Web – technologies / Weekly exercises Number 1 1. Give an XML-document (by not Web – technologies / Weekly exercises Number 1 1. Give an XML-document (by not using attributes), which includes the information that the first name of a person is Alan, his last name is Turing, and his professions are computer scientist, mathematician and cryptographer. 2. Give the tree diagram of the document given in 1. 3. Modify the document given in exercise 1 such that the “first” and “last” are the attributes of the name element

Web – technologies / weekly exercises Answers (1/2) person name first_name Alan last-name Turing Web – technologies / weekly exercises Answers (1/2) person name first_name Alan last-name Turing profession computer scientist profession mathematician profession cryptographer

Web – technologies / weekly exercises Answers (1/3) <person first_name=“Alan” last_name=“Turing”> <profession>computer scientists</profession> <profession>mathematician</profession> Web – technologies / weekly exercises Answers (1/3) computer scientists mathematician cryptographer

Web – technologies / Weekly exercises Number 2 1. Give an XML-document (by not Web – technologies / Weekly exercises Number 2 1. Give an XML-document (by not using attributes), which includes the following information: the social security number (123456789 A), the first name of a person is Jack, and his last name is Taylor, his address is composed of postcode (0500), city (Boston) and street (Hamilton street), and his telephone numbers are 12345 and 6789. 2. Give the tree diagram of the document given in exercise 1. 3. Give a DTD (Document Type Definition) for the XML-document specified in exercise 1. 4. Give an XML Schema for the information specified in exercise 1. Validate the schema using the validator located at : http: //www. stg. brown. edu/service/xmlvalid/ 5. Give an instance of a the XML Schema specified in exercise 4.

Web – technologies / weekly exercises Answers (1/2) <person> <social_security_number>123456789 A</social_security_number> <name> <first_name>Jack</first_name> <last_name>Taylor</last_name> Web – technologies / weekly exercises Answers (1/2) 123456789 A Jack Taylor

Boston 0500 Hamilton Street>
12345

Web – technologies / weekly exercises Answers (2/2) Person name Social_ securitynumber 1234. . Web – technologies / weekly exercises Answers (2/2) Person name Social_ securitynumber 1234. . 9 A first_ name last_ name Jack Taylor address city Boston postcode 0500 Telephone_ number street 12345 Hamilton street Telephone_ number 6789

Web – technologies / weekly exercises Answers (3/2) <!ELEMENT person <!ELEMENT social_security_number <!ELEMENT name Web – technologies / weekly exercises Answers (3/2) (#PCDATA)> (first_name, last_name)> (#PCDATA)> (city, postcode, street)> (#PCDATA)>

Web – technologies / weekly exercises Answers (4/2) <xsd: element name = “person”> <xsd: Web – technologies / weekly exercises Answers (4/2)

Web – technologies / weekly exercises Answers (5/2) <person social_security_number = “ 123456789 A”> Web – technologies / weekly exercises Answers (5/2) Jack Taylor

Boston 0500 Hamilton
12345

Web – technologies / Weekly exercises Number 3 1. Give a conceptual schema (using Web – technologies / Weekly exercises Number 3 1. Give a conceptual schema (using ER-design) about teams, players, and their fans, including • • • For each team, its name, its players, its team captain (one of its players), and the colors of its uniform. For each player, his/her name. For each fan, his/her name, favorite teams, favorite players, and favorite color. 2. Do exercise 1 using UML-design 3. Capture the knowledge, using the graph of N 3 notation, of the following English statements: – – – 4. Jack Smith studies at Helsinki University has a web site at http: //www. helsinki. fi/university/ Jack is a friend of Elisa Ford studies at Lappeenranta University of Technology has a website at http: //www. lut. fi/en/ Elisa Ford has a website at http: //www. lut. fi/elisa Using UML give a schema for the statements given in exercise 3.

Answer 3. 1 Web – technologies / Weekly exercises Answers 3 name plays name Answer 3. 1 Web – technologies / Weekly exercises Answers 3 name plays name Player Team is-captain uniformscolors Color color-name favoriteteams favoritecolor favoriteplayers Fan name

Answer 3. 2 Web – technologies / Weekly exercises Answers 3 Player name plays-in Answer 3. 2 Web – technologies / Weekly exercises Answers 3 Player name plays-in is_captain Team name uniform_colors Fan name favorite color favorite_palyer favorite_teams

Web – technologies / Weekly exercises Answers 3 Answer 3. 3 #studies_at #Jack Smith Web – technologies / Weekly exercises Answers 3 Answer 3. 3 #studies_at #Jack Smith #Helsinki University #has-website http: //www. helsinki. fi/university #friend-of #Elisa Ford #studies-at #Lappeenranta University of Technology #has-website http: //www. lut. fi/elisa #has-website http: //www. lut. fi/en

Answer 3. 4 Web – technologies / Weekly exercises Answers 3 Person name has-website Answer 3. 4 Web – technologies / Weekly exercises Answers 3 Person name has-website friend-of studies-at University name has-website

Web – technologies / Weekly exercises Number 4 1. Modify the xml file of Web – technologies / Weekly exercises Number 4 1. Modify the xml file of the slide page 198 and the style sheet presented at pages 201 and 202 such that the final layout would look as follows Project: Trumantruck. com Work Schedule Date 2000025 2000225 2000311 Description Taking Truck Body Apart Sandblasting Dismantling Cab Sanding, Priming Hood and Fender Hours 2 3 4

Web – technologies / Weekly exercises Answers Number 4 Answer 4. 1 <? xml Web – technologies / Weekly exercises Answers Number 4 Answer 4. 1 Rebuilding a 1967 Chevy Pickup Truck 20000205> Taking Truck Body Apart 2 20000225> Sandblasting, Dismantling Cab 3 200003111> Sanding, Priming Hood and Fender 4

Web – technologies / Weekly exercises Answers Number 4 Answer 4. 1 continues <xsl: Web – technologies / Weekly exercises Answers Number 4 Answer 4. 1 continues Schedule For <xsl: value-of select=“/project/@name”/> <xsl: value-of select=“/project/description”/>

Date Description Hours

Web – technologies / Weekly exercises Answers Number 4 Answer 4. 1 continues <xsl: Web – technologies / Weekly exercises Answers Number 4 Answer 4. 1 continues Project :


Work Schedule

Web – technologies / Weekly exercises Number 5 1. Give an a taxonomy, which Web – technologies / Weekly exercises Number 5 1. Give an a taxonomy, which can be used in classifying learning objects of computer science. 2. Give a thesarus that describes information entities such as course, laboratory course, exercise, exam, class room, course book, laboratory, lecturer and laboratory room. 3. Give a conceptual schema using ER-schema notation that models the entities stated in exercise 2 and their relationships. 4. State using first order predicate logic “everyone who has enrolment of the Java course has a registration on that course”.

RDF-exercises RDF-exercises

RDF-Exercise 1. Give an RDF_description that states the following: Resource http: //www. hut. fi/~jack/homepage RDF-Exercise 1. Give an RDF_description that states the following: Resource http: //www. hut. fi/~jack/homepage is a homepage and it is owned by Jack Taylor. Answer RDF-Excercise 1. Jack Taylor

RDF-Exercise 2. Give an RDF_description that states the following: Resource http: //www. innouni. fi/innouni-ns/#T-999”> RDF-Exercise 2. Give an RDF_description that states the following: Resource http: //www. innouni. fi/innouni-ns/#T-999”> is a course named Javaprogramming and is lectured by Lisa Smith at room T 2. Answer RDF-Excercise 2. Java-programming Lisa Smith T 2

RDF-Exercise 3. By using container elemn rdf : Bag, give an RDF_description that states RDF-Exercise 3. By using container elemn rdf : Bag, give an RDF_description that states the following: Mary and John owns the car ABC-99 Answer RDF-Excercise 3.

RDF-Exercise 4. By using the ”collection” value of the rdf : parse. Type attribute RDF-Exercise 4. By using the ”collection” value of the rdf : parse. Type attribute give an RDF_description that states the following: Mary and John owns the car ABC -99 Answer RDF-Excercise 4.

RDF Schema-exercises RDF Schema-exercises

RDFS-Exercise 1. Give a graphical presentation and RDF Schema that describe the following: Professors RDFS-Exercise 1. Give a graphical presentation and RDF Schema that describe the following: Professors and assistants are subclasses of teachers. Each techer has a name. Each course has a course_id. Professors lecture courses while assistants suprervise courses. domain Course range Assistant supervises teacher_name sub. Class. Of domain course_id range domain range Teacher lectures domain sub. Class. Of Professor Literal

<rdf : RDF xmlns : rdf=”http: //www. w 3. org/1999/02/22 -rdf-syntax-ns#” xmlns : rdfs=http: The class of assistants. The class of professors. The class of teachers The class of courses

<rdfs: Property rdf: ID=”lectures”> <rdfs: comment> It relates professors to courses </rdfs: comment> <rdfs: It relates professors to courses It relates assistants to courses

<rdfs: Property rdf: ID=”lecturer_name”> <rdfs: comment> It is a property of teachers and takes It is a property of teachers and takes literals as values. It is a property of courses and takes literals as values.

Execise 2. RQL-Exercise. By using RQL and the RDF Schema of the previous exercise Execise 2. RQL-Exercise. By using RQL and the RDF Schema of the previous exercise give the following queries: a) b) c) Retrieve all the instances of the class Teacher Retrieve aal the inatances of the class Teacher that are iether profwssors or assistanra. Retrieve the names of the assistants. Answers: a) teacher b) ^teacher c) select X, Y from assistant{X}. teacher_name {Y}

Execise 3. Discuss the difference vbetween the following statements, and draw graphs to illustrate Execise 3. Discuss the difference vbetween the following statements, and draw graphs to illustrate the difference: X supports the proposal; Y supports the propodsal; Z supports the proposal. The group of X, Y, and Z supports the proposal. Draw graphs to illustrate the difference. X Y Z supports the proposal

X belongs Y the group belongs Z supports the proposal X belongs Y the group belongs Z supports the proposal

Exercise 4. Compare rdfs: sub. Class. Of with type extension in XML Schema Exercise 4. Compare rdfs: sub. Class. Of with type extension in XML Schema

Exercise 5. Try to map the relational database model on RDF. Exercise 5. Try to map the relational database model on RDF.

Exercise 6. Compare entity-relationship modelling to RDF. Exercise 6. Compare entity-relationship modelling to RDF.

Exercise 7. Model part of a library in RDF Schema: books, authors, publishers, years, Exercise 7. Model part of a library in RDF Schema: books, authors, publishers, years, copies, dates, and so on. Then write some statements in RDF, and query them using RQL. literal Author range year written. By domain ISBN domain Book range domain range literal published. By publishret. Name range presents Publisher Copy domain copy. Number range literal domain

<rdf: RDF xmlns: rdf=“http. w 3. org/1999/02/22 -rdf-syntax-ns#” xmlns: rdfs=“http. w 3. org/2000/01/rdf-schema#”> <rdfs: The class of books The class of publishers It relates books to publishers

<rdfs: Property rdf: ID=”ISBN”> <rdfs: comment> It is a property of books and takes It is a property of books and takes literals as values.

RDF-satatements <mydomain: book rdf: ID=” 12345” mydomain: ISBN = ”abc 567”> <mydomain: published. By RDF-satatements The same RDF-description by not using abbreviated syntax abc 567

 • Queries: a) Retrieve all the instances of the book class? Anwer: book • Queries: a) Retrieve all the instances of the book class? Anwer: book b) Retrieve all books and their ISBN: s: Answer: select X, Y from book {X}. ISBN {y} c) Retrieve all the ISBN: s of the books published by Prentice-Hall Answer: select N from book {X}. published. By {Y}, {C} ISBN {N} where Y= ”Prentice-Hall” and X=C

Exercise 8. Write an ontology about geography: cities, countries, capitals, borders, states, and so Exercise 8. Write an ontology about geography: cities, countries, capitals, borders, states, and so on. domain country. Name range domain country range border range literal belongs is. Part. Of domain locates city is. Sub. Class. Off capital state

<rdf: RDF xmlns: rdf=“http. w 3. org/1999/02/22 -rdf-syntax-ns#” xmlns: rdfs=“http. w 3. org/2000/01/rdf-schema#”> <rdfs: The class of countries The class of cities The class of states It relates cities to countries

<rdfs: Property rdf: ID=”locates”> <rdfs: comment> It relates cities to states </rdfs: comment> <rdfs: It relates cities to states It relates states to countries The class of capitals

<rdfs: Property rdf: ID=”border”> <rdfs: comment> It relates bordersto countries </rdfs: comment> <rdfs: domain It relates bordersto countries It is a property of countries and takes literals as values.

Exercise 9. Consider the classes of males and females. Name a relationship between them Exercise 9. Consider the classes of males and females. Name a relationship between them that should be included in an ontology. Answer: relationship husbend. Of; inverse wife. Of

Exercise 10. Consider the classes of persons, males and females. Name a relationship between Exercise 10. Consider the classes of persons, males and females. Name a relationship between all the three that should be included in an ontology. Which part of this relationship can be expressed in RDF Schema. Answer. Husband, Wife, Mother, Father

Exercise 11. Suppose we declare Bob and Peter to be the father of Mary. Exercise 11. Suppose we declare Bob and Peter to be the father of Mary. Obviously there is a semantic error here. How should the semantic model make this error impossible? Answer: by a cardinality restriction.

Exercise 12. What relationship exist between ”is child of” and ”is parent of” ? Exercise 12. What relationship exist between ”is child of” and ”is parent of” ? Answer: inverse relationship

Exercise 13. Consider the property eats with domain animal and range animal or plant. Exercise 13. Consider the property eats with domain animal and range animal or plant. Suppose we define a new class vegetarian. Name a desirable restriction on eats for this class. Do you think that this restriction can be expressed in RDF Schema by using rdfs : range ? Answer: Specifying a subclass by restrictiong the range of a property is outside the expression power of RDF Schema. In particular, rdfs : range defines the range, e. g. , eats, for all classes.

OWL-exercises OWL-exercises

OWL-Exercise 1. Give an OWL-ontology that describes the following: There are courses and laboratory OWL-Exercise 1. Give an OWL-ontology that describes the following: There are courses and laboratory courses. Homeworks are part of courses. Courses are organized by teachers. Teachers are either professors or assistants. Professors teach courses while assistants only teach laboratory courses. organize course teacher sub. Class. Of is. Part. Of homework sub. Class. Of laboratory-course professor assistant teach

<rdf: RDF xmlns: rdf=http: //www. w 3. org/1999/02/22 -rdf-syntax-nsl# xmlns: rdfs=http: //www. w 3. Courses form a class. Laboratory course is a type of course.

<owl: Class rdf: ID=“teacher”> <rdfs: comment>Teachers form a class. </rdfs: comment> </owl: Class> <owl: Teachers form a class. Assistants are exactly those teachers that teach laboratory courses.

<owl: Class rdf: ID=“professor”> <rdfs: comment>Professors are exactly those teachers that teach laboratory courses. Professors are exactly those teachers that teach laboratory courses.

OWL-Exercise 2. Give an OWL-ontology that describes the following: a) Medicinal products are either OWL-Exercise 2. Give an OWL-ontology that describes the following: a) Medicinal products are either over the counter drugs or prescription based drugs. Each medicinal product includes an active substance. In addition each medicinal product is substitutable by zero or more medicinal products. b) Panadol is an instance of over the counter drug, Tramadol is an instance of prescription based drug, and Loperamide is an instance of active substance.

Answer a) <rdf: RDF xmlns: rdf=http: //www. w 3. org/1999/02/22 -rdf-syntax-nsl# xmlns: rdfs=http: //www. Answer a) Medicinal products form a class.

<owl: Object. Property rdf: ID=“includes”> <rdfs: domain rdf: resource=“#medicinal. Product”/> <rdfs: range rdf: resource=“#active.

Answer b) <rdf Description rdf : ID=”Panadol”/> <rdf : type rdf : resource= ”#over. Answer b)