BitByBit: Difference between revisions

From ICO wiki
Jump to navigationJump to search
Rlohmus (talk | contribs)
Rlohmus (talk | contribs)
Line 244: Line 244:
== Logi ==
== Logi ==


04.03.2013 - Mõtlesime meeskonnale nime välja
04.03.2013 - Mõtlesime meeskonnale nime välja<br/>
23.03.2013 - Saime valmis XML faili osa
23.03.2013 - Saime valmis XML faili osa<br/>
30.03.2013 - Panime Wikisse ülesse kahe meeskonna retsensioonid
30.03.2013 - Panime Wikisse ülesse kahe meeskonna retsensioonid<br/>
26.05.2013 - Saime valmis veebiteenuse ja klientrakenduse osa
26.05.2013 - Saime valmis veebiteenuse ja klientrakenduse osa<br/>

Revision as of 21:20, 26 May 2013

Liikmed

  • Reigo Hein
  • Kristjan Luik
  • Raul Špilev
  • Reelika Lõhmus

XML andmefail

Ülesande täitmiseks tuleb luua XML fail andmete edastamiseks, selle XML faili skeemifail ning paar kolm sobivat XSL faili loodud XML failis olevate andmete transformeerimiseks HTML formaati ja XML faili formaadi muutmiseks. XML-il peab olema vähemalt 4 loogilist dimensiooni.

Lisaks tuleb kasutada 3-el dimensioonil attribuute, mis one enamat, kui lihtsalt ID.

XML

<?xml version="1.0" encoding="utf-8"?>
<music xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:noNamespaceSchemaLocation="MusicXSD.xsd">
  <artist name="Gojira">
    <album id="1" title="The Way of All Flesh" year="2008" genre="Progressive metal">
      <song tracknumber="1" title="The Art of Dying" song_genre="Progressive Death Metal">
        <comments>\M/</comments>
      </song>
      <song tracknumber="2" title="A Sight to Behold" song_genre="Metal">
        <comments>...</comments>
      </song>
      <song tracknumber="3" title="The Way of All Flesh" song_genre="Melodic Death Metal">
        <comments>!!!</comments>
      </song>
      <song tracknumber="4" title="Toxic Garbage Island" song_genre="Progressive Death Metal">
        <comments>Based on an island, which actually exsists.</comments>
      </song>
      <album_comments>The second studio album by French metal band Gojira.</album_comments>
    </album>
    <album id="2" title="The Link" year="2003" genre="Progressive metal">
      <song tracknumber="1" title="Embrace the World" song_genre="Progressive Death Metal">
        <comments>\m/</comments>
      </song>
      <album_comments>The fourth studio album by French metal band Gojira.</album_comments>
    </album>
  </artist>
  <artist name="Young Jeezy">
    <album id="1" title="The Inspiration" year="2006" genre="Gangsta Rap">
      <song tracknumber="1" title="Hypnotize" song_genre="Gangsta Rap">
        <comments>Lots of hard hitting bass.</comments>
      </song>
      <song tracknumber="2" title="I Luv It"  song_genre="Gangsta Rap">
        <comments>Uncencored.</comments>
      </song>
      <album_comments>Also known as The Inspiration: Thug Motivation 102</album_comments>
    </album>  
  </artist> 
  <artist name="Ludwig van Beethoven">
    <album id="1" title="N/A" year="1801" genre="Classical">
      <song tracknumber="1" title="Piano Sonata No. 14 in C-sharp minor" song_genre="Classical piano sonata">
        <comments>One of Beethovens most known piano pieces. Commonly known as "Moonlight Sonata".</comments>
      </song>
      <song tracknumber="2" title="Symphony No. 9 in D minor" song_genre="Classical piano sonata">
        <comments>Classical piece</comments>
      </song>
      <song tracknumber="3" title="Symphony No. 5 in C minor" song_genre="Classical Symphony">
        <comments>One of Beethovens most known symphonies.</comments>
      </song>
      <album_comments>I don't think that they had albums back then.</album_comments>
    </album>
  </artist> 
</music>

XMLi skeem (XSD)


