From: <jen...@us...> - 2008-06-13 11:20:39
|
Revision: 959 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=959&view=rev Author: jenslehmann Date: 2008-06-13 04:20:31 -0700 (Fri, 13 Jun 2008) Log Message: ----------- continued music recommender Modified Paths: -------------- trunk/src/music-recommender/ajax.php Added Paths: ----------- trunk/examples/yinyang_files/pairLearningProblemCV.xml trunk/src/music-recommender/DLLearnerConnection.php trunk/src/music-recommender/settings.ini Added: trunk/examples/yinyang_files/pairLearningProblemCV.xml =================================================================== --- trunk/examples/yinyang_files/pairLearningProblemCV.xml (rev 0) +++ trunk/examples/yinyang_files/pairLearningProblemCV.xml 2008-06-13 11:20:31 UTC (rev 959) @@ -0,0 +1,39 @@ +<?xml version="1.0" encoding="UTF-8"?> + + +<LearningProblem + +xmlns="http://www.di.uniba.it/learning" +xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" +xsi:schemaLocation="http://www.di.uniba.it/learning/../LearningProblem.xsd" + +knowledgeBase="file:../poker/pair50.owl" +positiveExampleSource="pairPositives.txt" +negativeExampleSource="pairNegatives.txt" +abstractionClass="it.uniba.di.dl.abstraction.KBoundMSCApproximatorRefinement" +learn="true" +normalize="true" +consistencyCheck="false" +reasonerURL ="http://localhost:8081" + + +> + + + + +<Experiments> + <kFoldCrossValidation folds="5" + reasonerURL="http://localhost:8081" + positiveExampleSource="pairPositives.txt" + negativeExampleSource="pairNegatives.txt" + abstractionClass="it.uniba.di.dl.abstraction.KBoundMSCApproximatorRefinement" + learn="true" + normalize="true" + consistencyCheck="true" /> + </Experiments> +<Namespaces> + <Namespace uri="http://localhost/foo#"></Namespace> +</Namespaces> + +</LearningProblem> Added: trunk/src/music-recommender/DLLearnerConnection.php =================================================================== --- trunk/src/music-recommender/DLLearnerConnection.php (rev 0) +++ trunk/src/music-recommender/DLLearnerConnection.php 2008-06-13 11:20:31 UTC (rev 959) @@ -0,0 +1,34 @@ +<?php + +/** + * Encapsulates all functions, which require communication with DL-Learner. + * TODO: use SESSION to store client id + * + * @author Jens Lehmann + * @author Anita Janassary + */ +class DLLearnerConnection +{ + private $endpointURL; + private $client; + + function DLLearnerConnection() { + ini_set('default_socket_timeout',200); + + // read in ini values + $ini = parse_ini_file("settings.ini"); + $this->endpointURL = $ini['endpointURL']; + + // connect to DL-Learner-Web-Service + $this->client=new SoapClient($ini["wsdlURLLocal"],array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); + } + + function sparqlQuery($query) { + $id=$this->client->generateID(); + $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->endpointURL); + $result=$this->client->sparqlQuery($id,$ksID,$query); + return $result; + } + +} +?> \ No newline at end of file Modified: trunk/src/music-recommender/ajax.php =================================================================== --- trunk/src/music-recommender/ajax.php 2008-06-11 16:30:50 UTC (rev 958) +++ trunk/src/music-recommender/ajax.php 2008-06-13 11:20:31 UTC (rev 959) @@ -27,6 +27,7 @@ */ require_once '../dbpedia-navigator/xajax/xajax_core/xajax.inc.php'; +require_once 'DLLearnerConnection.php'; $xajax = new xajax(); @@ -39,9 +40,33 @@ // search for songs matching the search string function doSearch($searchString) { - $newContent = 'searching for '.$searchString.' ... not implemented'; // ToDo: execute a SPARQL query (find labels matching search string) by contacting DL-Learner web service + $query = ' + PREFIX geo: <http://www.geonames.org/ontology#> + PREFIX wgs: <http://www.w3.org/2003/01/geo/wgs84_pos#> + SELECT DISTINCT ?an ?lat ?long ?name ?population + WHERE { + ?a a mo:MusicArtist; + foaf:based_near ?place; + foaf:name ?an; + foaf:made ?alb. + ?alb tags:taggedWithTag <http://dbtune.org/jamendo/tag/punk>. + ?place + geo:name ?name; + geo:population ?population; + wgs:lat ?lat; + wgs:long ?long + } + ORDER BY ?population'; + try { + $connection = new DLLearnerConnection(); + $result = $connection->sparqlQuery($query); + $newContent = 'searching for '.$searchString.' ... not implemented '.$result; + } catch (Exception $e) { + $newContent = '<b>Search aborted: '.$e->getMessage().'</b>'; + } + $objResponse = new xajaxResponse(); $objResponse->assign("searchElement","innerHTML", $newContent); return $objResponse; Added: trunk/src/music-recommender/settings.ini =================================================================== --- trunk/src/music-recommender/settings.ini (rev 0) +++ trunk/src/music-recommender/settings.ini 2008-06-13 11:20:31 UTC (rev 959) @@ -0,0 +1,7 @@ +;---------------------------------------------------------------------; +; configuration settings for music recommender ; +;---------------------------------------------------------------------; + +wsdlURL = "http://localhost:8181/services?wsdl" +wsdlURLLocal= "main.wsdl" +endpointURL = "http://dbtune.org:2105/sparql/" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |