Coursera: Introduction to Databases Part 1

     Introduction to Databases is taught by Jennifer Widom and hosted by Coursera as a self paced class.  As someone who mainly does front-end developing I feel this class should be very helpful for me to add some new set of skill to my array. I also think this class will help better prepare me later down the road  for my plans to take the SQL certifications. This is article is part of a series of other articles that will be on the class , but this article particularly is about XML, DTD and Json.
    When I first started this article it was a single entity but as I got through more of the class the article was a little more too much for me to maintain as well as keep track of since I went out of order with what the had class. I think the topic that most interested me for this class was learning about triggers. However so far this article is about nothing new but I felt it was important to document. 

XML - eXtensible Markup Language
An alternative to structuring data, similar to html. also has a streaming format. An Implied ordering, self describing schema. 

     Three basic structures
  • Tag
  • Attribute
  • Text
Well-formed XML must follow these rules (along with others):
  • There must be exactly one top level element.
  • All opening tags must be closed.
  • All elements are properly nested i.e., there are no interleaved elements.
  • Attribute values must be enclosed in single or double quotes.
     Parsed XML 
  • DOM - programmatic model for the xml hierarchy 
  • SAX - stream xml model
     Displaying XML
  • XSL - extensible stylesheet language
  • CSS
  • In the XML snippet, the info element has one address subelement and two phone subelements, in that order. Thus, in the DTD the list of components for INFO must include ADDR, ADDR*, ADDR+, or ADDR? followed by PHONE* or PHONE+. Interspersed with these may be any elements that are not required to appear-- that is, any components with a ? or *. Thus, we might also have components like NAME* or MANAGER? at any point in the list.

     Resources
DTD - Document Type Definition
This section was wrapped in with XML but I thought it was important enough to look at separately. 
Grammar-like language for specifying elements, attributes, nesting, ordering, #occurreneces.

     DTD Vs. XSD
  • Pros: for DTD
    • Programs can assume structure, CSS/XSL
    • Specifications - data exchange
    • Documentation
  • Cons: XSD benefits.
    • Flexibility
    • Irregular 
  • A #REQUIRED attribute must appear in every element.
  • An attribute can have types CDATA, ID, or IDREF(S), but not #PCDATA.
  • The incorrect choices (i.e., the snippets that could appear in a DTD), are either optional attributes (#IMPLIED) or are required attributes of a proper type.
  • According to the DTD, an A element has within it one or more B subelements, and then a C element. Within the C element is zero or one B elements followed by exactly one D element. In terms of regular expressions, the tag sequences we can see are:
     Resources
Json - Javascript Object Notation 
Human-readable, useful for data change and serializing data object. Represents   semistructured data.

     Basic constructs (recursive)
  • Values - number, string, boolean
  • Objects - set of label pairs, {}
  • Arrays - []
     Differences from Relational
  • Structure - nested set os arrays
  • Schema- "self -describing" 
  • Queries -  Nothing widely used.(Maybe in the future)
  • Order - Arrays.
  • Implementation - Coupled with Programming languages.
     Json vs. XML
  • XML has more verbosity
  • XML has more  complexity (more information)
  • XML has DTD, XSD and Json has Json Schema for validity.
  • XML is more clunky for Prog. Interface.
  • Querying: (all are very early and not standardized )
    • Json: Json Path, Json Query, JAQL
    • XML: XPath, XQuery, XSLT
     Concepts for Json
  • A complex, irregular, and possibly dynamic structure database needs the flexibility of JSON to be warranted.
  • A database with a fixed structure suggesting relational, but it is in a nested array, list, and label-value structure suggests JSON but either may be suitable.

Popular posts from this blog

Nginx Best Practices Extended

Installing Windows on Acer chromebook 15 cb3-532

Entity Framework: ToListAynsc & WhereAsync