<?xml version="1.0" encoding="utf-8"?>
<xs:schema attributeFormDefault="unqualified" elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:element name="music">
    <xs:complexType>
      <xs:sequence>
        <xs:element maxOccurs="unbounded" name="artist">
          <xs:complexType>
            <xs:sequence>
              <xs:element maxOccurs="unbounded" name="album">
                <xs:complexType>
                  <xs:sequence>
                    <xs:element maxOccurs="unbounded" name="song">
                      <xs:complexType>
                        <xs:sequence>
                          <xs:element name="comments" type="xs:string" />
                        </xs:sequence>
                        <xs:attribute name="tracknumber" type="xs:integer" use="required" />
                        <xs:attribute name="title" type="xs:string" use="required" />
                        <xs:attribute name="song_genre" type="xs:string" use="required" />
                      </xs:complexType>
                    </xs:element>
                    <xs:element name="album_comments" type="xs:string" />
                  </xs:sequence>
                  <xs:attribute name="id" type="xs:integer" use="required" />
                  <xs:attribute name="title" type="xs:string" use="required" />
                  <xs:attribute name="year" type="xs:integer" use="required" />
                  <xs:attribute name="genre" type="xs:string" use="required" />
                </xs:complexType>
              </xs:element>
            </xs:sequence>
            <xs:attribute name="name" type="xs:string" use="required" />
          </xs:complexType>
        </xs:element>
      </xs:sequence>
    </xs:complexType>
  </xs:element>
</xs:schema>


XSLT 1

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output method="html" indent="yes"/>

  <xsl:template match="/">
    <html>
      <head>
        <title></title>
      </head>
      <body>
        <h2> Kõik metalli sisaldavad lood</h2>
        <xsl:for-each select="music/artist/album/song">
          <xsl:if test="contains(@song_genre, 'Metal')">
            <ul>
              <li>

                <xsl:value-of select="@title" />
              </li>
            </ul>
          </xsl:if>
        </xsl:for-each>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

XSLT 2

<?xml version="1.0" encoding="utf-8"?>

<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

  <xsl:template match="/">
    <html>
      <body text="black">
        <h2>Albumid:</h2>
          <xsl:for-each select="music/artist/album">
            <div style="border-style:dashed;border-width:1px">
				<p>Album: <xsl:value-of select="@title"/></p>
				<p>Aasta: <xsl:value-of select="@year" /></p>

				<p>Zanr: <xsl:value-of select="@genre"/></p>

				<ul>
					<xsl:for-each select="song">
						<li>
							<xsl:value-of select="@title"/>
						</li>
					</xsl:for-each>
				</ul>
			</div>
          </xsl:for-each>
      </body>
    </html>
  </xsl:template>

</xsl:stylesheet>

XSLT 3

<?xml version="1.0" encoding="utf-8"?>
<!--Author Reigo Hein. Displays all artists, albums-->
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">
  <xsl:output method="html" indent="yes"/>

  <xsl:template match="/">
    <html>
      <body>
        <h2>Artists - Albums</h2>
        <table>
          <tr>
            <th>
              Artists
            </th>
            <th>
              Albums
            </th>
          </tr>
          <xsl:for-each select="music/artist">
            <tr>
              <td class="artists">
                <xsl:value-of select="@name"/>
              </td>
              <td class="albums">
                <ul>
                  <xsl:for-each select="album">
                    <li><xsl:value-of select="@title"/></li>
                  </xsl:for-each>
                </ul>
              </td>
            </tr>
          </xsl:for-each>
        </table>
      </body>
    </html>
  </xsl:template>
</xsl:stylesheet>

Veebiteenus

Meie eesmärgiks oli luua teenus kuhu kasutaja saab salvestada oma lemmik artiste, albumeid ja laule.

Meetodid

Artist

void CreateArtist(Artist artist, string userToken) -
Artist ReadArtist(int id) -
List<Artist> ReadArtists(string userToken) -
void UpdateArtist(Artist artist) -
void DeleteArtist(int id) -

Lugu

void CreateSong(Song song, Album album) -
Song ReadSong(int id) -
void UpdateSong(Song song) -
void DeleteSong(int id) -

Album

void CreateAlbum(Album album, Artist artist) -
Album ReadAlbum(int id) -
void UpdateAlbum(Album album) -
void DeleteAlbum(int id) -

Klientrakendus

Klientrakendus on mõeldud peamiselt muusika haldamiseks. Klientrakendusse on võimalik sisse logida google kontoga.

Logi

04.03.2013 - Mõtlesime meeskonnale nime välja
23.03.2013 - Saime valmis XML faili osa
30.03.2013 - Panime Wikisse ülesse kahe meeskonna retsensioonid
26.05.2013 - Saime valmis veebiteenuse ja klientrakenduse osa