Beginning XML Databases (Wrox Beginning Guides)

1. 

A class is the same thing as an object. True or False?

2. 

An object model contains tree-like hierarchies, and a relational model contains flattened structures. True or False?

3. 

Between the object and relational data models, which of these are correct?

  1. A class is equivalent to a table.

  2. An object is equivalent to a record.

  3. A field is equivalent to an attribute.

  4. A method is equivalent to a stored procedure.

  5. All of the above.

4. 

Examine the diagram in Figure 8-3. Which of these are correct?

  1. Country class is an abstraction of 1 st World, 2 nd World, and 3 rd World classes.

  2. 1 st World, 2 nd World, 3 rd World classes are all specializations of Country class.

  3. Language class is an abstraction of 1 st Language, Bilingual, and Multilingual classes.

  4. 1 st Language, Bilingual, and Multilingual classes are all specializations of the Language class.

  5. All of the above.

5. 

Which of these is the best answer and the most applicable to XML?

  1. A relational table is metadata and its rows are data.

  2. An object model class is metadata and object copies of that class are data.

  3. XML documents contain only data.

  4. XML documents contain only metadata.

  5. XML documents contain both metadata and data.

Answers

1.  

Exercise 1 solution

The answer is False. A class defines the structure of an object where the object is the copy or iteration of that class, as created at run-time. A class is therefore the structural definition for an object.

2.  

Exercise 2 solution

The answer is True. Object models tend to allow for more in the way of containment of data within other items of data. A relational structure, when output to an XML structure can be generated using a simple SQL query. Simple queries joining two tables produce the data from both tables, mixed into each row of the output, a flattened structure. Some relational databases can produce hierarchical output using specialized functionality.

3.  

Exercise 3 solution

e. All of the above. A class is the basic metadata structure in the object model. A table is the same thing but in the relational data model. An object is an iteration or copy of a classs structure. A row in a table copies the structure of the fields in a table, over and over again. Class and table are metadata. Object and row are data. Tables in relational databases contain fields. Fields contain data values. Attributes in classes, copied as objects, contain data values as well. A stored procedure can be loosely equivalent to a method as long as one pictures both as coding within a database structure.

4.  

Exercise 4 solution

e. All of the above. Technically, any form of inheritance can be pictured as either abstracted or specialized. Semantically, the abstracted and specialized classes are created last because they attempt to generalize or refine on some other class or classes, respectively. However, in general, specialized classes often stem from relational data model types and many-to-many relationships. Abstracted classes are usually a purely object modeling creation, where the object model allows for reduction in both metadata structural complexities and method coding.

5.  

Exercise 5 solution

e. XML documents contain both metadata and data is the best answer because c and d are incorrect and a and b do not pertain to XML. In its simplest form, an XML document contains metadata in its tags and data in the value of the tags. An XML document can provide much of the storage capability to be a database all by itself. Tags and hierarchical structure contain metadata defining the structure of data. Values and attributes contain the actual data.

Категории