From: <neb...@us...> - 2009-04-07 21:25:51
|
Revision: 1686 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1686&view=rev Author: nebelschwade Date: 2009-04-07 21:25:36 +0000 (Tue, 07 Apr 2009) Log Message: ----------- Changed GUI of moosique.net * added Search, Recommendations and Information Tabs * CSS-Tweaks, CSS-Sprites, bandwidth reduction SPARQL problems: see testJamendo.php Modified Paths: -------------- trunk/src/moosique.net/css/default.css trunk/src/moosique.net/css/style.css trunk/src/moosique.net/index.php trunk/src/moosique.net/js/ajax.js trunk/src/moosique.net/js/player.js trunk/src/moosique.net/php/DllearnerConnection.php trunk/src/moosique.net/php/SparqlQueryBuilder.php trunk/src/moosique.net/php/ajaxer.php trunk/src/moosique.net/php/config.ini trunk/src/moosique.net/php/config.php trunk/src/moosique.net/php/testJamendo.php Added Paths: ----------- trunk/src/moosique.net/img/controls.png trunk/src/moosique.net/js/interface.js trunk/src/moosique.net/php/LastFM.php Property Changed: ---------------- trunk/src/moosique.net/ Property changes on: trunk/src/moosique.net ___________________________________________________________________ Modified: svn:ignore - .git + .git moosique.net.esproj Modified: trunk/src/moosique.net/css/default.css =================================================================== --- trunk/src/moosique.net/css/default.css 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/css/default.css 2009-04-07 21:25:36 UTC (rev 1686) @@ -1,33 +1,44 @@ @charset 'utf-8'; -@media all { - -/* based loosely on CSS-Reset Style from Eric Meyer and Stefan Nietzsche */ +@media all { /* Yes we want to reset this for print-Styles too */ +/* Based on various Reset-Styles, included own stuff and added mediabox-Style */ +/* Reset all elements except form stuff */ html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, -fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td - { margin: 0; padding: 0; border: 0; outline: 0; vertical-align: baseline; } -:focus { outline: 0; } +small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, +table, caption, tbody, tfoot, thead, tr, th, td { + margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; vertical-align: baseline; +} + html { height: 100%; } -body { height: 101%; line-height: 1; background: #fff; } +body { height: 101%; background-color: #fff; color: #000; line-height: 1; } ol, ul { list-style: none; } table { border-collapse: collapse; border-spacing: 0; } caption, th, td { text-align: left; font-weight: normal; } blockquote:before, blockquote:after, q:before, q:after { content: ""; } blockquote, q { quotes: "" ""; } +strong, b { font-weight: bold; } +em, i { font-style: italic; } label, input[type=button], input[type=submit], button { cursor: pointer; } -q:lang(de) { quotes: '„' '“' '‚' '‘'; } -q:lang(en) { quotes: '“' '”' "‘" "’"; } abbr[title] { border-bottom: 1px dotted #888 !important; cursor: help; } a abbr { cursor: pointer !important; } + +/* General purpose-Classes */ +.hidden { position: absolute; left: -9999999em; top: -9999999em;} + +/* Clearfix hack */ .clearfix:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; } .clearfix { display: inline-block; } -.hidden { position: absolute; left: -9999em; top: -9999em; } +* html .clearfix { height: 1%; } +.clearfix { display: block; } -/* =================================================================== */ +/* Special Stuff */ +:focus { outline: 0; } +a { text-decoration: none; } +a:hover { text-decoration: underline; } +a:active { position: relative; top: 1px; } +input:focus, textarea:focus, select:focus { background: #eee; } fieldset { border: 1px solid #333; padding: 9px; } fieldset legend { padding: 0 9px; } -h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal;} +h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal; } - } /* End @media all */ \ No newline at end of file Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/css/style.css 2009-04-07 21:25:36 UTC (rev 1686) @@ -3,16 +3,12 @@ /* moosique.net * - * Overall width: 955px -- golden ratio: 590px & 365px - * * Semiblack: #131313 * Dark Grey: #383838 * Light Grey: #545454 * White: #fff * Yellowish: #ffbc00 - * Border: #272727 * - * */ @media screen { @@ -27,15 +23,10 @@ } body { - background: url(../img/bg_body.png) top left repeat-x #383838; + background: #333; } -a { - text-decoration: none; -} - a:hover { - text-decoration: underline; color: #ffbc00; } @@ -46,39 +37,30 @@ /* Default Container Positioning */ /* =================================================================== */ - #container, #header, #mainContainer, #content { position: relative; } -#container { - width: 955px; - margin: 0 auto; +#headerContainer { + height: 140px; + background: #131313; + border-top: 1px solid #999; + border-bottom: 10px solid #ffbc00; } #header { - height: 132px; + width: 960px; + margin: 0 auto; } -#content { - /* width: 590px; */ - top: 4px; - width: 557px; - padding: 30px 30px 30px 0; - border-right: 3px solid #272727; - min-height: 300px; - height: auto !important; - height: 300px; +#container { + border-top: 1px solid #1a1a1a; } -#sidebar { - /* width: 365px; */ - width: 335px; - position: absolute; - right: 0; - top: 4px; - padding: 30px 0 30px 30px; - +#mainContainer { + width: 960px; + margin: 0 auto; + padding: 30px 0; } #footer { @@ -86,19 +68,18 @@ text-align: center; } - -/* Header Area */ +/* header Area */ /* =================================================================== */ #header h1 a { font-size: 36px; - line-height: 120px; + line-height: 90px; font-family: Georgia, "Times New Roman", Times, serif; text-decoration: none; } #now { position: absolute; - top: 30px; + top: 20px; left: 280px; width: 410px; height: 37px; @@ -131,7 +112,7 @@ #status { position: absolute; - top: 93px; + top: 83px; left: 300px; width: 410px; font-size: 11px; @@ -141,7 +122,7 @@ position: absolute; width: 116px; height: 37px; - top: 30px; + top: 20px; right: 0; padding: 10px 20px; background: #545454; @@ -159,6 +140,10 @@ margin-right: 10px; } +#playPause { + width: 26px; +} + #next { margin-right: 0; } @@ -170,26 +155,16 @@ } #prev { - + background: url(../img/controls.png) 0px -160px no-repeat; } - -#playPause { - width: 26px; -} - -/* TODO Sprites */ -#prev { - background: url(../img/prev.png) center center no-repeat; -} #next { - background: url(../img/next.png) center center no-repeat; + background: url(../img/controls.png) 0px -120px no-repeat; } -/* Will be changed by JavaScript onclick */ #playPause { - background: url(../img/play.png) center center no-repeat; + background: url(../img/controls.png) 0px 0px no-repeat; } #stop { - background: url(../img/stop.png) center center no-repeat; + background: url(../img/controls.png) 0px -80px no-repeat; } #toggles { @@ -211,20 +186,19 @@ } - /* Playlist Area */ /* =================================================================== */ #playlistContainer { position: absolute; width: 368px; - /* top: 132px; */ - top: 450px; + top: 30px; right: 0; background: #000; -moz-border-radius: 10px; -webkit-border-radius: 10px; z-index: 100; + display: none; } #playlistHeader { @@ -253,12 +227,12 @@ #closePlaylist { position: absolute; - width: 20px; + width: 100px; height: 20px; top: 5px; right: 10px; text-align: right; - font-weight: bold; + font-size: 10px; } #playlist { @@ -287,28 +261,53 @@ width: 14px; height: 14px; line-height: 14px; - color: #131313; - background: #fff; - font-weight: bold; - text-align: center; margin-right: -19px; z-index: 1000; + text-indent: -99999999px; + background: url(../img/controls.png) 0px -200px no-repeat; } -/* Samples */ -#samples li { - cursor: move; - padding: 3px; +/* mainMenu */ +/* =================================================================== */ + +#mainMenu ul { + position: absolute; + top: -46px; + left: 0; } +#mainMenu ul li { + float: left; + -moz-border-radius-topleft: 10px; + -moz-border-radius-topright: 10px; + -webkit-border-top-left-radius: 10px; + -webkit-border-top-right-radius: 10px; + padding: 0 15px; + background: #545454; + margin: 5px 5px 0 0; + height: 30px; + line-height: 30px; +} -/* Content Area */ -/* =================================================================== */ -#searchContainer * { +#mainMenu ul li a { color: #131313; } +#mainMenu ul li.active { + height: 35px; + line-height: 35px; + margin-top: 0; + background: #ffbc00; +} +#mainMenu ul li.active a { + font-weight: bold; +} + + +/* Content Area Default Styles */ +/* =================================================================== */ + #mainContainer h2 { font-size: 20px; line-height: 28px; @@ -321,32 +320,57 @@ font-family: "Courier New", Courier, monospace; } -/* Recommendations and Samples */ -#content ol { + +/* search */ +/* =================================================================== */ +#searchForm * { + color: #131313; +} + + +/* Recommendations */ +/* =================================================================== */ +#recommendations { + display: none; /* Initial Hide */ +} + +#recommendations ol { list-style: decimal; margin-left: 24px; + width: 50%; } -#content ol li a { +#recommendations ol li a { cursor: move; text-decoration: none; } -#content ol li a:hover { +#recommendations ol li a:hover { text-decoration: none; color: #fff; } +#recommendations li:hover { + border: 1px solid #ffbc00; +} + /* Draggable li-Items */ -#playlist li.moving, #samples li.moving, #recommendations li.moving { +#playlist li.moving, #recommendations li.moving { background: #666; border: 3px solid #ffbc00; color: #000; font-weight: bold; } +/* information */ +/* =================================================================== */ +#information { + display: none; /* Initial Hide */ +} + + /* Sidebar Area */ /* =================================================================== */ @@ -359,22 +383,4 @@ } - - -/* =================================================================== */ -/* ======================== IE 7 Styles ============================== */ -/* =================================================================== */ -.ie7 .class { - -} - - -/* =================================================================== */ -/* ================= IE 6 (and below) Styles ======================== */ -/* =================================================================== */ -.ie6 .class { - -} - - } /* end @media screen \ No newline at end of file Added: trunk/src/moosique.net/img/controls.png =================================================================== (Binary files differ) Property changes on: trunk/src/moosique.net/img/controls.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/index.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -13,8 +13,7 @@ <!--[if lte IE 6]><body class="ie6"><![endif]--> <!--[if !IE]><!--><body><!-- <![endif]--> - <div id="container"> - + <div id="headerContainer"> <div id="header"> <h1><a href="index.php">moosique.net</a></h1> <div id="now"> @@ -38,22 +37,28 @@ <a href="#" id="togglePlaylist" title="Show/Hide Playlist">Playlist</a> </div> </div> + </div> - - <div id="playlistContainer"> - <div id="playlistHeader"> - Playlist - <a href="#" id="closePlaylist" title="Close Playlist Window">X</a> - </div> - <ol id="playlist"> - <li><a href="mp3/moosique.mp3" class="htrack">Welcome to moosique</a></li> - </ol> - <div id="playlistFooter"> </div> - </div> + <div id="container"> <div id="mainContainer"> + <div id="mainMenu"> + <ul class="clearfix"> + <li class="active"><a href="#" class="search">Search</a></li> + <li><a href="#" class="recommendations">Recommendations</a></li> + <li><a href="#" class="information">Information</a></li> + </ul> + </div> <div id="content"> - <div id="searchContainer"> + + + <div id="search"> + <h2>Welcome to moosique.net!</h2> + <p> + Want to listen to some good free music? Just enter an artist or song + name, search for tags or enter your last.fm username and let the moogic + happen... + </p> <form id="searchForm" method="post" action="php/ajaxer.php"> <div> <select name="typeOfSearch" id="typeOfSearch"> @@ -62,66 +67,71 @@ <option value="tag">Tag</option> <option value="lastfm">Last.fm-User</option> </select> - <input id="search" name="search" type="text" /> + <input id="searchValue" name="searchValue" type="text" /> <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" /> </div> </form> + <div id="results"> + + </div> </div> - <div id="info"> - <h2>Welcome to moosique.net!</h2> - <p> - Want to listen to some good free music? Just enter an artist or song - name, search for tags or enter your last.fm username and let the moogic - happen... - </p> - <p> - Or fill your Playlist with these Samples...<br /> - (Drag them to the Playlist) - </p> - <ol id="samples"> + <div id="recommendations"> + <h2>Try dragging these samples to the playlist</h2> + <ol> <li><a href="http://stream6-3.jamendo.com/8654/mp31/01%20-%20Low%20Earth%20Orbit%20-%20My%20Mistakes.mp3">Low Earth Orbit - My Mistakes</a></li> <li><a href="http://stream6-3.jamendo.com/8654/mp31/02%20-%20Low%20Earth%20Orbit%20-%20Like%20Mud.mp3">Low Earth Orbit - Like Mud</a></li> <li><a href="http://stream6-3.jamendo.com/8654/mp31/03%20-%20Low%20Earth%20Orbit%20-%20Defend.mp3">Low Earth Orbit - Defend</a></li> <li><a href="http://stream6-3.jamendo.com/8654/mp31/04%20-%20Low%20Earth%20Orbit%20-%20What%20Can%20I%20Say.mp3">Low Earth Orbit - What Can I Say</a></li> </ol> + </div> - </div> - - - <div id="sidebar"> - <div id="moreInfo"> - <h2>About the Artist</h2> - <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> - <p> - Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat - duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil - imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis - dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus - qui nobis videntur parum. - </p> + <div id="information"> + <div id="sidebar"> + <div id="moreInfo"> + <h2>About the Artist</h2> + <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> + <p> + Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat + duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil + imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis + dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus + qui nobis videntur parum. + </p> + </div> + </div> </div> </div> + + <div id="playlistContainer"> + <div id="playlistHeader"> + Playlist + <a href="#" id="closePlaylist" title="Close Playlist Window">Close Window</a> + </div> + <ol id="playlist"> + <li><a href="mp3/moosique.mp3" class="htrack">Welcome to moosique</a></li> + </ol> + <div id="playlistFooter"> </div> + </div> <div id="footer"> <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> | <a href="http://aksw.org/Projects/DLLearner">Powered by DL-Learner</a> </div> - - </div> - </div> + + <!-- JS at the bottom, faster loading pages --> <script type="text/javascript" src="js/mootools-core.js"></script> <script type="text/javascript" src="js/mootools-more.js"></script> <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> <script type="text/javascript" src="js/player.js"></script> + <script type="text/javascript" src="js/interface.js"></script> <script type="text/javascript" src="js/ajax.js"></script> - <!--[if lte IE 6]><script type="text/javascript" src="js/ie6fixes.js"></script><![endif]--> </body> </html> \ No newline at end of file Modified: trunk/src/moosique.net/js/ajax.js =================================================================== --- trunk/src/moosique.net/js/ajax.js 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/js/ajax.js 2009-04-07 21:25:36 UTC (rev 1686) @@ -5,7 +5,7 @@ // handle search requests $('searchForm').addEvent('submit', function(e) { - var info = $('info'); + var results = $('results'); var submit = $('searchSubmit'); e.stop(); // prevent form submitting the non-ajax way @@ -13,18 +13,18 @@ onRequest: function(response) { submit.set('disabled', 'disabled'); // disable submit button until request complete - info.set('html', '<h2>Processing your search request...</h2>'); + results.set('html', '<h2>Processing your search request...</h2>'); }, onFailure: function(response) { - info.set('html', '<h2>Unable to process your search. Try again.</h2>'); + results.set('html', '<h2>Unable to process your search. Try again.</h2>'); }, onSuccess: function(response) { submit.erase('disabled'); // reenable submitbutton responseObject = JSON.decode(response); // info.set('text', response); - info.set('html', '<h2>Done.</h2>'); + results.set('html', '<h2>Done.</h2>'); // Firebug needed console.log(responseObject); Added: trunk/src/moosique.net/js/interface.js =================================================================== --- trunk/src/moosique.net/js/interface.js (rev 0) +++ trunk/src/moosique.net/js/interface.js 2009-04-07 21:25:36 UTC (rev 1686) @@ -0,0 +1,17 @@ +window.addEvent('domready', function() { + +// switching between search, recommendation and information + +$$('#mainMenu ul li a').each(function(a) { + a.addEvent('click', function(e) { + e.stop(); // dont follow link + $$('#mainMenu ul li').removeClass('active'); + a.getParent().toggleClass('active'); + console.log(a.get('class')); + $('content').getChildren().setStyle('display', 'none') + $(a.get('class')).setStyle('display', 'block'); + }); + +}); + +}); \ No newline at end of file Modified: trunk/src/moosique.net/js/player.js =================================================================== --- trunk/src/moosique.net/js/player.js 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/js/player.js 2009-04-07 21:25:36 UTC (rev 1686) @@ -66,7 +66,7 @@ */ var trackPause = function() { $$('#now h2').set('text', 'Player Paused'); - $('playPause').setStyle('background-image', 'url(img/play.png)'); + $('playPause').setStyle('background-position', '0px 0px'); } /** @@ -76,14 +76,14 @@ var trackStart = function() { $$('#now h2').set('text', 'You are listening to:'); $$('#now h3').set('text', y.getMetaData().title); - $('playPause').setStyle('background-image', 'url(img/pause.png)'); + $('playPause').setStyle('background-position', '0px -40px'); } /** * trackComplete: we change the Pause-Button to a Play-Button */ var trackComplete = function() { - $('playPause').setStyle('background-image', 'url(img/play.png)'); + $('playPause').setStyle('background-position', '0px 0px'); /* TODO * Nice, someone listened a track until the end, this is a good thing, * we can assume our recommendation was not that bad... @@ -196,7 +196,7 @@ // the Stop-Playing Button that.stop.addEvent('click', function() { console.log('Clicked Stop Button'); - that.playPause.setStyle('background-image', 'url(img/play.png)'); + that.playPause.setStyle('background-position', '0px 0px'); that.nowPlayingHeader.set('text', 'Player stopped'); that.nowPlayingTrack.set('text', '...'); that.nowPlayingTime.set('text', '0:00 / 0:00'); @@ -251,9 +251,9 @@ // this.playlistContainer.setStyle('display', 'none'); // Make the playlist, samples and recommendations sortable - that.makeSortableLists($$('#playlist, #samples, #recommendations')); + that.makeSortableLists($$('#playlist, #recommendations ol')); // make links unclickable for recommendations and samples - that.makeLinksUnclickable($$('#recommendations li a, #samples li a')); + that.makeLinksUnclickable($$('#recommendations li a')); }, Modified: trunk/src/moosique.net/php/DllearnerConnection.php =================================================================== --- trunk/src/moosique.net/php/DllearnerConnection.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/DllearnerConnection.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -5,28 +5,41 @@ */ class dllearnerConnection { - private $conf; + private $config; private $client; private $endpoint; - function __construct($conf) { - $this->conf = $conf; + /** + * + * @return + * @param object $config + */ + function __construct($config) { + $this->config = $config; // we use jamendo as the default sparql-endpoint - $this->setEndpoint($this->conf->getUrl('jamendo')); + $this->setEndpoint($this->config->getUrl('jamendo')); $this->connect(); } + /** + * + * @return + */ private function connect() { // connect to DL-Learner-Web-Service - $this->client = new SoapClient( - $this->conf->getUrl('wsdlLocal') - ); + $this->client = new SoapClient($this->config->getUrl('wsdlLocal')); } + /** + * + * @return + * @param object $endpoint + */ public function setEndpoint($endpoint) { $this->endpoint = $endpoint; } + public function getEndpoint() { return $this->endpoint; } Added: trunk/src/moosique.net/php/LastFM.php =================================================================== --- trunk/src/moosique.net/php/LastFM.php (rev 0) +++ trunk/src/moosique.net/php/LastFM.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -0,0 +1,82 @@ +<?php + +/** + * TODO: UGLY! Use Sparql-Querys instead?! + * + * Later. + */ +class LastFM { + + private $data; + private $config; + private $username; + + function __construct($config, $username) { + $this->config = $config; + $this->username = $username; + $this->getData(); + } + + function getData() { + include_once('arc/ARC2.php'); + $rdfParser = ARC2::getRDFParser(); + $lastfmResource = $this->config->getUrl('lastfm') . urlencode($this->username); + $rdfParser->parse($lastfmResource); + // parse, non simple array + $index = $rdfParser->getSimpleIndex(0); + $this->data = $index; + } + + function getRecentTracks() { + $playedTracks = array(); + $trackNodes = array(); + + echo '<pre>'; + // print_r($this->data); + + if (is_array($this->data) && !empty($this->data)) { + foreach($this->data as $rootItem => $rootValue) { + // only process further if the rootitem ist no uri + if (!preg_match('/http:\/\//i', $rootItem)) { + foreach($rootValue as $childItem => $childValue) { + // if there is a childitem :track_played, we can use the information + if ($childItem == $this->config->getPrefix('played')) { + $trackNodes[] = $childValue[0]['value']; + } + } + } + } + } else { + echo 'Data-Array empty.'; + } + + if (!empty($trackNodes)) { + foreach($trackNodes as $trackNode) { + $track = $this->data[$trackNode][$this->config->getPrefix('title')][0]['value']; + $artistNode = $this->data[$trackNode][$this->config->getPrefix('maker')][0]['value']; + $artist = $this->data[$artistNode][$this->config->getPrefix('name')][0]['value']; + $artistZitgist = $this->data[$artistNode][$this->config->getPrefix('same')][0]['value']; + $album = ''; + $albumZitgist = ''; + + $playedTracks[] = array($artist, $track, $album, $artistZitgist, $albumZitgist); + + } + } else { + echo "No recently played tracks avaiable from last.fm."; + } + + print_r($trackNodes); + print_r($playedTracks); + echo '</pre>'; + } + + +} + +include('config.php'); + +$lastfm = new LastFM($conf, 'nebelschwade'); +$lastfm->getRecentTracks(); + +?> \ No newline at end of file Modified: trunk/src/moosique.net/php/SparqlQueryBuilder.php =================================================================== --- trunk/src/moosique.net/php/SparqlQueryBuilder.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/SparqlQueryBuilder.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -29,8 +29,8 @@ private function sparqlPrefixes() { $prefixes = ''; - foreach($this->config->getPrefixes() as $prefix => $resource) { - $prefixes .= 'PREFIX ' . $prefix . ': ' . $resource . "\n"; + foreach($this->config->getAllPrefixes() as $prefix => $resource) { + $prefixes .= 'PREFIX ' . $prefix . ': <' . $resource . '>' . "\n"; } return $prefixes; } Modified: trunk/src/moosique.net/php/ajaxer.php =================================================================== --- trunk/src/moosique.net/php/ajaxer.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/ajaxer.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -6,11 +6,11 @@ include_once('arc/ARC2.php'); $rdfParser = ARC2::getRDFParser(); - if (isset($_POST['search']) && !empty($_POST['search'])) { + if (isset($_POST['searchValue']) && !empty($_POST['searchValue'])) { if ($_POST['typeOfSearch'] === 'lastfm') { $lastfmContent = ''; - $lastfmResource = 'http://dbtune.org/last-fm/' . urlencode($_POST['search']); + $lastfmResource = 'http://dbtune.org/last-fm/' . urlencode($_POST['searchValue']); $rdfParser->parse($lastfmResource); Modified: trunk/src/moosique.net/php/config.ini =================================================================== --- trunk/src/moosique.net/php/config.ini 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/config.ini 2009-04-07 21:25:36 UTC (rev 1686) @@ -1,32 +1,38 @@ ; Config file for moosique.net ; Define Prefixes and global URLs here -[general] -path = "./" - [url] -wsdl = "http://localhost:8181/services?wsdl" -wsdlLocal = "main.wsdl" +jamendo = "http://dbtune.org/jamendo/sparql/" +lastfm = "http://dbtune.org/last-fm/" +local = "http://127.0.0.1/" musicbrainz = "http://dbtune.org/musicbrainz/sparql/" -jamendo = "http://dbtune.org/jamendo/sparql/" +wsdl = "http://localhost:8181/services?wsdl" +wsdlLocal = "main.wsdl" [prefix] -; map = "<file:/home/moustaki/work/motools/musicbrainz/d2r-server-0.4/mbz_mapping_raw.n3#>" -rdfs = "<http://www.w3.org/2000/01/rdf-schema#>" -owl = "<http://www.w3.org/2002/07/owl#>" -event = "<http://purl.org/NET/c4dm/event.owl#>" -rel = "<http://purl.org/vocab/relationship/>" -lingvoj = "<http://www.lingvoj.org/ontology#>" -foaf = "<http://xmlns.com/foaf/0.1/>" -rdf = "<http://www.w3.org/1999/02/22-rdf-syntax-ns#>" -tags = "<http://www.holygoat.co.uk/owl/redwood/0.1/tags/>" -db = "<http://dbtune.org/musicbrainz/resource/>" -dc = "<http://purl.org/dc/elements/1.1/>" -geo = "<http://www.geonames.org/ontology#>" -bio = "<http://purl.org/vocab/bio/0.1/>" -mo = "<http://purl.org/ontology/mo/>" -vocab = "<http://dbtune.org/musicbrainz/resource/vocab/>" -xsd = "<http://www.w3.org/2001/XMLSchema#>" -mbz = "<http://purl.org/ontology/mbz#>" +bio = "http://purl.org/vocab/bio/0.1/" +db = "http://dbtune.org/musicbrainz/resource/" +dc = "http://purl.org/dc/elements/1.1/" +event = "http://purl.org/NET/c4dm/event.owl#" +foaf = "http://xmlns.com/foaf/0.1/" +geo = "http://www.geonames.org/ontology#" +lingvoj = "http://www.lingvoj.org/ontology#" +mbz = "http://purl.org/ontology/mbz#" +mo = "http://purl.org/ontology/mo/" +owl = "http://www.w3.org/2002/07/owl#" +rdf = "http://www.w3.org/1999/02/22-rdf-syntax-ns#" +rdfs = "http://www.w3.org/2000/01/rdf-schema#" +rel = "http://purl.org/vocab/relationship/" +tags = "http://www.holygoat.co.uk/owl/redwood/0.1/tags/" +vocab = "http://dbtune.org/musicbrainz/resource/vocab/" +xsd = "http://www.w3.org/2001/XMLSchema#" ; -; \ No newline at end of file +; Last.fm-related Stuff +; +account = "http://xmlns.com/foaf/0.1/accountName" +maker = "http://xmlns.com/foaf/0.1/maker" +name = "http://xmlns.com/foaf/0.1/name" +played = "http://purl.org/ontology/last-fm/track_played" +title = "http://purl.org/dc/elements/1.1/title" +track = "http://purl.org/ontology/mo/track" +same = "http://www.w3.org/2002/07/owl#sameAs" \ No newline at end of file Modified: trunk/src/moosique.net/php/config.php =================================================================== --- trunk/src/moosique.net/php/config.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/config.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -12,37 +12,42 @@ * the config values and hand them to $this->config */ function __construct() { + $this->createConfig(); + } + + /** + * + * @return + */ + private function createConfig() { $this->config = parse_ini_file('config.ini', true); // load WSDL files (has to be done due to a Java web service bug) include('Utilities.php'); ini_set('soap.wsdl_cache_enabled', '0'); - Utilities::loadWSDLfiles($this->getUrl('wsdl')); + Utilities::loadWSDLfiles($this->getUrl('wsdl')); } /** * - * @return - * @param String $value */ - function getGeneral($value) { - return $this->config['general'][$value]; + public function getUrl($value) { + return $this->config['url'][$value]; } - + /** * * @return * @param object $value */ - function getUrl($value) { - return $this->config['url'][$value]; + public function getPrefix($value) { + return $this->config['prefix'][$value]; } - /** * * @return */ - function getPrefixes() { + public function getAllPrefixes() { return $this->config['prefix']; } } Modified: trunk/src/moosique.net/php/testJamendo.php =================================================================== --- trunk/src/moosique.net/php/testJamendo.php 2009-04-07 18:47:26 UTC (rev 1685) +++ trunk/src/moosique.net/php/testJamendo.php 2009-04-07 21:25:36 UTC (rev 1686) @@ -6,23 +6,37 @@ $connection = new DllearnerConnection($conf); -$query = ' -SELECT ?artist ?album -WHERE -{ ?a - a mo:MusicArtist; - foaf:name ?artist; - foaf:made ?album. - ?album tags:taggedWithTag <http://dbtune.org/jamendo/tag/stonerrock>. - } +$queryWorking = ' +select ?artist ?album where { + +?artistLink rdf:type mo:MusicArtist ; + foaf:name ?artist ; + foaf:made ?album ; + +} LIMIT 10 '; + +$queryNOTworking = ' +select ?artist ?album where { + +?artistLink rdf:type mo:MusicArtist ; + foaf:name ?artist ; + foaf:made ?album ; + +FILTER (regex(str(?artist), "vin", "i")) . + +} LIMIT 10 +'; + + /* TODO $spargel = new SparqlQueryBuilder($conf, 'Low Earth Orbit', 'artist', array('artist', 'title', 'image')); $query = $spargel->getQuery(); */ -$json = $connection->sparqlQuery($query); +$json = $connection->sparqlQuery($queryWorking); +// $json = $connection->sparqlQuery($queryNOTworking); $result = json_decode($json); $bindings = $result->results->bindings; @@ -30,4 +44,5 @@ print_r($bindings); echo '</pre>'; -?> \ No newline at end of file +?> + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |