The Trek BBS

The Trek BBS (http://www.trekbbs.com/index.php)
-   Science and Technology (http://www.trekbbs.com/forumdisplay.php?f=36)
-   -   TVSML - a markup language to describe tv series (http://www.trekbbs.com/showthread.php?t=189394)

FreddyE September 27 2012 01:49 PM

TVSML - a markup language to describe tv series
 
Im working on a xds to describe tv series and could use any comments and suggestions.

This is what I got so far:

Code:

<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
  <xs:element name="series">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="title"/>
        <xs:element ref="year"/>
        <xs:element ref="country"/>
        <xs:element ref="genre"/>
        <xs:element ref="description"/>
        <xs:element ref="studio"/>
        <xs:element ref="producers"/>
        <xs:element ref="actors"/>
        <xs:element ref="seasons"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="title">
    <xs:complexType/>
  </xs:element>
  <xs:element name="year">
    <xs:complexType/>
  </xs:element>
  <xs:element name="country">
    <xs:complexType/>
  </xs:element>
  <xs:element name="genre">
    <xs:complexType/>
  </xs:element>
  <xs:element name="description">
    <xs:complexType/>
  </xs:element>
  <xs:element name="studio">
    <xs:complexType/>
  </xs:element>
  <xs:element name="producers">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="name"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="name">
    <xs:complexType/>
  </xs:element>
  <xs:element name="actors">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="main"/>
        <xs:element ref="recurring"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="main">
    <xs:complexType/>
  </xs:element>
  <xs:element name="recurring">
    <xs:complexType/>
  </xs:element>
  <xs:element name="seasons">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="count"/>
        <xs:element ref="season"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="count">
    <xs:complexType/>
  </xs:element>
  <xs:element name="season">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="seasonnr"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="seasonnr">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="actorleft"/>
        <xs:element ref="actorreturn"/>
        <xs:element ref="episodes"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="actorleft">
    <xs:complexType/>
  </xs:element>
  <xs:element name="actorreturn">
    <xs:complexType/>
  </xs:element>
  <xs:element name="episodes">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="episodecount"/>
        <xs:element ref="episode"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="episodecount">
    <xs:complexType/>
  </xs:element>
  <xs:element name="episode">
    <xs:complexType>
      <xs:sequence>
        <xs:element ref="episodenr"/>
        <xs:element ref="episodetitle"/>
        <xs:element ref="director"/>
        <xs:element ref="writer"/>
        <xs:element ref="guestactor"/>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
  <xs:element name="episodenr">
    <xs:complexType/>
  </xs:element>
  <xs:element name="episodetitle">
    <xs:complexType/>
  </xs:element>
  <xs:element name="director">
    <xs:complexType/>
  </xs:element>
  <xs:element name="writer">
    <xs:complexType/>
  </xs:element>
  <xs:element name="guestactor">
    <xs:complexType/>
  </xs:element>
</xs:schema>


THE Robert Maxwell September 27 2012 02:01 PM

Re: TVSML - a markup language to describe tv series
 
You may want an element in there for the original network that aired it, too.

Some general thoughts:

* Actors, writers, directors, and producers are all people. You will want similar information for each, such as first name, last name, and a list of seasons in which they appeared/worked. To that end, I would have a generic "person" type that has those fields, and then you'd put collections of those under each type of person. So, the "actor" element is a collection of type "person".
* The above obviates the need for the "seasonnr" element, which is confusing and seems to be of limited utility. In its place, each person can have a collection of season numbers indicating when they worked on the show.
* The "year" field makes no sense by itself. Shouldn't you have "yearbegan" and "yearended"?
* If you want this to be a comprehensive TV series schema, you should also have a "season" type which is a collection of "episode" elements, and for each "episode" you would have the following information: season, episode number, production number (optional?), writer(s) (collection), guest stars (collection), title, original air date, synopsis. For the sake of normalization, I suppose you could get away with only using the IDs of any people involved in a given episode, rather than duplicating the entire "person" object for each one. The overall "person" collections would be outside the "episode" and "season" collections. I know you already have some of this info in your schema, I'm just suggesting how you could reorganize/expand it to be more logical and complete.

A big part of my job is designing schemas and normalizing data so I enjoy this stuff. :p

Hope you get something out of my suggestions!

FreddyE September 27 2012 02:10 PM

Re: TVSML - a markup language to describe tv series
 
Great suggestions! Thanks. :-) Maybe running time as part of episode would be a good idea too. For example nuDrWho has variable episode lengths if I remember correctly.

THE Robert Maxwell September 27 2012 02:12 PM

Re: TVSML - a markup language to describe tv series
 
Might as well. Any kind of quantitative data you can provide is good.

FreddyE September 27 2012 02:50 PM

Re: TVSML - a markup language to describe tv series
 
The final goal of all of this btw. is a website that is driven by a algorithm that would be able to look at all the data, and come to logical conclusions. You would be able to ask stuff like: Tell me all episodes of any scifi series produced after 1999 that has at least one actor appearing who was a recurring cast member of Star Trek TNG and is not Whoopie Goldberg.

THE Robert Maxwell September 27 2012 02:54 PM

Re: TVSML - a markup language to describe tv series
 
That makes sense. How are you going to store this data, internally? Representing it as XML is fine for Web consumption, but sucks for searchability and scaling. You thinking of using a relational database, or maybe an object database, then serving the data over SOAP/REST?

FreddyE September 27 2012 03:07 PM

Re: TVSML - a markup language to describe tv series
 
Of course there needs to be a database. Ive only worked with mysql so far. Maybe I should actually design the database first, and then use a tool to make the xsd?

THE Robert Maxwell September 27 2012 03:32 PM

Re: TVSML - a markup language to describe tv series
 
I think that would be a much better idea, yes.

Start with what data you want to store. Define all the relationships between items in that data. Then design your database. If you don't know anything about database normalization, read up on that. It's not hard to grasp once you understand the basics. :)

Your XML schema should more or less resemble the relational structure of your database.


All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
FireFox 2+ or Internet Explorer 7+ highly recommended.