From: <jen...@us...> - 2008-02-20 10:35:31
|
Revision: 616 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=616&view=rev Author: jenslehmann Date: 2008-02-20 02:35:28 -0800 (Wed, 20 Feb 2008) Log Message: ----------- added web service learning example for Maria Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/php-examples/LearningSimple.php Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-19 18:28:23 UTC (rev 615) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-20 10:35:28 UTC (rev 616) @@ -100,8 +100,8 @@ learningProblemMapping.put("posOnlyDefinition", PosOnlyDefinitionLP.class); learningAlgorithmMapping.put("random", RandomGuesser.class); learningAlgorithmMapping.put("bruteForce", BruteForceLearner.class); - learningAlgorithmMapping.put("genetic", ROLearner.class); - learningAlgorithmMapping.put("refinement", GP.class); + learningAlgorithmMapping.put("gp", GP.class); + learningAlgorithmMapping.put("refinement", ROLearner.class); learningAlgorithmMapping.put("refexamples", ExampleBasedROLComponent.class); components = Helper.union(knowledgeSourceMapping.keySet(),reasonerMapping.keySet()); components = Helper.union(components, learningProblemMapping.keySet()); Added: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php (rev 0) +++ trunk/src/php-examples/LearningSimple.php 2008-02-20 10:35:28 UTC (rev 616) @@ -0,0 +1,68 @@ +<?php +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + /** + * Small example showing how to use DL-Learner for learning class definitions. + * + * @author Jens Lehmann + */ + +include('Utilities.php'); + +// load WSDL files (has to be done due to a Java web service bug) +ini_set("soap.wsdl_cache_enabled","0"); +$wsdluri="http://localhost:8181/services?wsdl"; +Utilities::loadWSDLfiles($wsdluri); + +// specifiy ontology +$ontology = 'file:'.realpath("../../examples/family/father.owl"); + +// create DL-Learner client +$client = new SoapClient("main.wsdl"); + +// load owl file in DIG reasoner (you need a running DIG reasoner) +$id = $client->generateID(); +$ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); +$rID = $client->setReasoner($id, "dig"); + +// create a learning problem +$posExamples = array('http://example.com/father#stefan', + 'http://example.com/father#markus', + 'http://example.com/father#martin'); +$negExamples = array('http://example.com/father#heinz', + 'http://example.com/father#anna', + 'http://example.com/father#michelle'); +$client->setLearningProblem($id, "posNegDefinition"); +$client->setPositiveExamples($id, $posExamples); +$client->setNegativeExamples($id, $negExamples); + +// choose refinement operator approach +$client->setLearningAlgorithm($id, "refinement"); + +$client->initAll($id); + +// learn concept +echo 'start learning ... '; +$concept = $client->learn($id); +echo 'OK <br />'; +echo 'solution: ' . $concept; + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |