Σημασιολογικός Ιστός (Semantic Web) - XML

Σχετικά έγγραφα
ΣΗΜΑΣΙΟΛΟΓΙΚΟΣ ΙΣΤΟΣ - XML

ΑΝΑΠΑΡΑΣΤΑΣΗ ΓΝΩΣΗΣ ΣΤΟΝ ΠΑΓΚΟΣΜΙΟ ΙΣΤΟ

Σημασιολογικός Ιστός (Semantic Web) - XML

Πανεπιστήμιο Πειραιώς Σχολή Τεχνολογιών Πληροφορικής και Επικοινωνιών Τμήμα Ψηφιακών Συστημάτων ιαχείριση εδομένων στον Παγκόσμιο Ιστό

Προγραμματισμός και Συστήματα στον Παγκόσμιο Ιστό Ενότητα 5: XML. Καθ. Ιωάννης Γαροφαλάκης Πολυτεχνική Σχολή Μηχανικών Η/Υ & Πληροφορικής

Σημασιολογικός Ιστός (Semantic Web) - XML

Δομημένη Αναπαράσταση Πληροφοριών

Αναπαράςταςθ Γνϊςθσ ςτον Παγκόςμιο Ιςτό Ενότθτα 2: XML Δομθμζνα Ζγγραφα Ιςτοφ, Μζροσ 3 ο XML Schema

Εισαγωγή(στη(γλώσσα(XML(

ΠΤΥΧΙΑΚΗ ΕΡΓΑΣΙΑ. Graphical XML Schema

Μοντέλο. για ημι-δομημένα μημ δεδομένα. Ημι-δομημένα δεδομένα XML DTD XML Schema

Τα web services του παρατηρητηρίου τιμών ακολουθούν λογική REST και απαντούν σε GET requests ως ακολούθως:

2 Composition. Invertible Mappings

derivation of the Laplacian from rectangular to spherical coordinates

Πανεπιστήμιο Κρήτης Τμήμα Επιστήμης Υπολογιστών. ΗΥ-561 Διαχείριση Δεδομένων στο Παγκόσμιο Ιστό Ειρήνη Φουντουλάκη Βασίλης Χριστοφίδης

Other Test Constructions: Likelihood Ratio & Bayes Tests

ST5224: Advanced Statistical Theory II

Finite Field Problems: Solutions

CHAPTER 25 SOLVING EQUATIONS BY ITERATIVE METHODS

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

Μορφοποίηση υπό όρους : Μορφή > Μορφοποίηση υπό όρους/γραμμές δεδομένων/μορφοποίηση μόο των κελιών που περιέχουν/

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 6/5/2006

Assalamu `alaikum wr. wb.

Homework 3 Solutions

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 19/5/2007

C.S. 430 Assignment 6, Sample Solutions

Math 6 SL Probability Distributions Practice Test Mark Scheme

ΠΑΝΕΠΙΣΤΗΜΙΟ ΚΥΠΡΟΥ - ΤΜΗΜΑ ΠΛΗΡΟΦΟΡΙΚΗΣ ΕΠΛ 133: ΑΝΤΙΚΕΙΜΕΝΟΣΤΡΕΦΗΣ ΠΡΟΓΡΑΜΜΑΤΙΣΜΟΣ ΕΡΓΑΣΤΗΡΙΟ 3 Javadoc Tutorial

Approximation of distance between locations on earth given by latitude and longitude

Πρόβλημα 1: Αναζήτηση Ελάχιστης/Μέγιστης Τιμής

ΕΛΛΗΝΙΚΗ ΔΗΜΟΚΡΑΤΙΑ ΥΠΟΥΡΓΕΙΟ ΕΣΩΤΕΡΙΚΩΝ

Mean bond enthalpy Standard enthalpy of formation Bond N H N N N N H O O O

Second Order RLC Filters

EE512: Error Control Coding

ΚΥΠΡΙΑΚΗ ΕΤΑΙΡΕΙΑ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ 24/3/2007

Case 1: Original version of a bill available in only one language.

Μητρώο [.gr] Οδηγός ιασύνδεσης. Αξιοποίησης του Εξυπηρετητή EPP. Έκδοση 2.0. [ EPP Server Connection and Use Guide ]

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 5: Component Adaptation Environment (COPE)

Πανεπιστήµιο Κρήτης Τµήµα Επιστήµης Υπολογιστών. ΗΥ-561 ιαχείριση εδοµένων στο Παγκόσµιο Ιστό Βασίλης Χριστοφίδης

Example Sheet 3 Solutions

Lecture 2: Dirac notation and a review of linear algebra Read Sakurai chapter 1, Baym chatper 3

ΕΓΧΕΙΡΙΔΙΟ ΧΡΗΣΗΣ ΕΤΑΙΡΕΙΩΝ ΔΙΑΜΕΣΟΛΑΒΗΣΗΣ ΣΤΗ ΜΕΤΑΦΟΡΑ ΚΕΦΑΛΑΙΩΝ

Numerical Analysis FMN011

Ordinal Arithmetic: Addition, Multiplication, Exponentiation and Limit

Inverse trigonometric functions & General Solution of Trigonometric Equations

Every set of first-order formulas is equivalent to an independent set

( ) 2 and compare to M.

HOMEWORK 4 = G. In order to plot the stress versus the stretch we define a normalized stretch:

Section 8.3 Trigonometric Equations

1) Formulation of the Problem as a Linear Programming Model

ω ω ω ω ω ω+2 ω ω+2 + ω ω ω ω+2 + ω ω+1 ω ω+2 2 ω ω ω ω ω ω ω ω+1 ω ω2 ω ω2 + ω ω ω2 + ω ω ω ω2 + ω ω+1 ω ω2 + ω ω+1 + ω ω ω ω2 + ω

Πανεπιστήμιο Κρήτης Τμήμα Επιστήμης Υπολογιστών. ΗΥ-561 Διαχείριση Δεδομένων στο Παγκόσμιο Ιστό Βασίλης Χριστοφίδης

3. Επερώτηση XML Εγγράφων: Η Γλώσσα XPath

Μητρώο [.gr] Οδηγός ιασύνδεσης. Αξιοποίησης του Εξυπηρετητή EPP. Έκδοση 3.0. [ EPP Server Connection and Use Guide ]

Lecture 2. Soundness and completeness of propositional logic

extensible Markup Language: XML

α) Όσον αφορά το γενικό μήνυμα :

Second Order Partial Differential Equations

Web Services. και SOAP

Problem Set 3: Solutions

Section 9.2 Polar Equations and Graphs

The Simply Typed Lambda Calculus

3.4 SUM AND DIFFERENCE FORMULAS. NOTE: cos(α+β) cos α + cos β cos(α-β) cos α -cos β

Potential Dividers. 46 minutes. 46 marks. Page 1 of 11

Chapter 3: Ordinal Numbers

Concrete Mathematics Exercises from 30 September 2016

Μηχανική Μάθηση Hypothesis Testing

Ψηφιακή ανάπτυξη. Course Unit #1 : Κατανοώντας τις βασικές σύγχρονες ψηφιακές αρχές Thematic Unit #1 : Τεχνολογίες Web και CMS

Εργαστήριο Ανάπτυξης Εφαρμογών Βάσεων Δεδομένων. Εξάμηνο 7 ο

SOAP API. Table of Contents

5.4 The Poisson Distribution.

MathCity.org Merging man and maths

Dynamic types, Lambda calculus machines Section and Practice Problems Apr 21 22, 2016

ORDINAL ARITHMETIC JULIAN J. SCHLÖDER

XML Schemas. (Primer) (Structures) (Datatypes)

SCHOOL OF MATHEMATICAL SCIENCES G11LMA Linear Mathematics Examination Solutions

Fourier Series. MATH 211, Calculus II. J. Robert Buchanan. Spring Department of Mathematics

Section 7.6 Double and Half Angle Formulas

Bounding Nonsplitting Enumeration Degrees

Econ 2110: Fall 2008 Suggested Solutions to Problem Set 8 questions or comments to Dan Fetter 1

How to register an account with the Hellenic Community of Sheffield.

PortSip Softphone. Ελληνικά Ι English 1/20

ΣΗΜΑΣΙΟΛΟΓΙΚΟΣ ΙΣΤΟΣ - XML

Απόκριση σε Μοναδιαία Ωστική Δύναμη (Unit Impulse) Απόκριση σε Δυνάμεις Αυθαίρετα Μεταβαλλόμενες με το Χρόνο. Απόστολος Σ.

Automating Complex Workflows using Processing Modeler

The challenges of non-stable predicates

ANSWERSHEET (TOPIC = DIFFERENTIAL CALCULUS) COLLECTION #2. h 0 h h 0 h h 0 ( ) g k = g 0 + g 1 + g g 2009 =?

ΚΥΠΡΙΑΚΟΣ ΣΥΝΔΕΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ CYPRUS COMPUTER SOCIETY 21 ος ΠΑΓΚΥΠΡΙΟΣ ΜΑΘΗΤΙΚΟΣ ΔΙΑΓΩΝΙΣΜΟΣ ΠΛΗΡΟΦΟΡΙΚΗΣ Δεύτερος Γύρος - 30 Μαρτίου 2011

Εισαγωγή στη γλώσσα XML

Lecture 34 Bootstrap confidence intervals

Στο εστιατόριο «ToDokimasesPrinToBgaleisStonKosmo?» έξω από τους δακτυλίους του Κρόνου, οι παραγγελίες γίνονται ηλεκτρονικά.

Jesse Maassen and Mark Lundstrom Purdue University November 25, 2013

Partial Trace and Partial Transpose

A Note on Intuitionistic Fuzzy. Equivalence Relation

Practice Exam 2. Conceptual Questions. 1. State a Basic identity and then verify it. (a) Identity: Solution: One identity is csc(θ) = 1

Physical DB Design. B-Trees Index files can become quite large for large main files Indices on index files are possible.

Lecture 15 - Root System Axiomatics

ΑΚΑ ΗΜΙΑ ΕΜΠΟΡΙΚΟΥ ΝΑΥΤΙΚΟΥ ΜΑΚΕ ΟΝΙΑΣ ΣΧΟΛΗ ΜΗΧΑΝΙΚΩΝ ΠΤΥΧΙΑΚΗ ΕΡΓΑΣΙΑ

UNIVERSITY OF CALIFORNIA. EECS 150 Fall ) You are implementing an 4:1 Multiplexer that has the following specifications:

Galatia SIL Keyboard Information

Transcript:

Πανεπιστήμιο Πειραιώς Τμήμα Ψηφιακών Συστημάτων Σημασιολογικός Ιστός (Semantic Web) - XML Δρ. Ανδριάνα Πρέντζα Αναπληρώτρια Καθηγήτρια aprentza@unipi.gr

Πανεπιστήμιο Πειραιά Τμήμα Ψηφιακών Συστημάτων XML Schema

Let s create the XML Schema!!!!

<?xml version="1.0" encoding="iso-8859-1"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="shiporder"> <xs:complextype> <xs:sequence> <xs:element name="orderperson" type="xs:string"/> <xs:element name="shipto"> <xs:complextype> <xs:sequence> <xs:element name="name" type="xs:string"/> <xs:element name="address" type="xs:string"/> <xs:element name="city" type="xs:string"/> <xs:element name="country" type="xs:string"/> </xs:sequence> </xs:complextype> </xs:element> <xs:element name="item" maxoccurs="unbounded"> <xs:complextype> <xs:sequence> <xs:element name="title" type="xs:string"/> <xs:element name="note" type="xs:string" minoccurs="0"/> <xs:element name="quantity" type="xs:positiveinteger"/> <xs:element name="price" type="xs:decimal"/> </xs:sequence> </xs:complextype> </xs:element> </xs:sequence> <xs:attribute name="orderid" type="xs:string" use="required"/> </xs:complextype> </xs:element> </xs:schema> This design method is very simple, but can be difficult to read and maintain when documents are complex. The next design method is based on defining all elements and attributes first, and then referring to them using the ref attribute.

Άσκηση Να καθοριστεί νέος τύπος δεδομένων σε ένα XML Schema ο οποίος να διαδέχεται τις ακέραιες τιμές από -100 έως το 500.

Άσκηση Tο XML Schema φαίνεται παρακάτω.

Επεξήγηση... complextype: ορίζει σύνθετο τύπο που υποστηρίζει ιδιότητες και περιεχόμενα στοιχείων simpletype: ορίζει απλό τύπο complexcontent: περιέχει επεκτάσεις ή περιορισμούς για ένα σύνθετο τύπο που περιέχει μεικτά περιεχόμενα ή στοιχεία μόνο simplecontent: περιέχει επεκτάσεις ή περιορισμούς σε ένα στοιχείο complextype με δεδομένα χαρακτήρα ή ένα στοιχείο simpletype ως content και δεν περιέχει στοιχεία

Πανεπιστήμιο Πειραιά Τμήμα Ψηφιακών Συστημάτων XML Schema Παραδείγματα

1) Select which of the following correctly explain the value that can be described in the ItemPrice element content. <xs:element name="itemprice" type="itempricetype" /> <xs:simpletype name="itempricetype"> <xs:restriction base="xs:int"> <xs:mininclusive value="500" /> <xs:maxinclusive value="2000000" /> </xs:restriction> </xs:simpletype> a.the value 2000000 can be described, but the value 2000001 cannot be described b.the value 1999999 can be described, but the value 2000000 cannot be described c. The value 501 can be described, but the value 500 cannot be described d. The value 500 can be described, but the value 499 cannot be described

The extension element extends an existing simpletype or complextype element.

2) Select which of the following is a valid XML document with respect to XML Schema Document below. <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="personal_information" type="newpersonalinfotype" /> <xs:complextype name="newpersonalinfotype"> <xs:complexcontent> <xs:extension base="personalinfotype"> <xs:sequence> <xs:element ref="birth_date" /> <xs:element ref="hobbies" maxoccurs="30" /> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> <xs:complextype name="personalinfotype"> <xs:sequence> <xs:element ref="name"/> <xs:element ref="email_address" /> </xs:sequence> </xs:complextype> <xs:element name="name" type="xs:string" /> <xs:element name="email_address" type="xs:string" /> <xs:element name="birth_date" type="xs:string" /> <xs:element name="hobbies" type="xs:string" /> </xs:schema>

2) Select which of the following is a valid XML document with respect to XML Schema Document below. a. <?xml version="1.0" encoding="utf-8"?> <Personal_Information> <Name>Taro Yamada</Name> <Email_Address>tyamada@aaa.com</Email_Address> <Birth_Date>1980-03-30</Birth_Date> </Personal_Information> b. <?xml version="1.0" encoding="utf-8"?> <Personal_Information> <Name>Taro Yamada</Name> <Email_Address>tyamada@aaa.com</Email_Address> <Birth_Date>1980-03-30</Birth_Date> <Hobbies>Listening to music</hobbies> <Hobbies>Watching movies</hobbies> </Personal_Information>

2) Select which of the following is a valid XML document with respect to XML Schema Document below. c. <?xml version="1.0" encoding="utf-8"?> <Personal_Information> <Birth_Date>1980-03-30</Birth_Date> <Hobbies>Listening to music</hobbies> <Hobbies>Watching movies</hobbies> <Name>Taro Yamada</Name> <Email_Address>tyamada@aaa.com</Email_Address> </Personal_Information> d. <?xml version="1.0" encoding="utf-8"?> <Personal_Information> <Hobbies>Listening to music</hobbies> <Hobbies>Watching movies</hobbies> <Birth_Date>1980-03-30</Birth_Date> <Email_Address>tyamada@aaa.com</Email_Address> <Name>Taro Yamada</Name> </Personal_Information>

Guidelines An element is added to the complex type personalinfotype defined in the complextype element. This is called a complex type derived by extension. The following illustrates the procedures for a complex type derived by extension: 1. Designate a new data type name for the name attribute of the complextype element. <xs:complextype name="newpersonalinfotype"> </xs:complextype> 2. Clearly indicate that the content of the complexcontent element is a complex type, and designate the name of the data type serving as the base attribute of the extension element. <xs:complexcontent> <xs:extension base="personalinfotype"> </xs:extension> </xs:complexcontent> 3. Define the order of occurrence (model group) of the added element and the element as descendant elements of the extension element. Use the sequence element to make the occurrence in the defined order. <xs:sequence> <xs:element ref="birth_date" /> <xs:element ref="hobbies" maxoccurs="30" /> </xs:sequence> When the complex type is derived by extension, the position for the added element is after the element last defined with the original data type.

3) Select which of the following is a correct XML Schema definition if you must designate an integer less than or equal to 0 as the content of the Discount_Amount element. Assume that the XML Schema namespace prefix is xs. a. <xs:element name="discount_amount" type="xs:negativeinteger /> b. <xs:element name="discount_amount" type="xs:positiveinteger /> c. <xs:element name="discount_amount" type="xs:nonnegativeinteger /> d. <xs:element name="discount_amount" type="xs:nonpositiveinteger />

4) The following sentences describe characteristics of XML schema as compared to DTD. Select which of the following is NOT correct. a. Since the specification is simple, using XML schema rather than DTD allows for shorter XML statements when defining the same schema structure. b. XML schema is a well-formed XML document. c. XML schema provides for various data types, including date type, integer type, etc. d. XML schema is compatible with XML namespace.

5) Select which of the following is correct as a definition adding a Mobile element to the Personal_Information element defined in the given XML Schema Document. <xs:element name="personal_information" type="personalinfotype" /> <xs:complextype name="personalinfotype"> <xs:sequence> <xs:element ref="name" /> <xs:element ref="date_of_birth" /> <xs:element ref="hobbies" minoccurs="1" maxoccurs="30" /> </xs:sequence> </xs:complextype> <xs:element name="name" type="xs:string" /> <xs:element name="date_of_birth" type="xs:string" /> <xs:element name="hobbies" type="xs:string" /> a. <xs:element name="personal_information" type="newpersonalinfotype" /> <xs:complextype name="newpersonalinfotype"> <xs:complexcontent> <xs:restriction base="personalinfotype"> <xs:sequence> <xs:element ref="mobile" /> </xs:sequence> </xs:restriction> </xs:complexcontent> </xs:complextype> <xs:element name="mobile" type="xs:string" />

5) Select which of the following is correct as a definition adding a Mobile element to the Personal_Information element defined in the given XML Schema Document. <xs:element name="personal_information" type="personalinfotype" /> <xs:complextype name="personalinfotype"> <xs:sequence> <xs:element ref="name" /> <xs:element ref="date_of_birth" /> <xs:element ref="hobbies" minoccurs="1" maxoccurs="30" /> </xs:sequence> </xs:complextype> <xs:element name="name" type="xs:string" /> <xs:element name="date_of_birth" type="xs:string" /> <xs:element name="hobbies" type="xs:string" /> b. <xs:element name="personal_information" type="newpersonalinfotype" /> <xs:complextype name="newpersonalinfotype"> <xs:complexcontent> <xs:restriction base="personalinfotype"> <xs:sequence> <xs:element ref="name" /> <xs:element ref="date_of_birth" /> <xs:element ref="hobbies" minoccurs="1" maxoccurs="30" /> <xs:element ref="mobile" /> </xs:sequence> </xs:restriction> </xs:complexcontent> </xs:complextype> <xs:element name="mobile" type="xs:string" />

5) Select which of the following is correct as a definition adding a Mobile element to the Personal_Information element defined in the given XML Schema Document. <xs:element name="personal_information" type="personalinfotype" /> <xs:complextype name="personalinfotype"> <xs:sequence> <xs:element ref="name" /> <xs:element ref="date_of_birth" /> <xs:element ref="hobbies" minoccurs="1" maxoccurs="30" /> </xs:sequence> </xs:complextype> <xs:element name="name" type="xs:string" /> <xs:element name="date_of_birth" type="xs:string" /> <xs:element name="hobbies" type="xs:string" /> c. <xs:element name="personal_information" type="newpersonalinfotype" /> <xs:complextype name="newpersonalinfotype"> <xs:complexcontent> <xs:extension base="personalinfotype"> <xs:sequence> <xs:element ref="mobile" /> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> <xs:element name="mobile" type="xs:string" />

5) Select which of the following is correct as a definition adding a Mobile element to the Personal_Information element defined in the given XML Schema Document. <xs:element name="personal_information" type="personalinfotype" /> <xs:complextype name="personalinfotype"> <xs:sequence> <xs:element ref="name" /> <xs:element ref="date_of_birth" /> <xs:element ref="hobbies" minoccurs="1" maxoccurs="30" /> </xs:sequence> </xs:complextype> <xs:element name="name" type="xs:string" /> <xs:element name="date_of_birth" type="xs:string" /> <xs:element name="hobbies" type="xs:string" /> d. <xs:element name="personal_information" type="newpersonalinfotype" /> <xs:complextype name="newpersonalinfotype"> <xs:complexcontent> <xs:extension base="personalinfotype"> <xs:sequence> <xs:element ref="name" /> <xs:element ref="date_of_birth" /> <xs:element ref="hobbies" minoccurs="1" maxoccurs="30" /> <xs:element ref="mobile" /> </xs:sequence> </xs:extension> </xs:complexcontent> </xs:complextype> <xs:element name="mobile" type="xs:string" />

6) The element WidgetDesc begins with descriptive text and is followed by Size and Shape descriptions. The Size and Shape description are each optional and may occur in any order. Which of the following is the correct content model for WidgetDesc? a) <xsd:element name="widgetdesc" content="mixed"> <xsd:complexcontent> <xsd:node type="#pcdata"/> <xsd:element name="size" use="optional"/> <xsd:element name="shape" use="optional"/> </xsd:complexcontent> < /xsd:element> b) <xsd:element name="widgetdesc" type="xsd:string"> <xsd:complexcontent> <xsd:any> <xsd:element name="size" minoccurs="0"/> <xsd:element name="shape" minoccurs="0"/> </xsd:any> </xsd:complexcontent> < /xsd:element>

6) The element WidgetDesc begins with descriptive text and is followed by Size and Shape descriptions. The Size and Shape description are each optional and may occur in any order. Which of the following is the correct content model for WidgetDesc? c) <xsd:element name="widgetdesc"> <xsd:complextype> <xsd:node type="#pcdata" use="optional"/> <xsd:element name="size" use="optional"/> <xsd:element name="shape" use="optional"/> </xsd:complextype> < /xsd:element> d) <xsd:element name="widgetdesc"> <xsd:complextype mixed="true"> <xsd:all> <xsd:element name="size" type="xsd:string" minoccurs="0" /> <xsd:element name="shape" type="xsd:string" minoccurs="0" /> </xsd:all> </xsd:complextype> < /xsd:element>

Schema Namespaces Ισοδύναμα με XML namespaces Χρησιμοποιείται για τον προσδιορισμό των schema elements Το <schema> πρέπει να προσδιοριστεί με το schema namespace <schema xmlns = http://www.w3.org/2001/xmlschema > Το namespace μπορεί να έχει ένα namespace prefix για το schema Το πρόθεμα prefix προσδιορίζει τα elements που ανήκουν στο targetnamespace <schema xmlns = http://www.w3.org/2001/xmlschema xmlns:co = http://www.mycompany.com/schema>

<schema> targetnamespace Attribute <schema> targetnamespace attribute Δηλώνει το namespace του τρέχοντος schema Αυτό πρέπει να είναι ένα μοναδικό Παγκόσμιο Αναγνωριστικό Πόρου Universal Resource Identifier (URI) Διευκολύνει τον parser στη διαφοροποίηση ορισμών τύπων Χρησιμοποιείται κατά την επικύρωση του schema Διευκολύνει το διαχωρισμό διαφορετικών λεξιλογίων στο schema targetnamespace:namespace_prefix = some_uri... Θα πρέπει να ταιριάζει με τη δήλωση του schema namespace

Παράδειγμα XML <schema> <?xml version="1.0" encoding="utf-8"?> <xsd:schema targetnamespace = http://www.myco.com/co xmlns:co= http://www.myco.com/co xmlns:xsd="http://www.w3.org/2001/xmlschema" elementformdefault="qualified attributeformdefault="qualified elementformdefault="qualified"> <!-- Declare the root element of our schema --> <xsd:element name="customerorder type="co:customerorder"/> <!-- Further Definitions & declarations not shown --> </xsd:schema>

7) Μία εταιρεία βρίσκεται στη διαδικασία ορισμού του καταλόγου προϊόντων. Οι απαιτήσεις απαιτούν το κάθε προϊόν να προσδιορίζεται μοναδικά από το SKU (Stock Keeping Unit) και περιέχει όνομα προϊόντος, περιγραφή και τιμή. Επιπρόσθετα, κάποια προϊόντα μπορούν να έχουν μέχρι πέντε αξεσουάρ. Κάθε αξεσουάρ είναι κι αυτό προϊόν. Για να συσχετιστεί ένα αξεσουάρ με ένα προϊόν απαιτείται μόνο ο κωδικός SKU του αξεσουάρ. Τέλος, είναι επίσης απαίτηση να μπορεί να προστεθεί ένας κωδικός προώθησης ο οποίος θα είναι αποτελεσματικός για μία συγκεκριμένη χρονική περίοδο. Ένας προγραμματιστής ορίζει το παρακάτω XML Schema για το προϊόν: <schema targetnamespace= http://www.samplestore.com/account xmlns='http://www.w3.org/2001/xmlschema' xmlns:acc= 'http://www.samplestore.com/account'> <complextype name="product"> <sequence> <element name="sku" type="integer"/> <element name="name" type="string"/> <element name="description" type="string"/> <element name="unitprice" type="decimal"/> <element name="accessory" minoccurs="0 maxoccurs="unbounded" type="acc:product"/> </sequence> </complextype>

Ποια/ες από τις παρακάτω απαντήσεις είναι σωστή? A) Η αντικατάσταση της τιμής ιδιότητας maxoccurs="unbounded" με την maxoccurs="5" θα κάνει τον ορισμό του XML schema να ταιριάζει με τις απαιτήσεις. B)Η τιμή ιδιότητας maxoccurs="unbounded" μπορεί να διαγραφεί, δεδομένου ότι η συγκεκριμένη ιδιότητα και τιμή προστίθεται by default σε οποιοδήποτε ορισμό XML Schema που περιέχει ήδη τον ορισμό της ιδιότητας minoccurs="0". Γ) Ο τύπος του ορισμού του SKU πρέπει να γραφτεί ως type="sku" Δ) Ο τύπος του ορισμού του UnitPrice πρέπει να γραφτεί ως type="amount"

8) Select which of the following is a correct XML Schema description matching the conditions below. Select all that apply. Assume the XML Schema Namespace prefix is "xs." Conditions: The "Address" attribute is defined as a string type that may be omitted. a) <xs:attribute name="address" type="xs:string" use="optional"/> b) <xs:attribute name="address" type="xs:string" optional="true"/> c) <xs:attribute name="address" type="xs:string" required="optional"/> d) <xs:attribute name="address" type="xs:string" use="required"/>

9) Select which of the following is a valid XML document with respect to the following XML Schema Document. <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema" > <xs:element name="employee" type="employeetype" /> <xs:complextype name="employeetype"> <xs:sequence maxoccurs="unbounded"> <xs:element ref="name" /> <xs:element ref="department" /> </xs:sequence> </xs:complextype> <xs:element name="name" type="xs:string" /> <xs:element name="department" type="xs:string" /> </xs:schema>

a) <Employee></Employee> b) <Employee> < Name>Masashi Tanaka</Name> < Name>Makiko Okamura</Name> < /Employee> c) <Employee> < Name>Masashi Tanaka</Name> < Name>Makiko Okamura</Name> < Department>Sales Department</Department> < Department>Accounting Department</Department> < /Employee> d) Κανένα από τα παραπάνω δεν ακολουθεί τους κανόνες στο XML Schema

10) Select which of the following is INCORRECT as an XML Schema description. Assume that the namespace prefix xs is declared as "http://www.w3.org/2001/xmlschema." <xs:simpletype name="data_type"> <xs:restriction base="xs:int"> <xs:minexclusive value="20"/> <xs:maxinclusive value="200"/> </xs:restriction> < /xs:simpletype> < xs:element name="price" type="data_type"/> a) A value of 20 is allowed under the Price element b) A value of 23.4 is not allowed under the Price element c) A value of 200 is allowed under the Price element d) A value of 99 is allowed under the Price element

11) Select which of the following is an XML Schema document that correctly defines the Unit Price element as either 3500 or 4500. a) <xs:simpletype name="pricetype"> <xs:restriction base="xs:int"> <xs:mininclusive value="3500"/> <xs:maxinclusive value="4500"/> </xs:restriction> < /xs:simpletype> < xs:element name="unit Price" type="pricetype"/> b) <xs:simpletype name="pricetype"> <xs:restriction base="xs:int"> <xs:minexclusive value="3500"/> <xs:maxexclusive value="4500"/> </xs:restriction> < /xs:simpletype> < xs:element name="unit Price" type="pricetype"/>

11) Select which of the following is an XML Schema document that correctly defines the Unit Price element as either 3500 or 4500. c) <xs:simpletype name="pricetype"> <xs:restriction base="xs:int"> <xs:enumeration value="3500"/> <xs:enumeration value="4500"/> </xs:restriction> < /xs:simpletype> < xs:element name="unit Price" type="pricetype"/> d) <xs:simpletype name="pricetype"> <xs:restriction base="xs:int"> <xs:minlength value="3500"/> <xs:maxlength value="4500"/> </xs:restriction> < /xs:simpletype> < xs:element name="unit Price" type="pricetype"/>

12) Select which of the following represent valid XML documents with respect to the XML Schema document below: <?xml version="1.0"?> < xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="customer_information" type="customertype" /> <xs:complextype name="infotype"> <xs:sequence> <xs:choice> <xs:sequence> <xs:element ref="company" /> <xs:element ref="address" /> </xs:sequence> <xs:sequence> <xs:element ref="lastname" /> <xs:element ref="firstname" /> </xs:sequence> </xs:choice> </xs:sequence> < /xs:complextype>

<xs:complextype name="customertype"> <xs:complexcontent> <xs:extension base="infotype"> <xs:choice> <xs:element ref="telephone" /> <xs:element ref="mobile" /> </xs:choice> </xs:extension> </xs:complexcontent> </xs:complextype> <xs:element name="company" type="xs:string" /> <xs:element name="address" type="xs:string" /> <xs:element name="lastname" type="xs:string" /> <xs:element name="firstname" type="xs:string" /> <xs:element name="telephone" type="xs:string" /> <xs:element name="mobile" type="xs:string" /> < /xs:schema>

a) <?xml version="1.0"?> <Customer_Information> < Company>masashi</Company> < Address>okamura</Address> < Mobile>090-9231-3678</Mobile> < Mobile>090-6345-6989</Mobile> < /Customer_Information> b) <?xml version="1.0"?> < Customer_Information> < Company>masashi</Company> < Address>okamura</Address> < Mobile>090-9231-3678</Mobile> < /Customer_Information> c) <?xml version="1.0"?> < Customer_Information> < Company>Okamura</Company> < Address>Masashi</Address> < Telephone>03-0001-6789</Telephone> < /Customer_Information> d) <?xml version="1.0"?> < Customer_Information> < Company>Okamura</Company> < Address>Masashi</Address> < LastName>masashi</LastName> < FirstName>okamura</FirstName> < Telephone>03-0001-6789</Telephone> < Mobile>090-9231-3678</Mobile> < /Customer_Information>

13) Select which of the following correctly represents what should be described in (1) of the XML Schema document in order to correctly define the following XML Document (the Location_of_Origin attribute of Fruit element is mandatory): [XML Document] <?xml version="1.0"?> <Fruit Location_of_Origin="Aomori"> <Name>Apple</Name> <Price>350</Price> </Fruit> [XML Schema Document] <?xml version="1.0"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="fruit" type="fruittype" /> <xs:complextype name="basetype"> <xs:sequence> <xs:element ref="name" /> </xs:sequence> </xs:complextype> (1) <xs:element name="name" type="xs:string" /> <xs:element name="price" type="xs:integer" /> </xs:schema>

a) <xs:complextype name="fruittype"> <xs:complexcontent> <xs:restriction base="basetype"> <xs:sequence> <xs:element ref="price" /> </xs:sequence> <xs:attribute name="location_of_origin" type="xs:string" use="required" /> </xs:restriction> </xs:complexcontent> < /xs:complextype> b) <xs:complextype name="fruittype"> <xs:complexcontent> <xs:extension base="basetype"> <xs:sequence> <xs:element ref="price" /> </xs:sequence> <xs:attribute name="location_of_origin" type="xs:string" use="required" /> </xs:extension> </xs:complexcontent> < /xs:complextype> c) <xs:complextype name="fruittype"> <xs:simplecontent> <xs:extension base="basetype"> <xs:sequence> <xs:element ref="price" /> </xs:sequence> <xs:attribute name="location_of_origin" type="xs:string" use="required" /> </xs:extension> </xs:simplecontent> < /xs:complextype> d) <xs:complextype name="fruittype"> <xs:simplecontent> <xs:restriction base="basetype"> <xs:sequence> <xs:element ref="price" /> </xs:sequence> <xs:attribute name="location_of_origin" type="xs:string" use="required" /> </xs:restriction> </xs:simplecontent> < /xs:complextype>

14) Select which of the following are incorrect when extending the definition of a simple type element that has been defined using XML Schema. a. < xs:element name="bookinformation" type="bookinfotype" /> < xs:simpletype name="newbookinfotype"> <xs:simplecontent> <xs:extension base="bookinfotype"> <xs:attribute name="isbn" type="xs:string" use="required" /> </xs:extension> </xs:simplecontent> < /xs:simpletype> b. < xs:element name="bookinformation" type="bookinfotype" /> < xs:simpletype name="newbookinfotype"> <xs:simplecontent> <xs:restriction base="bookinfotype"> <xs:attribute name="isbn" type="xs:string" use="required" /> </xs:restriction> </xs:simplecontent> < /xs:simpletype>

14) Select which of the following are incorrect when extending the definition of a simple type element that has been defined using XML Schema. c. < xs:element name="bookinformation" type="bookinfotype" /> < xs:complextype name="newbookinfotype"> <xs:simplecontent> <xs:extension base="bookinfotype"> <xs:attribute name="isbn" type="xs:string" use="required" /> </xs:extension> </xs:simplecontent> < /xs:complextype> d. < xs:element name="bookinformation" type="bookinfotype" /> < xs:complextype name="newbookinfotype"> <xs:simplecontent> <xs:restriction base="bookinfotype"> <xs:attribute name="isbn" type="xs:string" use="required" /> </xs:restriction> </xs:simplecontent> < /xs:complextype>

Note A simple type extension does not increase the scope of the value for the value of the type forming a base, but rather adds an attribute definition to the simple type element. Adding an attribute to a simple type element results in a complextype element; However, the content of the element is still simple type, so a simplecontent element is designated as the child element of the complextype element. Next, an extension element is designated, with an attribute definition described for that child element.

15) Select which of the following XML Schema documents correctly defines the following: Use an integer value for the Quantity element content, the Quantity element has a Unit attribute, which must be described (may not be omitted). Use a text type value for the Unit attribute a. <?xml version="1.0" encoding="utf-8"?> < xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="quantity" type="quantitytype"/> <xs:complextype name="quantitytype"><xs:simplecontent> <xs:extension base="xs:int" > <xs:attribute name="unit" type="xs:string" use="required" /> </xs:extension> </xs:simplecontent></xs:complextype> </xs:schema> b. <?xml version="1.0" encoding="utf-8"?> <xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="quantity" type="quantitytype" /> <xs:complextype name="quantitytype"> <xs:attribute name="unit" type="xs:string" use="required" /> </xs:complextype> </xs:schema>

c. <?xml version="1.0" encoding="utf-8"?> < xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="quantity"> <xs:complextype> <xs:simplecontent> <xs:extension base="xs:int" > <xs:attribute name="unit" type="xs:string" use="required" /> </xs:extension> </xs:simplecontent> </xs:complextype> </xs:element> </xs:schema> d. <?xml version="1.0" encoding="utf-8"?> < xs:schema xmlns:xs="http://www.w3.org/2001/xmlschema"> <xs:element name="quantity"> <xs:complextype> <xs:attribute name="unit" type="xs:string" use="required" /> </xs:complextype> </xs:element> </xs:schema>