From: <ku...@us...> - 2007-08-22 10:08:17
|
Revision: 16 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=16&view=rev Author: kurzum Date: 2007-08-22 03:08:15 -0700 (Wed, 22 Aug 2007) Log Message: ----------- changed folder name Added Paths: ----------- trunk/src/php-client/ Removed Paths: ------------- trunk/src/php-client-library/ Copied: trunk/src/php-client (from rev 14, trunk/src/php-client-library) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-10-09 09:26:35
|
Revision: 202 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=202&view=rev Author: jenslehmann Date: 2007-10-09 02:26:31 -0700 (Tue, 09 Oct 2007) Log Message: ----------- web service interface started (intermediate commit) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/server/ClientNotKnownException.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWSStart.java trunk/src/php-client/LearnerClient.php Added Paths: ----------- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java trunk/src/dl-learner/org/dllearner/server/State.java trunk/src/php-client/testnew.php Modified: trunk/src/dl-learner/org/dllearner/server/ClientNotKnownException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/ClientNotKnownException.java 2007-10-09 08:47:11 UTC (rev 201) +++ trunk/src/dl-learner/org/dllearner/server/ClientNotKnownException.java 2007-10-09 09:26:31 UTC (rev 202) @@ -1,15 +1,11 @@ package org.dllearner.server; public class ClientNotKnownException extends Exception { + static final long serialVersionUID=100; - String detail; - public ClientNotKnownException (String message, String detail) { - super (message); - this.detail = detail; + public ClientNotKnownException (long id) { + super ("Client with id " + id + " is not known."); } - public String getDetail () { - return detail; - } } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-09 08:47:11 UTC (rev 201) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-09 09:26:31 UTC (rev 202) @@ -212,7 +212,8 @@ ClientState c=this.clients.get(new Integer(id)); if(c==null){ //System.out.println(clients.keySet().toString()); - throw new ClientNotKnownException("Client with id: "+id+" is not known","ClientNotKnownException");}; + // throw new ClientNotKnownException("Client with id: "+id+" is not known","ClientNotKnownException"); + }; return c; } Added: trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java 2007-10-09 09:26:31 UTC (rev 202) @@ -0,0 +1,92 @@ +/** + * Copyright (C) 2007, 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/>. + * + */ +package org.dllearner.server; + +import java.util.HashMap; +import java.util.Random; + +import javax.jws.WebMethod; +import javax.jws.WebService; +import javax.jws.soap.SOAPBinding; + +import org.dllearner.core.ComponentManager; +import org.dllearner.core.KnowledgeSource; +import org.dllearner.kb.OWLFile; +import org.dllearner.kb.SparqlEndpoint; + +/** + * DL-Learner web service interface. + * + * @author Jens Lehmann + * @author Sebastian Hellmann + * + */ +@WebService(name = "DLLearnerWebService") +@SOAPBinding(style = SOAPBinding.Style.RPC) +public class DLLearnerWSNew { + + private HashMap<Long, State> clients; + private Random rand=new Random(); + private ComponentManager cm = ComponentManager.getInstance(); + + /** + * Generates a unique ID for the client and initialises a session. + * Using the ID the client can call the other web service methods. + * Two calls to this method are guaranteed to return different results. + * + * @return A session ID. + */ + @WebMethod + public long generateID() { + long id; + do { + id = rand.nextLong(); + } while(clients.containsKey(id)); + return id; + } + + // returns session state or throws client not known exception + private State getState(long id) throws ClientNotKnownException { + State state = clients.get(id); + if(state==null) + throw new ClientNotKnownException(id); + return state; + } + + @WebMethod + public void addKnowledgeSource(long id, String type, String url) throws ClientNotKnownException { + State state = getState(id); + Class<? extends KnowledgeSource> ksClass; + if(type.equals("sparql")) + ksClass = SparqlEndpoint.class; + else + ksClass = OWLFile.class; + KnowledgeSource ks = cm.knowledgeSource(ksClass); + cm.applyConfigEntry(ks, "url", url); + state.addKnowledgeSource(ks); + } + + @WebMethod + public void setLearningAlgorithm(long id, String algorithm) throws ClientNotKnownException { + State state = getState(id); + // ... + } + +} Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWSStart.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSStart.java 2007-10-09 08:47:11 UTC (rev 201) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWSStart.java 2007-10-09 09:26:31 UTC (rev 202) @@ -32,7 +32,7 @@ System.out.print("Starting DL-Learner web service at http://" + isa.getHostName()+":"+isa.getPort()+ "/services ... "); - Endpoint endpoint = Endpoint.create(new DLLearnerWS()); + Endpoint endpoint = Endpoint.create(new DLLearnerWSNew()); //Endpoint endpoint = Endpoint.create(new CustomDataClass()); HttpContext context = server.createContext("/services"); endpoint.publish(context); Added: trunk/src/dl-learner/org/dllearner/server/State.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/State.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/server/State.java 2007-10-09 09:26:31 UTC (rev 202) @@ -0,0 +1,119 @@ +/** + * Copyright (C) 2007, 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/>. + * + */ +package org.dllearner.server; + +import java.util.Set; + +import org.dllearner.core.KnowledgeSource; +import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.ReasonerComponent; + +/** + * Stores the state of a DL-Learner client session. + * + * @author Jens Lehmann + * + */ +public class State { + + private Set<KnowledgeSource> knowledgeSource; + + private LearningProblem learningProblem; + + private ReasonerComponent reasonerComponent; + + private LearningAlgorithm learningAlgorithm; + + /** + * @return the knowledgeSource + */ + public Set<KnowledgeSource> getKnowledgeSource() { + return knowledgeSource; + } + + /** + * @param knowledgeSource the knowledgeSource to set + */ + public void setKnowledgeSource(Set<KnowledgeSource> knowledgeSource) { + this.knowledgeSource = knowledgeSource; + } + + /** + * @param e + * @return + * @see java.util.Set#add(java.lang.Object) + */ + public boolean addKnowledgeSource(KnowledgeSource ks) { + return knowledgeSource.add(ks); + } + + /** + * @param o + * @return + * @see java.util.Set#remove(java.lang.Object) + */ + public boolean removeKnowledgeSource(KnowledgeSource ks) { + return knowledgeSource.remove(ks); + } + + /** + * @return the learningProblem + */ + public LearningProblem getLearningProblem() { + return learningProblem; + } + + /** + * @param learningProblem the learningProblem to set + */ + public void setLearningProblem(LearningProblem learningProblem) { + this.learningProblem = learningProblem; + } + + /** + * @return the reasonerComponent + */ + public ReasonerComponent getReasonerComponent() { + return reasonerComponent; + } + + /** + * @param reasonerComponent the reasonerComponent to set + */ + public void setReasonerComponent(ReasonerComponent reasonerComponent) { + this.reasonerComponent = reasonerComponent; + } + + /** + * @return the learningAlgorithm + */ + public LearningAlgorithm getLearningAlgorithm() { + return learningAlgorithm; + } + + /** + * @param learningAlgorithm the learningAlgorithm to set + */ + public void setLearningAlgorithm(LearningAlgorithm learningAlgorithm) { + this.learningAlgorithm = learningAlgorithm; + } + +} Modified: trunk/src/php-client/LearnerClient.php =================================================================== --- trunk/src/php-client/LearnerClient.php 2007-10-09 08:47:11 UTC (rev 201) +++ trunk/src/php-client/LearnerClient.php 2007-10-09 09:26:31 UTC (rev 202) @@ -194,7 +194,7 @@ public function getInfo(){ $functions = $this->soapclient->__getFunctions(); - echo '<b>Verf\xFCgbare Methoden:</b>'; + echo '<b>Verf�gbare Methoden:</b>'; echo '<pre>'; print_r($functions); echo '</pre>'; @@ -203,19 +203,19 @@ } - public function loadWSDLfiles($wsdluri){ - $main=$this->getwsdl($wsdluri); - $other=$this->getOtherWSDL($main); - $newMain=$this->changeWSDL($main); - $this->writeToFile("main.wsdl",$newMain); + public static function loadWSDLfiles($wsdluri){ + $main=self::getwsdl($wsdluri); + $other=self::getOtherWSDL($main); + $newMain=self::changeWSDL($main); + self::writeToFile("main.wsdl",$newMain); $x=0; foreach ($other as $o){ - $this->writeToFile("def".($x++).".xsd",$this->getwsdl($o)); + self::writeToFile("def".($x++).".xsd",self::getwsdl($o)); } } - public function changeWSDL($wsdl){ + public static function changeWSDL($wsdl){ $before="<xsd:import schemaLocation=\""; $after="\" namespace=\""; $newWSDL=""; @@ -236,7 +236,7 @@ } - public function getOtherWSDL($wsdl){ + public static function getOtherWSDL($wsdl){ $before="<xsd:import schemaLocation=\""; $after="\" namespace=\""; $ret=array(); @@ -254,7 +254,7 @@ - public function getwsdl($wsdluri){ + public static function getwsdl($wsdluri){ // this is copied from the Pear example // please don't ask me how it works $req = &new HTTP_Request($wsdluri); @@ -267,7 +267,7 @@ - public function writeToFile($filename,$content){ + public static function writeToFile($filename,$content){ $fp=fopen($filename,"w"); fwrite($fp,$content); Added: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php (rev 0) +++ trunk/src/php-client/testnew.php 2007-10-09 09:26:31 UTC (rev 202) @@ -0,0 +1,22 @@ +<?php + +include_once("LearnerClient.php"); + +ini_set("soap.wsdl_cache_enabled","0"); + +$wsdluri="http://localhost:8181/services?wsdl"; + +// always update WSDL +LearnerClient::loadWSDLfiles($wsdluri); + +// test web service +$client = new SoapClient("main.wsdl"); + +$test = $client->hello(); +echo $test; + +$stringar = array('blub','blab'); +$ret = $client->test($stringar); +print_r($ret); + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-10-10 11:23:04
|
Revision: 207 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=207&view=rev Author: jenslehmann Date: 2007-10-10 04:22:58 -0700 (Wed, 10 Oct 2007) Log Message: ----------- - web service: returns IDs for the components in set and add methods -> these can be used to refer to components later on - web service: added generic method to configure components Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java trunk/src/dl-learner/org/dllearner/server/State.java trunk/src/php-client/testnew.php Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java 2007-10-10 09:26:44 UTC (rev 206) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java 2007-10-10 11:22:58 UTC (rev 207) @@ -20,7 +20,6 @@ package org.dllearner.server; import java.util.Arrays; -import java.util.HashMap; import java.util.Map; import java.util.Random; import java.util.Set; @@ -32,6 +31,7 @@ import javax.jws.soap.SOAPBinding; import org.dllearner.algorithms.refinement.ROLearner; +import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; @@ -54,10 +54,25 @@ @SOAPBinding(style = SOAPBinding.Style.RPC) public class DLLearnerWSNew { - private Map<Long, State> clients = new TreeMap<Long,State>(); + private Map<Integer, State> clients = new TreeMap<Integer,State>(); private Random rand=new Random(); private static ComponentManager cm = ComponentManager.getInstance(); + // defines the components, which are accessible for the web service + private static Map<String,Class<? extends KnowledgeSource>> knowledgeSourceMapping = new TreeMap<String,Class<? extends KnowledgeSource>>(); + private static Map<String,Class<? extends ReasonerComponent>> reasonerMapping = new TreeMap<String,Class<? extends ReasonerComponent>>(); + private static Map<String,Class<? extends LearningProblem>> learningProblemMapping = new TreeMap<String,Class<? extends LearningProblem>>(); + private static Map<String,Class<? extends LearningAlgorithm>> learningAlgorithmMapping = new TreeMap<String,Class<? extends LearningAlgorithm>>(); + + public DLLearnerWSNew() { + knowledgeSourceMapping.put("owlfile", OWLFile.class); + knowledgeSourceMapping.put("sparql", SparqlEndpoint.class); + reasonerMapping.put("dig", DIGReasoner.class); + learningProblemMapping.put("posNegDefinition", PosNegDefinitionLP.class); + learningProblemMapping.put("posNegInclusion", PosNegInclusionLP.class); + learningAlgorithmMapping.put("refinement", ROLearner.class); + } + /** * Generates a unique ID for the client and initialises a session. * Using the ID the client can call the other web service methods. @@ -66,36 +81,51 @@ * @return A session ID. */ @WebMethod - public long generateID() { - long id; + public int generateID() { + int id; do { - id = rand.nextLong(); + id = rand.nextInt(); } while(clients.containsKey(id)); clients.put(id, new State()); return id; } // returns session state or throws client not known exception - private State getState(long id) throws ClientNotKnownException { + private State getState(int id) throws ClientNotKnownException { State state = clients.get(id); if(state==null) throw new ClientNotKnownException(id); return state; } + // returns the class which is referred to by the string + private Class<? extends Component> getComponent(String component) throws UnknownComponentException { + if(knowledgeSourceMapping.containsKey(component)) + return knowledgeSourceMapping.get(component); + else if(reasonerMapping.containsKey(component)) + return reasonerMapping.get(component); + else if(learningProblemMapping.containsKey(component)) + return learningProblemMapping.get(component); + else if(learningAlgorithmMapping.containsKey(component)) + return learningAlgorithmMapping.get(component); + else + throw new UnknownComponentException(component); + } + /////////////////////////////////////// // methods for basic component setup // /////////////////////////////////////// + /** + * Adds a knowledge source. + * + * @return An identifier for the component. + */ @WebMethod - public boolean addKnowledgeSource(long id, String component, String url) throws ClientNotKnownException, UnknownComponentException { + public int addKnowledgeSource(int id, String component, String url) throws ClientNotKnownException, UnknownComponentException { State state = getState(id); - Class<? extends KnowledgeSource> ksClass; - if(component.equals("sparql")) - ksClass = SparqlEndpoint.class; - else if(component.equals("owlfile")) - ksClass = OWLFile.class; - else + Class<? extends KnowledgeSource> ksClass = knowledgeSourceMapping.get(component); + if(ksClass == null) throw new UnknownComponentException(component); KnowledgeSource ks = cm.knowledgeSource(ksClass); cm.applyConfigEntry(ks, "url", url); @@ -103,17 +133,15 @@ } @WebMethod - public boolean removeKnowledgeSource(long id, String url) throws ClientNotKnownException { - return getState(id).removeKnowledgeSource(url); + public void removeKnowledgeSource(int id, int componentID) throws ClientNotKnownException { + getState(id).removeKnowledgeSource(componentID); } @WebMethod - public void setReasoner(long id, String component) throws ClientNotKnownException, UnknownComponentException { + public void setReasoner(int id, String component) throws ClientNotKnownException, UnknownComponentException { State state = getState(id); - Class<? extends ReasonerComponent> rcClass; - if(component.equals("dig")) - rcClass = DIGReasoner.class; - else + Class<? extends ReasonerComponent> rcClass = reasonerMapping.get(component); + if(rcClass == null) throw new UnknownComponentException(component); ReasonerComponent rc = cm.reasoner(rcClass, state.getKnowledgeSources()); @@ -121,14 +149,10 @@ } @WebMethod - public void setLearningProblem(long id, String component) throws ClientNotKnownException, UnknownComponentException { + public void setLearningProblem(int id, String component) throws ClientNotKnownException, UnknownComponentException { State state = getState(id); - Class<? extends LearningProblem> lpClass; - if(component.equals("posNegDefinition")) - lpClass = PosNegDefinitionLP.class; - else if(component.equals("posNegInclusion")) - lpClass = PosNegInclusionLP.class; - else + Class<? extends LearningProblem> lpClass = learningProblemMapping.get(component); + if(lpClass == null) throw new UnknownComponentException(component); LearningProblem lp = cm.learningProblem(lpClass, state.getReasoningService()); @@ -136,12 +160,10 @@ } @WebMethod - public void setLearningAlgorithm(long id, String component) throws ClientNotKnownException, UnknownComponentException { + public void setLearningAlgorithm(int id, String component) throws ClientNotKnownException, UnknownComponentException { State state = getState(id); - Class<? extends LearningAlgorithm> laClass; - if(component.equals("refinement")) - laClass = ROLearner.class; - else + Class<? extends LearningAlgorithm> laClass = learningAlgorithmMapping.get(component); + if(laClass == null) throw new UnknownComponentException(component); LearningAlgorithm la = cm.learningAlgorithm(laClass, state.getLearningProblem(), state.getReasoningService()); @@ -153,7 +175,7 @@ * @param id Session ID. */ @WebMethod - public void init(long id) throws ClientNotKnownException { + public void init(int id) throws ClientNotKnownException { State state = getState(id); for(KnowledgeSource ks : state.getKnowledgeSources()) ks.init(); @@ -163,32 +185,44 @@ } @WebMethod - public String learn(long id) throws ClientNotKnownException { + public String learn(int id) throws ClientNotKnownException { State state = getState(id); state.getLearningAlgorithm().start(); return state.getLearningAlgorithm().getBestSolution().toString(); } + @WebMethod + public void stop(int id) throws ClientNotKnownException { + getState(id).getLearningAlgorithm().stop(); + } + ///////////////////////////////////////// // methods for component configuration // ///////////////////////////////////////// @WebMethod - public void setPositiveExamples(long id, String[] positiveExamples) throws ClientNotKnownException { + public void setPositiveExamples(int id, String[] positiveExamples) throws ClientNotKnownException { State state = getState(id); Set<String> posExamples = new TreeSet<String>(Arrays.asList(positiveExamples)); cm.applyConfigEntry(state.getLearningProblem(), "positiveExamples", posExamples); } @WebMethod - public void setNegativeExamples(long id, String[] negativeExamples) throws ClientNotKnownException { + public void setNegativeExamples(int id, String[] negativeExamples) throws ClientNotKnownException { State state = getState(id); Set<String> negExamples = new TreeSet<String>(Arrays.asList(negativeExamples)); cm.applyConfigEntry(state.getLearningProblem(), "negativeExamples", negExamples); } + @WebMethod + public void applyConfigEntry(int sessionID, int componentID, String optionName, Object value) throws ClientNotKnownException, UnknownComponentException { + State state = getState(sessionID); + Component component = state.getComponent(componentID); + cm.applyConfigEntry(component, optionName, value); + } + //////////////////////////////////// // reasoning and querying methods // //////////////////////////////////// - + } Modified: trunk/src/dl-learner/org/dllearner/server/State.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/State.java 2007-10-10 09:26:44 UTC (rev 206) +++ trunk/src/dl-learner/org/dllearner/server/State.java 2007-10-10 11:22:58 UTC (rev 207) @@ -19,10 +19,14 @@ */ package org.dllearner.server; +import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; +import java.util.Map; +import java.util.Random; import java.util.Set; +import org.dllearner.core.Component; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; @@ -39,6 +43,11 @@ */ public class State { + // stores the mapping between component IDs and component + // (note that this allows us to keep all references to components even + // if they are note used anymore e.g. a deleted knowledge source) + private Map<Integer,Component> componentIDs = new HashMap<Integer,Component>(); + private Set<KnowledgeSource> knowledgeSources = new HashSet<KnowledgeSource>(); private LearningProblem learningProblem; @@ -48,30 +57,37 @@ private LearningAlgorithm learningAlgorithm; - /** - * @return the knowledgeSource - */ - public Set<KnowledgeSource> getKnowledgeSources() { - return knowledgeSources; + private Random rand=new Random(); + + private int generateComponentID(Component component) { + int id; + do { + id = rand.nextInt(); + } while(componentIDs.keySet().contains(id)); + componentIDs.put(id, component); + return id; } + +// public Component getComponent(Class<? extends Component> componentClass) throws UnknownComponentException { +// if(learningProblem.getClass().equals(componentClass)) +// return learningProblem; +// else if(learningAlgorithm.getClass().equals(componentClass)) +// return learningAlgorithm; +// else if(reasonerComponent.getClass().equals(componentClass)) +// return reasonerComponent; +// else if(KnowledgeSource.class.isAssignableFrom(componentClass)) { +// +// +// for(KnowledgeSource ks : knowledgeSources) { +// if(ks.getClass().equals(componentClass)) +// return ks; +// } +// throw new UnknownComponentException(componentClass.getName()); +// } else +// throw new UnknownComponentException(componentClass.getName()); +// } /** - * @param knowledgeSources the knowledgeSource to set - */ - public void setKnowledgeSources(Set<KnowledgeSource> knowledgeSources) { - this.knowledgeSources = knowledgeSources; - } - - /** - * @param e - * @return - * @see java.util.Set#add(java.lang.Object) - */ - public boolean addKnowledgeSource(KnowledgeSource ks) { - return knowledgeSources.add(ks); - } - - /** * Removes a knowledge source with the given URL (independant of its type). * @param url URL of the OWL file or SPARQL Endpoint. * @return True if a knowledge source was deleted, false otherwise. @@ -99,8 +115,9 @@ /** * @param learningProblem the learningProblem to set */ - public void setLearningProblem(LearningProblem learningProblem) { + public int setLearningProblem(LearningProblem learningProblem) { this.learningProblem = learningProblem; + return generateComponentID(learningProblem); } /** @@ -116,9 +133,10 @@ * * @param reasonerComponent the reasonerComponent to set */ - public void setReasonerComponent(ReasonerComponent reasonerComponent) { + public int setReasonerComponent(ReasonerComponent reasonerComponent) { this.reasonerComponent = reasonerComponent; reasoningService = new ReasoningService(reasonerComponent); + return generateComponentID(reasonerComponent); } /** @@ -131,8 +149,9 @@ /** * @param learningAlgorithm the learningAlgorithm to set */ - public void setLearningAlgorithm(LearningAlgorithm learningAlgorithm) { + public int setLearningAlgorithm(LearningAlgorithm learningAlgorithm) { this.learningAlgorithm = learningAlgorithm; + return generateComponentID(learningAlgorithm); } /** @@ -141,5 +160,34 @@ public ReasoningService getReasoningService() { return reasoningService; } + + /** + * @param key + * @return + * @see java.util.Map#get(java.lang.Object) + */ + public Component getComponent(int id) { + return componentIDs.get(id); + } + + /** + * @param e + * @return + */ + public int addKnowledgeSource(KnowledgeSource ks) { + knowledgeSources.add(ks); + return generateComponentID(ks); + + } + + public boolean removeKnowledgeSource(int componentID) { + return knowledgeSources.remove(componentIDs.get(componentID)); + } + /** + * @return the knowledgeSources + */ + public Set<KnowledgeSource> getKnowledgeSources() { + return knowledgeSources; + } } Modified: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php 2007-10-10 09:26:44 UTC (rev 206) +++ trunk/src/php-client/testnew.php 2007-10-10 11:22:58 UTC (rev 207) @@ -22,7 +22,7 @@ $id = $client->generateID(); -$client->addKnowledgeSource($id, "owlfile", $ontology); +$ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); $client->setReasoner($id, "dig"); $client->setLearningProblem($id, "posNegDefinition"); $client->setPositiveExamples($id, $posExamples); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-10-10 16:45:23
|
Revision: 213 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=213&view=rev Author: jenslehmann Date: 2007-10-10 09:45:22 -0700 (Wed, 10 Oct 2007) Log Message: ----------- - implemented threaded execution of learning algorithms in web service (i.e. non-blocking method for starting the algorithm) => see demo in testnew.php - example reasoning method for web service implemented Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java trunk/src/dl-learner/org/dllearner/server/State.java trunk/src/php-client/testnew.php Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java 2007-10-10 13:16:25 UTC (rev 212) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWSNew.java 2007-10-10 16:45:22 UTC (rev 213) @@ -37,6 +37,7 @@ import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; +import org.dllearner.core.dl.AtomicConcept; import org.dllearner.kb.OWLFile; import org.dllearner.kb.SparqlEndpoint; import org.dllearner.learningproblems.PosNegDefinitionLP; @@ -184,6 +185,14 @@ state.getLearningAlgorithm().init(); } + /** + * Starts the learning algorithm and returns the best concept found. This + * method will block until learning is completed. + * + * @param id Session ID. + * @return The best solution found. + * @throws ClientNotKnownException + */ @WebMethod public String learn(int id) throws ClientNotKnownException { State state = getState(id); @@ -191,7 +200,45 @@ return state.getLearningAlgorithm().getBestSolution().toString(); } + /** + * Starts the learning algorithm and returns immediately. The learning + * algorithm is executed in its own thread and can be queried and + * controlled using other Web Service methods. + * + * @param id Session ID. + * @throws ClientNotKnownException + */ + @WebMethod + public void learnThreaded(int id) throws ClientNotKnownException { + final State state = getState(id); + Thread learningThread = new Thread() { + @Override + public void run() { + state.setAlgorithmRunning(true); + state.getLearningAlgorithm().start(); + state.setAlgorithmRunning(false); + } + }; + learningThread.start(); + } + @WebMethod + public String getCurrentlyBestConcept(int id) throws ClientNotKnownException { + State state = getState(id); + return state.getLearningAlgorithm().getBestSolution().toString(); + } + + @WebMethod + public boolean isAlgorithmRunning(int id) throws ClientNotKnownException { + return getState(id).isAlgorithmRunning(); + } + + /** + * Stops the learning algorithm smoothly. + * @param id + * @throws ClientNotKnownException + */ + @WebMethod public void stop(int id) throws ClientNotKnownException { getState(id).getLearningAlgorithm().stop(); } @@ -225,4 +272,17 @@ // reasoning and querying methods // //////////////////////////////////// + @WebMethod + public String[] getAtomicConcepts(int id) throws ClientNotKnownException { + Set<AtomicConcept> atomicConcepts = getState(id).getReasoningService().getAtomicConcepts(); + // convert to String-Array + String[] result = new String[atomicConcepts.size()]; + int i=0; + for(AtomicConcept ac : atomicConcepts) { + result[i] = ac.getName(); + i++; + } + return result; + } + } Modified: trunk/src/dl-learner/org/dllearner/server/State.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/State.java 2007-10-10 13:16:25 UTC (rev 212) +++ trunk/src/dl-learner/org/dllearner/server/State.java 2007-10-10 16:45:22 UTC (rev 213) @@ -59,6 +59,8 @@ private Random rand=new Random(); + private boolean isAlgorithmRunning = false; + private int generateComponentID(Component component) { int id; do { @@ -68,6 +70,20 @@ return id; } + /** + * @return the isAlgorithmRunning + */ + public boolean isAlgorithmRunning() { + return isAlgorithmRunning; + } + + /** + * @param isAlgorithmRunning the isAlgorithmRunning to set + */ + public void setAlgorithmRunning(boolean isAlgorithmRunning) { + this.isAlgorithmRunning = isAlgorithmRunning; + } + // public Component getComponent(Class<? extends Component> componentClass) throws UnknownComponentException { // if(learningProblem.getClass().equals(componentClass)) // return learningProblem; Modified: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php 2007-10-10 13:16:25 UTC (rev 212) +++ trunk/src/php-client/testnew.php 2007-10-10 16:45:22 UTC (rev 213) @@ -37,11 +37,40 @@ $init = $learn_start - $start; echo 'components initialised in '.$init.' seconds<br />'; -$concept = $client->learn($id); +$threaded = true; -$learn = microtime(true) - $learn_start; -echo 'concept learned in '.$learn.' seconds<br />'; +if($threaded == false) { -echo 'result: '.$concept; + $concept = $client->learn($id); + + $learn = microtime(true) - $learn_start; + echo 'concept learned in '.$learn.' seconds<br />'; + + echo 'result: '.$concept; + +} else { + $client->learnThreaded($id); + + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see what we have learned so far + $concept=$client->getCurrentlyBestConcept($id); + $running=$client->isAlgorithmRunning($id); + + $seconds = $i * $sleeptime; + + echo 'result after '.$seconds.' seconds of sleep: '.$concept.'<br />'; + + $i++; + } while($running); + + echo 'algorithm finished'; +} + ?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-10-16 15:01:26
|
Revision: 229 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=229&view=rev Author: jenslehmann Date: 2007-10-16 08:01:23 -0700 (Tue, 16 Oct 2007) Log Message: ----------- - created (meta-)methods for accessing applied configuration methods - added getters for all configuration options in web service Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java trunk/src/dl-learner/org/dllearner/core/ComponentPool.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-client/testnew.php Added Paths: ----------- trunk/src/dl-learner/org/dllearner/server/ConfigOptionTypeException.java trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2007-10-16 13:24:32 UTC (rev 228) +++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2007-10-16 15:01:23 UTC (rev 229) @@ -256,12 +256,14 @@ * @param source A registered knowledge source component. * @return An instance of the given knowledge source class. */ - public KnowledgeSource knowledgeSource(Class<? extends KnowledgeSource> source) { + public <T extends KnowledgeSource> T knowledgeSource(Class<T> source) { if (!knowledgeSources.contains(source)) System.err.println("Warning: knowledge source " + source + " is not a registered knowledge source component."); - return invokeConstructor(source, new Class[] {}, new Object[] {}); + T ks = invokeConstructor(source, new Class[] {}, new Object[] {}); + pool.registerComponent(ks); + return ks; } public <T extends ReasonerComponent> T reasoner(Class<T> reasoner, @@ -277,11 +279,10 @@ System.err.println("Warning: reasoner component " + reasoner + " is not a registered reasoner component."); - return invokeConstructor(reasoner, new Class[] { Set.class }, + T rc = invokeConstructor(reasoner, new Class[] { Set.class }, new Object[] { sources }); -// T reasonerInstance = invokeConstructor(reasoner, new Class[] { Set.class }, -// new Object[] { sources }); -// return new ReasoningService(reasonerInstance); + pool.registerComponent(rc); + return rc; } /** @@ -300,40 +301,70 @@ return new ReasoningService(reasoner); } - public <T extends LearningProblem> T learningProblem(Class<T> lp, ReasoningService reasoner) { - if (!learningProblems.contains(lp)) - System.err.println("Warning: learning problem " + lp + public <T extends LearningProblem> T learningProblem(Class<T> lpClass, ReasoningService reasoner) { + if (!learningProblems.contains(lpClass)) + System.err.println("Warning: learning problem " + lpClass + " is not a registered learning problem component."); - return invokeConstructor(lp, new Class[] { ReasoningService.class }, + T lp = invokeConstructor(lpClass, new Class[] { ReasoningService.class }, new Object[] { reasoner }); + pool.registerComponent(lp); + return lp; } // automagically calls the right constructor for the given learning problem - public <T extends LearningAlgorithm> T learningAlgorithm(Class<T> la, LearningProblem lp, ReasoningService rs) { - if (!learningAlgorithms.contains(la)) - System.err.println("Warning: learning algorithm " + la + public <T extends LearningAlgorithm> T learningAlgorithm(Class<T> laClass, LearningProblem lp, ReasoningService rs) { + if (!learningAlgorithms.contains(laClass)) + System.err.println("Warning: learning algorithm " + laClass + " is not a registered learning algorithm component."); // find the right constructor: use the one that is registered and // has the class of the learning problem as a subclass Class<? extends LearningProblem> constructorArgument = null; - for (Class<? extends LearningProblem> problemClass : algorithmProblemsMapping.get(la)) { + for (Class<? extends LearningProblem> problemClass : algorithmProblemsMapping.get(laClass)) { if (problemClass.isAssignableFrom(lp.getClass())) constructorArgument = problemClass; } if (constructorArgument == null) { System.err.println("Warning: No suitable constructor registered for algorithm " - + la.getName() + " and problem " + lp.getClass().getName() - + ". Registered constructors for " + la.getName() + ": " - + algorithmProblemsMapping.get(la) + "."); + + laClass.getName() + " and problem " + lp.getClass().getName() + + ". Registered constructors for " + laClass.getName() + ": " + + algorithmProblemsMapping.get(laClass) + "."); return null; } - return invokeConstructor(la, new Class[] { constructorArgument, ReasoningService.class }, new Object[] { lp, rs }); + T la = invokeConstructor(laClass, new Class[] { constructorArgument, ReasoningService.class }, new Object[] { lp, rs }); + pool.registerComponent(la); + return la; } + /** + * The <code>ComponentManager</code> factory methods produce component + * instances, which can be freed using this method. Calling the factory + * methods without freeing components when they are not used anymore + * can (in theory) cause memory problems. + * + * @param component The component to free. + */ + public void freeComponent(Component component) { + pool.unregisterComponent(component); + } + + public <T> T getConfigOptionValue(Component component, ConfigOption<T> option) { + T object = pool.getLastValidConfigValue(component, option); + if(object==null) + return option.getDefaultValue(); + else + return object; + } + + public Object getConfigOptionValue(Component component, String optionName) { + ConfigOption<?> option = (ConfigOption<?>) componentOptionsByName.get( + component.getClass()).get(optionName); + return getConfigOptionValue(component, option); + } + public void writeConfigDocumentation(File file) { String doc = ""; doc += "This file contains an automatically generated files of all components and their config options.\n\n"; Modified: trunk/src/dl-learner/org/dllearner/core/ComponentPool.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentPool.java 2007-10-16 13:24:32 UTC (rev 228) +++ trunk/src/dl-learner/org/dllearner/core/ComponentPool.java 2007-10-16 15:01:23 UTC (rev 229) @@ -25,7 +25,8 @@ import java.util.Map; /** - * Stores all live components. + * Stores all live components and the configuration options, which were + * applied to them. * * @author Jens Lehmann * @@ -42,10 +43,6 @@ // complete history of all made config entries for a component private Map<Component,List<ConfigEntry<?>>> configEntryHistory = new HashMap<Component,List<ConfigEntry<?>>>(); - public Object getLastValidConfigEntry(Component component, ConfigOption<?> option) { - return lastValidConfigValue.get(component).get(option); - } - public void registerComponent(Component component) { components.add(component); Map<ConfigOption<?>,Object> emptyMap = new HashMap<ConfigOption<?>,Object>(); @@ -59,10 +56,11 @@ components.remove(component); } - public Object getLastValidConfigValue(Component component, ConfigOption<?> option) { - return lastValidConfigValue.get(component).get(option); + @SuppressWarnings({"unchecked"}) + public <T> T getLastValidConfigValue(Component component, ConfigOption<T> option) { + return (T) lastValidConfigValue.get(component).get(option); } - + public void addConfigEntry(Component component, ConfigEntry<?> entry, boolean valid) { configEntryHistory.get(component).add(entry); if(valid) Added: trunk/src/dl-learner/org/dllearner/server/ConfigOptionTypeException.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/ConfigOptionTypeException.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/server/ConfigOptionTypeException.java 2007-10-16 15:01:23 UTC (rev 229) @@ -0,0 +1,37 @@ +/** + * Copyright (C) 2007, 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/>. + * + */ +package org.dllearner.server; + +/** + * Exception for indicating that an operation was performed on + * a wrong type. + * + * @author Jens Lehmann + * + */ +public class ConfigOptionTypeException extends Exception { + + private static final long serialVersionUID = -6856243711006023178L; + + public ConfigOptionTypeException(String optionName, Class<?> correctType, Class<?> wrongType) { + super(optionName + " is of type " + correctType.getName() + ", so you cannot use type " + wrongType.getName() + "."); + } + +} Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-16 13:24:32 UTC (rev 228) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-16 15:01:23 UTC (rev 229) @@ -296,6 +296,46 @@ cm.applyConfigEntry(component, optionName, value); } + @WebMethod + public String[] getConfigOptionValueStringArray(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + return getConfigOptionValue(sessionID, componentID, optionName, String[].class); + } + + @WebMethod + public String getConfigOptionValueString(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + return getConfigOptionValue(sessionID, componentID, optionName, String.class); + } + + @WebMethod + public Double getConfigOptionValueDouble(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + return getConfigOptionValue(sessionID, componentID, optionName, Double.class); + } + + @WebMethod + public Boolean getConfigOptionValueBoolean(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + return getConfigOptionValue(sessionID, componentID, optionName, Boolean.class); + } + + @WebMethod + public Integer getConfigOptionValueInt(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + return getConfigOptionValue(sessionID, componentID, optionName, Integer.class); + } + + @SuppressWarnings({"unchecked"}) + private <T> T getConfigOptionValue(int sessionID, int componentID, String optionName, Class<T> clazz) throws ClientNotKnownException, UnknownComponentException, ConfigOptionTypeException { + Object value = getConfigOptionValue(sessionID, componentID, optionName); + if(clazz.isInstance(value)) + return (T) value; + else + throw new ConfigOptionTypeException(optionName, clazz, value.getClass()); + } + + private Object getConfigOptionValue(int sessionID, int componentID, String optionName) throws ClientNotKnownException, UnknownComponentException { + ClientState state = getState(sessionID); + Component component = state.getComponent(componentID); + return cm.getConfigOptionValue(component, optionName); + } + //////////////////////////////////// // reasoning and querying methods // //////////////////////////////////// Added: trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/ConfigOptionTypeExceptionBean.java 2007-10-16 15:01:23 UTC (rev 229) @@ -0,0 +1,41 @@ + +package org.dllearner.server.jaxws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * This class was generated by the JAXWS SI. + * JAX-WS RI 2.0_02-b08-fcs + * Generated source version: 2.0_02 + * + */ +@XmlRootElement(name = "ConfigOptionTypeException", namespace = "http://server.dllearner.org/") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ConfigOptionTypeException", namespace = "http://server.dllearner.org/") +public class ConfigOptionTypeExceptionBean { + + private String message; + + /** + * + * @return + * returns String + */ + public String getMessage() { + return this.message; + } + + /** + * + * @param message + * the value for the message property + */ + public void setMessage(String message) { + this.message = message; + } + +} Modified: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php 2007-10-16 13:24:32 UTC (rev 228) +++ trunk/src/php-client/testnew.php 2007-10-16 15:01:23 UTC (rev 229) @@ -23,6 +23,7 @@ $id = $client->generateID(); $ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); +// echo $client->getConfigOptionValueString($id, $ksID, "url"); $client->setReasoner($id, "dig"); $client->setLearningProblem($id, "posNegDefinition"); $client->setPositiveExamples($id, $posExamples); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-10-17 10:33:47
|
Revision: 230 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=230&view=rev Author: jenslehmann Date: 2007-10-17 03:33:42 -0700 (Wed, 17 Oct 2007) Log Message: ----------- - implemented generic access to all available components and configuration options in web service interface => this allows to write completely generic clients (e.g. clients could extend themselves automatically once new components and options become available) - demo implemented in testnew.php - improved toString() method for config options Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java trunk/src/dl-learner/org/dllearner/core/ConfigOption.java trunk/src/dl-learner/org/dllearner/core/DoubleConfigOption.java trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/dl-learner/org/dllearner/utilities/Helper.java trunk/src/php-client/testnew.php Modified: trunk/src/dl-learner/org/dllearner/core/ComponentManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/dl-learner/org/dllearner/core/ComponentManager.java 2007-10-17 10:33:42 UTC (rev 230) @@ -465,6 +465,13 @@ return null; } + public static List<ConfigOption<?>> getConfigOptions(Class<? extends Component> componentClass) { + if (!components.contains(componentClass)) + System.err.println("Warning: component " + componentClass + + " is not a registered component. [ComponentManager.getConfigOptions]"); + return componentOptions.get(componentClass); + } + public ConfigOption<?> getConfigOption(Class<? extends Component> component, String name) { return componentOptionsByName.get(component).get(name); } @@ -473,4 +480,6 @@ return componentNames.get(component); } + + } Modified: trunk/src/dl-learner/org/dllearner/core/ConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ConfigOption.java 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/dl-learner/org/dllearner/core/ConfigOption.java 2007-10-17 10:33:42 UTC (rev 230) @@ -76,13 +76,13 @@ public abstract boolean isValidValue(T value); - public static String getRestrictionDescription() { - return "none"; + public String getAllowedValuesDescription() { + return getClass().toString(); } @Override public String toString() { - return "option name: " + name + "\ndescription: " + description + "\nvalues: " + getRestrictionDescription() + "\ndefault value: " + defaultValue + "\n"; + return "option name: " + name + "\ndescription: " + description + "\nvalues: " + getAllowedValuesDescription() + "\ndefault value: " + defaultValue + "\n"; } } Modified: trunk/src/dl-learner/org/dllearner/core/DoubleConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/DoubleConfigOption.java 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/dl-learner/org/dllearner/core/DoubleConfigOption.java 2007-10-17 10:33:42 UTC (rev 230) @@ -85,5 +85,15 @@ public boolean checkType(Object object) { return (object instanceof Double); } + + @Override + public String getAllowedValuesDescription() { + String str = getClass().toString(); + if(lowerLimit != Double.MIN_VALUE) + str += " min " + lowerLimit; + if(upperLimit != Double.MAX_VALUE) + str += " max " + upperLimit; + return str; + } } Modified: trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/dl-learner/org/dllearner/core/IntegerConfigOption.java 2007-10-17 10:33:42 UTC (rev 230) @@ -86,4 +86,14 @@ return (object instanceof Integer); } + @Override + public String getAllowedValuesDescription() { + String str = getClass().toString(); + if(lowerLimit != Integer.MIN_VALUE) + str += " min " + lowerLimit; + if(upperLimit != Integer.MAX_VALUE) + str += " max " + upperLimit; + return str; + } + } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-17 10:33:42 UTC (rev 230) @@ -20,6 +20,7 @@ package org.dllearner.server; import java.util.Arrays; +import java.util.List; import java.util.Map; import java.util.Random; import java.util.Set; @@ -34,6 +35,7 @@ import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; +import org.dllearner.core.ConfigOption; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; @@ -50,6 +52,7 @@ import org.dllearner.parser.ParseException; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.utilities.Datastructures; +import org.dllearner.utilities.Helper; /** * DL-Learner web service interface. @@ -71,6 +74,7 @@ private static Map<String,Class<? extends ReasonerComponent>> reasonerMapping = new TreeMap<String,Class<? extends ReasonerComponent>>(); private static Map<String,Class<? extends LearningProblem>> learningProblemMapping = new TreeMap<String,Class<? extends LearningProblem>>(); private static Map<String,Class<? extends LearningAlgorithm>> learningAlgorithmMapping = new TreeMap<String,Class<? extends LearningAlgorithm>>(); + private static Set<String> components; public DLLearnerWS() { knowledgeSourceMapping.put("owlfile", OWLFile.class); @@ -79,6 +83,9 @@ learningProblemMapping.put("posNegDefinition", PosNegDefinitionLP.class); learningProblemMapping.put("posNegInclusion", PosNegInclusionLP.class); learningAlgorithmMapping.put("refinement", ROLearner.class); + components = Helper.union(knowledgeSourceMapping.keySet(),reasonerMapping.keySet()); + components = Helper.union(components, learningProblemMapping.keySet()); + components = Helper.union(components, learningAlgorithmMapping.keySet()); } /** @@ -107,7 +114,6 @@ } // returns the class which is referred to by the string - @SuppressWarnings({"unused"}) private Class<? extends Component> getComponent(String component) throws UnknownComponentException { if(knowledgeSourceMapping.containsKey(component)) return knowledgeSourceMapping.get(component); @@ -125,6 +131,52 @@ // methods for basic component setup // /////////////////////////////////////// + @WebMethod + public String[] getComponents() { + return components.toArray(new String[components.size()]); + } + + @WebMethod + public String[] getKnowledgeSources() { + Set<String> knowledgeSources = knowledgeSourceMapping.keySet(); + return knowledgeSources.toArray(new String[knowledgeSources.size()]); + } + + @WebMethod + public String[] getReasoners() { + Set<String> reasoners = reasonerMapping.keySet(); + return reasoners.toArray(new String[reasoners.size()]); + } + + @WebMethod + public String[] getLearningProblems() { + Set<String> learningProblems = learningProblemMapping.keySet(); + return learningProblems.toArray(new String[learningProblems.size()]); + } + + @WebMethod + public String[] getLearningAlgorithms() { + Set<String> learningAlgorithms = learningAlgorithmMapping.keySet(); + return learningAlgorithms.toArray(new String[learningAlgorithms.size()]); + } + + @WebMethod + public String[] getConfigOptions(String component, boolean allInfo) throws UnknownComponentException { + Class<? extends Component> componentClass = getComponent(component); + List<ConfigOption<?>> options = ComponentManager.getConfigOptions(componentClass); + String[] optionsString = new String[options.size()]; + for(int i=0; i<options.size(); i++) { + ConfigOption<?> option = options.get(i); + optionsString[i] = option.getName(); + if(allInfo) { + optionsString[i] += "#" + option.getDescription(); + optionsString[i] += "#" + option.getAllowedValuesDescription(); + optionsString[i] += "#" + option.getDefaultValue(); + } + } + return optionsString; + } + /** * Adds a knowledge source. * Modified: trunk/src/dl-learner/org/dllearner/utilities/Helper.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/dl-learner/org/dllearner/utilities/Helper.java 2007-10-17 10:33:42 UTC (rev 230) @@ -166,7 +166,7 @@ * @param set2 * @return */ - public static<T> Set<T> unionAlt(Set<T> set1, Set<T> set2) { + public static<T> Set<T> union(Set<T> set1, Set<T> set2) { // TODO: effizientere Implementierung (längere Liste klonen und Elemente // anhängen) Set<T> union = new TreeSet<T>(); Modified: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php 2007-10-16 15:01:23 UTC (rev 229) +++ trunk/src/php-client/testnew.php 2007-10-17 10:33:42 UTC (rev 230) @@ -20,6 +20,27 @@ // test web service $client = new SoapClient("main.wsdl"); +$print_ws_info = false; + +if($print_ws_info) { + $components = $client->getComponents()->item; + + echo '<h1>Web Service Information</h1>'; + + foreach($components as $component) { + echo '<h2>component '.$component.'</h2>'; + + $options = $client->getConfigOptions($component, true)->item; + if(!is_array($options)) + $options = array($options); + + foreach($options as $option) + echo $option.'<br />'; + } +} + +echo '<h1>Algorithm Run</h1>'; + $id = $client->generateID(); $ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2007-10-18 16:03:29
|
Revision: 235 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=235&view=rev Author: sknappe Date: 2007-10-18 09:03:25 -0700 (Thu, 18 Oct 2007) Log Message: ----------- added the DBPedia-Navigator Added Paths: ----------- trunk/src/DBPedia-Navigator/ trunk/src/DBPedia-Navigator/Settings.php trunk/src/DBPedia-Navigator/SparqlConnection.php trunk/src/DBPedia-Navigator/default.css trunk/src/DBPedia-Navigator/index.php trunk/src/DBPedia-Navigator/master.php Added: trunk/src/DBPedia-Navigator/Settings.php =================================================================== --- trunk/src/DBPedia-Navigator/Settings.php (rev 0) +++ trunk/src/DBPedia-Navigator/Settings.php 2007-10-18 16:03:25 UTC (rev 235) @@ -0,0 +1,12 @@ +<?php + +class Settings{ + + +public $wsdluri="http://localhost:8181/services?wsdl"; + + +public $uri="http://localhost/dllearner/"; +public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; +} +?> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/SparqlConnection.php =================================================================== --- trunk/src/DBPedia-Navigator/SparqlConnection.php (rev 0) +++ trunk/src/DBPedia-Navigator/SparqlConnection.php 2007-10-18 16:03:25 UTC (rev 235) @@ -0,0 +1,215 @@ +<?php + +require_once 'pear/HTTP_Request.php'; + +class SparqlConnection +{ + private $DBPediaUrl; + private $DLLearnerUri; + private $client; + private $id; + + public function getID(){ + return $this->id; + } + + function SparqlConnection($DBPediaUrl,$DLLearnerUri,$getID=0) + { + ini_set("soap.wsdl_cache_enabled","0"); + $this->DBPediaUrl=$DBPediaUrl; + $this->DLLearnerUri=$DLLearnerUri; + $this->loadWSDLfiles($DLLearnerUri); + $this->client=new SoapClient("main.wsdl"); + if($getID==0) + { + $this->id=$this->client->generateID(); + } + else + { + $this->id=$getID; + } + } + + function getConceptFromExamples($posExamples,$negExamples) + { + $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $this->client->applyConfigEntryInt($this->id, $ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "instances", array_merge($posExamples,$negExamples)); + $this->client->applyConfigEntryInt($this->id, $ksID, "filterMode", 0); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "classList", array()); + $this->client->applyConfigEntryString($this->id, $ksID, "format", "KB"); + $this->client->applyConfigEntryBoolean($this->id, $ksID, "dumpToFile", false); + + $this->client->setReasoner($this->id, "dig"); + $this->client->setLearningProblem($this->id, "posNegDefinition"); + $this->client->setPositiveExamples($this->id, $posExamples); + $this->client->setNegativeExamples($this->id, $negExamples); + $this->client->setLearningAlgorithm($this->id, "refinement"); + + $start = microtime(true); + + $this->client->init($this->id); + + $learn_start = microtime(true); + $init = $learn_start - $start; + echo 'components initialised in '.$init.' seconds<br />'; + + $threaded=true; + + if($threaded == false) { + + $concept = $this->client->learn($id); + + $learn = microtime(true) - $learn_start; + echo 'concept learned in '.$learn.' seconds<br />'; + + echo 'result: '.$concept; + + } else { + + $this->client->learnThreaded($id); + + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see what we have learned so far + $concept=$this->client->getCurrentlyBestConcept($id); + $running=$this->client->isAlgorithmRunning($id); + + $seconds = $i * $sleeptime; + + echo 'result after '.$seconds.' seconds of sleep: '.$concept.'<br />'; + + $i++; + } while($running); + + echo 'algorithm finished'; + } + return $concept; + } + + function getTriples($individual) + { + $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $this->client->applyConfigEntryInt($this->id, $ksID, "numberOfRecursions", 1); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "instances", array($individual)); + $this->client->applyConfigEntryInt($this->id, $ksID, "filterMode", 3); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "classList", array()); + $this->client->applyConfigEntryString($this->id, $ksID, "format", "Array"); + $this->client->applyConfigEntryBoolean($this->id, $ksID, "dumpToFile", false); + $this->client->applyConfigEntryBoolean($this->id,$ksID,"useLits",true); + + $object=$this->client->getTriples($this->id,$ksID); + $array=$object->item; + $ret=array(); + foreach ($array as $element) + { + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + $ret[]=$items; + } + + return $ret; + } + + function getSubjects($label,$limit) + { + $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $object=$this->client->getSubjects($this->id,$ksID,$label,$limit); + return $object->item; + } + + private function loadWSDLfiles($wsdluri){ + $main=$this->getwsdl($wsdluri); + $other=$this->getOtherWSDL($main); + $newMain=$this->changeWSDL($main); + $this->writeToFile("main.wsdl",$newMain); + $x=0; + foreach ($other as $o){ + $this->writeToFile("def".($x++).".xsd",$this->getwsdl($o)); + } + + } + + private function changeWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $newWSDL=""; + $desca="def"; + $descb=".xsd"; + $x=0; + while($posstart= strpos ( $wsdl, $before )){ + + $posstart+=strlen($before); + $newWSDL.=substr($wsdl,0,$posstart); + $wsdl=substr($wsdl,$posstart); + $newWSDL.=$desca.($x++).$descb; + $posend= strpos ( $wsdl, $after ); + $wsdl=substr($wsdl,$posend); + + } + return $newWSDL.$wsdl; + + } + + private function getOtherWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $ret=array(); + while($posstart= strpos ( $wsdl, $before )){ + $posstart+=strlen($before); + $wsdl=substr($wsdl,$posstart); + $posend= strpos ( $wsdl, $after ); + $tmp=substr($wsdl,0,$posend); + $ret[]=$tmp; + $wsdl=substr($wsdl,$posend+strlen($after)); + } + return $ret; + } + + + + + private function getwsdl($wsdluri){ + // this is copied from the Pear example + // please don't ask me how it works + $req = &new HTTP_Request($wsdluri); + $message=""; + $req->setMethod(HTTP_REQUEST_METHOD_GET); + $req->sendRequest(); + $ret=$req->getResponseBody(); + return $ret; + } + + + + private function writeToFile($filename,$content){ + + $fp=fopen($filename,"w"); + fwrite($fp,$content); + fclose($fp); + + } +} + +$positive=array("http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus", + "http://dbpedia.org/resource/Archytas"); +$negative=array("http://dbpedia.org/resource/Socrates", + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Plato"); + +$sparqlConnection=new SparqlConnection("http://dbpedia.openlinksw.com:8890/sparql","http://localhost:8181/services?wsdl"); +//$sparqlConnection->getConceptFromExamples($positive,$negative); +//$triples=$sparqlConnection->getTriples("http://dbpedia.org/resource/Leipzig"); +//print_r($triples); +//$subjects=$sparqlConnection->getSubjects("Leipzig",5); +//print_r($subjects); +?> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/default.css =================================================================== --- trunk/src/DBPedia-Navigator/default.css (rev 0) +++ trunk/src/DBPedia-Navigator/default.css 2007-10-18 16:03:25 UTC (rev 235) @@ -0,0 +1,453 @@ +/** + * default.css + * main Ontowiki style sheet + * @author: Norman Heino + * @version: $Id: default.css 751 2007-02-14 19:20:17Z nheino $ + */ + +/* remove browser specific margins */ +* { + margin: 0; + padding: 0; +} + +html { + font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; +} + +p { + margin: 8px 0; +} + +h2 { + margin: 0.5em 0 0.1em 0; +/* background-color: #eee;*/ + font-size: 110%; +} + + +/* + * Main site structure + */ + +#wrapper { + position: relative; + max-width: 100%; + padding: 15px; +/* margin: 15px;*/ +} + +#content { + margin: 0 19em; + overflow: hidden; +/* border-left: 1px solid #bbb; + border-right: 1px solid #bbb; + padding: 0 5px;*/ +} + +/* + * Side bars are positioned absolutely due to several reasons: + * (1)Internet Explorer has problems displaying float elements, + * (2) the content's position in html is irrelevant, + * (3) positioning the content div is more straightforward. + */ +#leftSidebar { + position: absolute; + width: 18em; +} + +#rightSidebar { + position: absolute; + width: 18em; + top: 15px; + right: 15px; +} + +#clear { + clear: both; +} + + +/* + * sidebar content (boxes) + */ + +.box { + color: #666; + margin-bottom: 20px; + border: 1px solid #bbb; + font-size: 85%; +} + +/*.box td { + font-size: 100%; +}*/ + +.box .boxtitle { + color: #666; + background-color: #eee; + padding: 3px 0.4em; + font-weight: bold; + white-space: nowrap; +} + +.box .boxtitle .boxtitle_string { + width: 80%; + overflow: hidden; +/* display: none;*/ +} + +.box .boxcontent { + padding: 0.6em; + border-top: 1px solid #bbb; +} + +/* restrict content of certain boxes */ +.box#predicates .boxcontent, +.box#classes .boxcontent { + overflow: hidden; +} + +.box p { + margin: 0 2px 4px 0; +} + +.box ul, .box ol { + margin: 0px; +/* padding-left: 15px;*/ + list-style-position: inside; +} + +.box ul.no_bullet, .box ul.no_bullet { + list-style-type: none; +} + +.box ul li.horizontal, .box ol li.horizontal, +.box ul.horizontal, .box ol.horizontal { + display: inline; +} + +.box a.title_switch { + position: absolute; + right: 0.5em; + margin: auto 0; + color: #666; + border: 1px solid #bbb; + width: 1em; + height: 1em; + background-color: #fff; + text-align: center; +} + +.box a.title_switch:hover { + color: #02a; + text-decoration: none; + background-color: #eee; +} + +.box hr { + margin: 0.5em 0; + border: none; + border-top: 1px dotted #bbb; + height: 0; +} + +.box#classes .boxcontent a { + display: block; +} + +/*.box select { + width: 250px; /* TODO remove absolute size */ +}*/ + +.box input { + width: auto; +} + +.box td input { + width: 100%; +} + +.box img.rating { + position: relative; + top: 1px; +} + +.hidden { + display: none; +} + + +/* + * Links + */ + +a, a:link, a:visited { + color: #02a; + text-decoration: none; + cursor: pointer; +} + +a:hover { + text-decoration: underline; +} + + +/* + * Tabs + */ + +/* all the tabs */ +.tabs { + float: left; + width: 100%; + background: #fff url("../images/tabs_back.png") repeat-x bottom; +} + +.tabs ul { + list-style: none; +} + +.tabs li { + float: left; + margin-right: 1px; +} + +.tabs a { + display: block; + margin-top: 1px; + padding: 0.35em 1.35em; + background-image: url("../images/tab_back.png"); + background-repeat: repeat-x; + background-color: #cbcbcb; + border: 1px solid #bbb; +} + +.tabs a:hover { + background: #fff; + text-decoration: none; +} + +.tabs a.current { + background: #fff; + border-bottom: 1px solid #fff; +} + +/* horizontal line underneath the tabs */ +#tab-line { + height: 1em; + clear: both; +} + +#instances { + float: right; +} + +.selected { + background-color: #bde; /*#b4d5fe;*/ +} + +.button { + border: solid black 1px; + padding: 0px 1px; + background-color: #eee; +} + +/* + * Tables + */ + +tr.odd { + background-color: #ccc; +} + +tr.even { + background-color: #eee; +} + +table.instanceTable th { + text-align: left; +/* background-color: #eee;*/ +} + +table.instanceTable > tbody > tr > td { + padding-top: 0.5em; +} + +table.instanceTable td.property { + text-align: right; + font-style: italic; + padding-right: 5px; +} + +table.instanceTable ul { + margin: 0px; + padding-left: 20px; +} + +table.instanceTable { + width: 100%; +} + +.searchHighlight { + background-color: orange; +} + +table.tripletable { + width: 100%; + font-size: 90%; +} + +.tripletable td { + padding: 0.4em; +} + +table.blind tr td { + padding-top: 0.4em; +} + +/* + * Instances + */ + +.instance .instance { + margin-left: 13px; + background-color: #ddd; +} +.instance .instance td { + font-size: 90%; +} +.instance .instance .instance { + background-color: #eee; +} + +.instance .instance .instance .instance { + background-color: #fff; +} + +#instanceEdit { + border-spacing: 0px; + width: 100%; +} + +#instanceEdit input, #instanceEdit textarea { +/* width: 250px;*/ + background-color: #fff; + font-size: 95%; + font-family: "Lucida Grande", Helvetica, Arial, sans-serif; + padding: 0.1em 0; +} + +#instanceEdit > tbody > tr > td, #instanceEdit > tr > td { + background-color: #eee; + padding: 5px; + border-bottom: 2px solid #fdfdfd; +} + +/* + * Calendar + */ + +table.calendar { + margin-top: 1em; + width: 100%; + height: 730px; + table-layout: fixed; + font-size: 90%; +} + +.calendar .weekday0 { + background-color: #eee; + padding: 0.4em; +} +.calendar .weekday1 { + background-color: #f5f5f5; + padding: 0.4em; +} +.calendar .weekend0 { + background-color: #ddd; + padding: 0.4em; +} +.calendar .weekend1 { + background-color: #eaeaea; + padding: 0.4em; +} + +#map { + margin-top: 0.5em; + width: 100%; + height: 750px; + font-size: 90%; +} + +#map .instance td { + font-size: 80%; + padding: 0 3px; + border-bottom: 5px solid white; +} + +#superClassPath { + margin-bottom: 0.5em; +} + +img { + border: none; +} + +span.submit { + float: right; + padding-right: 100px; +} + +/* + * Autosuggest box + */ +div.autosuggest { + font-size: 85%; + position: absolute; + background-color: #fff; + border: 1px solid #bbb; +} + +div.autosuggest ul { + list-style-type: none; + list-style-position: inside; + padding-left: 0px; +} + +div.autosuggest ul li.selected { + background-color: #bde; +} + +div.autosuggest ul li { + display: block; + padding: 0.2em; +/* height: 22px;*/ + cursor: pointer; +} + +span.formal { + display: none; +} + +/* + * Layer + */ +#layer { + width: 100%; + height: 100%; + position: absolute; + background-image: url("../images/black_50.png"); + background-repeat: repeat; + z-index: 98; +} + +#layerContent { + margin-top: 100px; + margin: auto; + width: 500px; + height: 300px; + background-color: #ffb; + border: 2px solid #bbb; + z-index: 99; +} Added: trunk/src/DBPedia-Navigator/index.php =================================================================== --- trunk/src/DBPedia-Navigator/index.php (rev 0) +++ trunk/src/DBPedia-Navigator/index.php 2007-10-18 16:03:25 UTC (rev 235) @@ -0,0 +1,110 @@ +<?php + +@session_start(); +include_once("Settings.php"); +include_once("SparqlConnection.php"); + + ini_set('error_reporting',E_ALL); + ini_set('max_execution_time',200); + +$lastAction="View"; +$content=""; +$possibleActions=""; +$instances=" "; +$left=""; +$right=""; +$middle=""; +$search=""; +$system=""; + +$settings=new Settings(); + +echo "<a href='index.php?clearsession=clear'>start from scratch</a>"; +if(isset($_GET['clearsession']))$_SESSION['State_ID'] =false; + + + +if( (!isset($_SESSION['State_ID'] ) ) || ($_SESSION['State_ID']=="")) +{ + //get new ID + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + $_SESSION['State_ID']=$sc->getID(); + +} + +else{ + //echo "Current ID is: ".$_SESSION['Learner_ID']."<br>"; + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['State_ID']); +} + + +//SearchBox + $search="<form action=\"index.php\" method=\"GET\">\n". + "<table border=\"0\">\n". + "<tr><tb>Search:<br/></tb></tr>\n". + "<tr><tb><input type=\"textfield\" name=\"search\"><select name=\"limit\" size=\"1\">\n". + "<option>1</option>\n". + "<option selected=\"selected\">5</option>\n". + "<option>10</option>\n". + "<option>15</option>\n". + "</select><br/></tb></tr>\n". + "<tr><tb><input type=\"submit\" name=\"action\" value=\"Search\"><input type=\"submit\" name=\"action\" value=\"Fulltext\"></tb></tr>\n". + "</table>\n". + "</form>\n"; + +//Get Search result + if (@$_GET['action']=='Search') + { + $label=$_GET['search']; + $limit=$_GET['limit']; + $subjects=$sc->getSubjects($label,$limit); + foreach ($subjects as $subject){ + $content.="<a href=\"index.php?action=showPage&subject=".$subject."\">".$subject."</a><br/>\n"; + } + } + +//Show Subject Page + if (@$_GET['action']=="showPage") + { + $triples=$sc->getTriples($_GET['subject']); + foreach ($triples as $triple){ + $content.="Subject: ".urldecode($triple[0])."<br/>Predicate: ".urldecode($triple[1])."<br/>Object: ".urldecode($triple[2])."<br/><br/>\n"; + } + } + + + include("master.php"); + + echo $masterContent; + + + + + + function makeBox($title,$content,$toggleBoxContent=true) + { + if($toggleBoxContent) + { + $click="<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a>"; + } + else{$click="";} + $ret=" + <div class=\"box\" id=\"ontology\"> + <div class=\"boxtitle\">".$title.$click."</div> + <div class=\"boxcontent\"> + ".$content." + </div> <!-- boxcontent --> + </div> <!-- box -->"; + return $ret; + } + + + function shorten($a) + { + if(($strpos=strpos($a,'#'))>=4){ + return substr($a,$strpos); + } + else {return $a;} + } + +?> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/master.php =================================================================== --- trunk/src/DBPedia-Navigator/master.php (rev 0) +++ trunk/src/DBPedia-Navigator/master.php 2007-10-18 16:03:25 UTC (rev 235) @@ -0,0 +1,57 @@ +<?php + +$masterContent=" + + +<html> + <head> + <title>DL Learner</title> + <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\"/> + <link rel=\"stylesheet\" href=\"default.css\"/> + </head> + <body> +<script type=\"text/javascript\" src=\"jscript/wz_tooltip.js\"></script> +<script type=\"text/javascript\" src=\"jscript/scripts.js\"></script> +<h3>DBPedia-Navigator-Test</h3> +<div id=\"layer\" style=\"display:none\"><div id=\"layerContent\" style=\"display:none\"></div></div> +<div id=\"wrapper\"> + +<div id=\"leftSidebar\"> + +<div class=\"box\" id=\"search\"> + <div class=\"boxtitle\">Search<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a></div> + <div class=\"boxcontent\"> + ".$search." + </div> <!-- boxcontent --> + +</div> <!-- box --> + +".$left." + +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</div><!-- END leftSidebar --> + +<div id=\"content\"> +<div class=\"box\" id=\"search\"> + <div class=\"boxtitle\">Content</div> + <div class=\"boxcontent\"> + ".$content." + </div> <!-- boxcontent --> +</div> <!-- box --> +".$middle." +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</div><!-- content --> + +<div id=\"rightSidebar\"> + +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</div><!-- rightSidebar --> + + <div id=\"clear\"></div> +</div><!-- wrapper --> + + </body> +</html> +"; + +?> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2007-10-18 17:27:02
|
Revision: 240 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=240&view=rev Author: jenslehmann Date: 2007-10-18 10:26:55 -0700 (Thu, 18 Oct 2007) Log Message: ----------- changed directory name to small letters Added Paths: ----------- trunk/src/dbpedia-navigator/ trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/SparqlConnection.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/master.php trunk/src/dbpedia-navigator/pear/ Removed Paths: ------------- trunk/src/DBPedia-Navigator/ trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/SparqlConnection.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dbpedia-navigator/master.php trunk/src/dbpedia-navigator/pear/ Copied: trunk/src/dbpedia-navigator (from rev 237, trunk/src/DBPedia-Navigator) Deleted: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/DBPedia-Navigator/Settings.php 2007-10-18 16:24:22 UTC (rev 237) +++ trunk/src/dbpedia-navigator/Settings.php 2007-10-18 17:26:55 UTC (rev 240) @@ -1,12 +0,0 @@ -<?php - -class Settings{ - - -public $wsdluri="http://localhost:8181/services?wsdl"; - - -public $uri="http://localhost/dllearner/"; -public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; -} -?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/Settings.php (from rev 236, trunk/src/DBPedia-Navigator/Settings.php) =================================================================== --- trunk/src/dbpedia-navigator/Settings.php (rev 0) +++ trunk/src/dbpedia-navigator/Settings.php 2007-10-18 17:26:55 UTC (rev 240) @@ -0,0 +1,12 @@ +<?php + +class Settings{ + + +public $wsdluri="http://localhost:8181/services?wsdl"; + + +public $uri="http://localhost/dllearner/"; +public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; +} +?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/SparqlConnection.php =================================================================== --- trunk/src/DBPedia-Navigator/SparqlConnection.php 2007-10-18 16:24:22 UTC (rev 237) +++ trunk/src/dbpedia-navigator/SparqlConnection.php 2007-10-18 17:26:55 UTC (rev 240) @@ -1,215 +0,0 @@ -<?php - -require_once 'pear/HTTP_Request.php'; - -class SparqlConnection -{ - private $DBPediaUrl; - private $DLLearnerUri; - private $client; - private $id; - - public function getID(){ - return $this->id; - } - - function SparqlConnection($DBPediaUrl,$DLLearnerUri,$getID=0) - { - ini_set("soap.wsdl_cache_enabled","0"); - $this->DBPediaUrl=$DBPediaUrl; - $this->DLLearnerUri=$DLLearnerUri; - $this->loadWSDLfiles($DLLearnerUri); - $this->client=new SoapClient("main.wsdl"); - if($getID==0) - { - $this->id=$this->client->generateID(); - } - else - { - $this->id=$getID; - } - } - - function getConceptFromExamples($posExamples,$negExamples) - { - $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); - $this->client->applyConfigEntryInt($this->id, $ksID, "numberOfRecursions", 2); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($this->id, $ksID, "filterMode", 0); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "classList", array()); - $this->client->applyConfigEntryString($this->id, $ksID, "format", "KB"); - $this->client->applyConfigEntryBoolean($this->id, $ksID, "dumpToFile", false); - - $this->client->setReasoner($this->id, "dig"); - $this->client->setLearningProblem($this->id, "posNegDefinition"); - $this->client->setPositiveExamples($this->id, $posExamples); - $this->client->setNegativeExamples($this->id, $negExamples); - $this->client->setLearningAlgorithm($this->id, "refinement"); - - $start = microtime(true); - - $this->client->init($this->id); - - $learn_start = microtime(true); - $init = $learn_start - $start; - echo 'components initialised in '.$init.' seconds<br />'; - - $threaded=true; - - if($threaded == false) { - - $concept = $this->client->learn($id); - - $learn = microtime(true) - $learn_start; - echo 'concept learned in '.$learn.' seconds<br />'; - - echo 'result: '.$concept; - - } else { - - $this->client->learnThreaded($id); - - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see what we have learned so far - $concept=$this->client->getCurrentlyBestConcept($id); - $running=$this->client->isAlgorithmRunning($id); - - $seconds = $i * $sleeptime; - - echo 'result after '.$seconds.' seconds of sleep: '.$concept.'<br />'; - - $i++; - } while($running); - - echo 'algorithm finished'; - } - return $concept; - } - - function getTriples($individual) - { - $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); - $this->client->applyConfigEntryInt($this->id, $ksID, "numberOfRecursions", 1); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "instances", array($individual)); - $this->client->applyConfigEntryInt($this->id, $ksID, "filterMode", 3); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($this->id, $ksID, "classList", array()); - $this->client->applyConfigEntryString($this->id, $ksID, "format", "Array"); - $this->client->applyConfigEntryBoolean($this->id, $ksID, "dumpToFile", false); - $this->client->applyConfigEntryBoolean($this->id,$ksID,"useLits",true); - - $object=$this->client->getTriples($this->id,$ksID); - $array=$object->item; - $ret=array(); - foreach ($array as $element) - { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[]=$items; - } - - return $ret; - } - - function getSubjects($label,$limit) - { - $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); - $object=$this->client->getSubjects($this->id,$ksID,$label,$limit); - return $object->item; - } - - private function loadWSDLfiles($wsdluri){ - $main=$this->getwsdl($wsdluri); - $other=$this->getOtherWSDL($main); - $newMain=$this->changeWSDL($main); - $this->writeToFile("main.wsdl",$newMain); - $x=0; - foreach ($other as $o){ - $this->writeToFile("def".($x++).".xsd",$this->getwsdl($o)); - } - - } - - private function changeWSDL($wsdl){ - $before="<xsd:import schemaLocation=\""; - $after="\" namespace=\""; - $newWSDL=""; - $desca="def"; - $descb=".xsd"; - $x=0; - while($posstart= strpos ( $wsdl, $before )){ - - $posstart+=strlen($before); - $newWSDL.=substr($wsdl,0,$posstart); - $wsdl=substr($wsdl,$posstart); - $newWSDL.=$desca.($x++).$descb; - $posend= strpos ( $wsdl, $after ); - $wsdl=substr($wsdl,$posend); - - } - return $newWSDL.$wsdl; - - } - - private function getOtherWSDL($wsdl){ - $before="<xsd:import schemaLocation=\""; - $after="\" namespace=\""; - $ret=array(); - while($posstart= strpos ( $wsdl, $before )){ - $posstart+=strlen($before); - $wsdl=substr($wsdl,$posstart); - $posend= strpos ( $wsdl, $after ); - $tmp=substr($wsdl,0,$posend); - $ret[]=$tmp; - $wsdl=substr($wsdl,$posend+strlen($after)); - } - return $ret; - } - - - - - private function getwsdl($wsdluri){ - // this is copied from the Pear example - // please don't ask me how it works - $req = &new HTTP_Request($wsdluri); - $message=""; - $req->setMethod(HTTP_REQUEST_METHOD_GET); - $req->sendRequest(); - $ret=$req->getResponseBody(); - return $ret; - } - - - - private function writeToFile($filename,$content){ - - $fp=fopen($filename,"w"); - fwrite($fp,$content); - fclose($fp); - - } -} - -$positive=array("http://dbpedia.org/resource/Pythagoras", - "http://dbpedia.org/resource/Philolaus", - "http://dbpedia.org/resource/Archytas"); -$negative=array("http://dbpedia.org/resource/Socrates", - "http://dbpedia.org/resource/Zeno_of_Elea", - "http://dbpedia.org/resource/Plato"); - -$sparqlConnection=new SparqlConnection("http://dbpedia.openlinksw.com:8890/sparql","http://localhost:8181/services?wsdl"); -//$sparqlConnection->getConceptFromExamples($positive,$negative); -//$triples=$sparqlConnection->getTriples("http://dbpedia.org/resource/Leipzig"); -//print_r($triples); -//$subjects=$sparqlConnection->getSubjects("Leipzig",5); -//print_r($subjects); -?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/SparqlConnection.php (from rev 236, trunk/src/DBPedia-Navigator/SparqlConnection.php) =================================================================== --- trunk/src/dbpedia-navigator/SparqlConnection.php (rev 0) +++ trunk/src/dbpedia-navigator/SparqlConnection.php 2007-10-18 17:26:55 UTC (rev 240) @@ -0,0 +1,215 @@ +<?php + +require_once 'pear/HTTP_Request.php'; + +class SparqlConnection +{ + private $DBPediaUrl; + private $DLLearnerUri; + private $client; + private $id; + + public function getID(){ + return $this->id; + } + + function SparqlConnection($DBPediaUrl,$DLLearnerUri,$getID=0) + { + ini_set("soap.wsdl_cache_enabled","0"); + $this->DBPediaUrl=$DBPediaUrl; + $this->DLLearnerUri=$DLLearnerUri; + $this->loadWSDLfiles($DLLearnerUri); + $this->client=new SoapClient("main.wsdl"); + if($getID==0) + { + $this->id=$this->client->generateID(); + } + else + { + $this->id=$getID; + } + } + + function getConceptFromExamples($posExamples,$negExamples) + { + $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $this->client->applyConfigEntryInt($this->id, $ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "instances", array_merge($posExamples,$negExamples)); + $this->client->applyConfigEntryInt($this->id, $ksID, "filterMode", 0); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "classList", array()); + $this->client->applyConfigEntryString($this->id, $ksID, "format", "KB"); + $this->client->applyConfigEntryBoolean($this->id, $ksID, "dumpToFile", false); + + $this->client->setReasoner($this->id, "dig"); + $this->client->setLearningProblem($this->id, "posNegDefinition"); + $this->client->setPositiveExamples($this->id, $posExamples); + $this->client->setNegativeExamples($this->id, $negExamples); + $this->client->setLearningAlgorithm($this->id, "refinement"); + + $start = microtime(true); + + $this->client->init($this->id); + + $learn_start = microtime(true); + $init = $learn_start - $start; + echo 'components initialised in '.$init.' seconds<br />'; + + $threaded=true; + + if($threaded == false) { + + $concept = $this->client->learn($id); + + $learn = microtime(true) - $learn_start; + echo 'concept learned in '.$learn.' seconds<br />'; + + echo 'result: '.$concept; + + } else { + + $this->client->learnThreaded($id); + + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see what we have learned so far + $concept=$this->client->getCurrentlyBestConcept($id); + $running=$this->client->isAlgorithmRunning($id); + + $seconds = $i * $sleeptime; + + echo 'result after '.$seconds.' seconds of sleep: '.$concept.'<br />'; + + $i++; + } while($running); + + echo 'algorithm finished'; + } + return $concept; + } + + function getTriples($individual) + { + $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $this->client->applyConfigEntryInt($this->id, $ksID, "numberOfRecursions", 1); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "instances", array($individual)); + $this->client->applyConfigEntryInt($this->id, $ksID, "filterMode", 3); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($this->id, $ksID, "classList", array()); + $this->client->applyConfigEntryString($this->id, $ksID, "format", "Array"); + $this->client->applyConfigEntryBoolean($this->id, $ksID, "dumpToFile", false); + $this->client->applyConfigEntryBoolean($this->id,$ksID,"useLits",true); + + $object=$this->client->getTriples($this->id,$ksID); + $array=$object->item; + $ret=array(); + foreach ($array as $element) + { + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + $ret[]=$items; + } + + return $ret; + } + + function getSubjects($label,$limit) + { + $ksID = $this->client->addKnowledgeSource($this->id, "sparql", $this->DBPediaUrl); + $object=$this->client->getSubjects($this->id,$ksID,$label,$limit); + return $object->item; + } + + private function loadWSDLfiles($wsdluri){ + $main=$this->getwsdl($wsdluri); + $other=$this->getOtherWSDL($main); + $newMain=$this->changeWSDL($main); + $this->writeToFile("main.wsdl",$newMain); + $x=0; + foreach ($other as $o){ + $this->writeToFile("def".($x++).".xsd",$this->getwsdl($o)); + } + + } + + private function changeWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $newWSDL=""; + $desca="def"; + $descb=".xsd"; + $x=0; + while($posstart= strpos ( $wsdl, $before )){ + + $posstart+=strlen($before); + $newWSDL.=substr($wsdl,0,$posstart); + $wsdl=substr($wsdl,$posstart); + $newWSDL.=$desca.($x++).$descb; + $posend= strpos ( $wsdl, $after ); + $wsdl=substr($wsdl,$posend); + + } + return $newWSDL.$wsdl; + + } + + private function getOtherWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $ret=array(); + while($posstart= strpos ( $wsdl, $before )){ + $posstart+=strlen($before); + $wsdl=substr($wsdl,$posstart); + $posend= strpos ( $wsdl, $after ); + $tmp=substr($wsdl,0,$posend); + $ret[]=$tmp; + $wsdl=substr($wsdl,$posend+strlen($after)); + } + return $ret; + } + + + + + private function getwsdl($wsdluri){ + // this is copied from the Pear example + // please don't ask me how it works + $req = &new HTTP_Request($wsdluri); + $message=""; + $req->setMethod(HTTP_REQUEST_METHOD_GET); + $req->sendRequest(); + $ret=$req->getResponseBody(); + return $ret; + } + + + + private function writeToFile($filename,$content){ + + $fp=fopen($filename,"w"); + fwrite($fp,$content); + fclose($fp); + + } +} + +$positive=array("http://dbpedia.org/resource/Pythagoras", + "http://dbpedia.org/resource/Philolaus", + "http://dbpedia.org/resource/Archytas"); +$negative=array("http://dbpedia.org/resource/Socrates", + "http://dbpedia.org/resource/Zeno_of_Elea", + "http://dbpedia.org/resource/Plato"); + +$sparqlConnection=new SparqlConnection("http://dbpedia.openlinksw.com:8890/sparql","http://localhost:8181/services?wsdl"); +//$sparqlConnection->getConceptFromExamples($positive,$negative); +//$triples=$sparqlConnection->getTriples("http://dbpedia.org/resource/Leipzig"); +//print_r($triples); +//$subjects=$sparqlConnection->getSubjects("Leipzig",5); +//print_r($subjects); +?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/DBPedia-Navigator/default.css 2007-10-18 16:24:22 UTC (rev 237) +++ trunk/src/dbpedia-navigator/default.css 2007-10-18 17:26:55 UTC (rev 240) @@ -1,453 +0,0 @@ -/** - * default.css - * main Ontowiki style sheet - * @author: Norman Heino - * @version: $Id: default.css 751 2007-02-14 19:20:17Z nheino $ - */ - -/* remove browser specific margins */ -* { - margin: 0; - padding: 0; -} - -html { - font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; -} - -p { - margin: 8px 0; -} - -h2 { - margin: 0.5em 0 0.1em 0; -/* background-color: #eee;*/ - font-size: 110%; -} - - -/* - * Main site structure - */ - -#wrapper { - position: relative; - max-width: 100%; - padding: 15px; -/* margin: 15px;*/ -} - -#content { - margin: 0 19em; - overflow: hidden; -/* border-left: 1px solid #bbb; - border-right: 1px solid #bbb; - padding: 0 5px;*/ -} - -/* - * Side bars are positioned absolutely due to several reasons: - * (1)Internet Explorer has problems displaying float elements, - * (2) the content's position in html is irrelevant, - * (3) positioning the content div is more straightforward. - */ -#leftSidebar { - position: absolute; - width: 18em; -} - -#rightSidebar { - position: absolute; - width: 18em; - top: 15px; - right: 15px; -} - -#clear { - clear: both; -} - - -/* - * sidebar content (boxes) - */ - -.box { - color: #666; - margin-bottom: 20px; - border: 1px solid #bbb; - font-size: 85%; -} - -/*.box td { - font-size: 100%; -}*/ - -.box .boxtitle { - color: #666; - background-color: #eee; - padding: 3px 0.4em; - font-weight: bold; - white-space: nowrap; -} - -.box .boxtitle .boxtitle_string { - width: 80%; - overflow: hidden; -/* display: none;*/ -} - -.box .boxcontent { - padding: 0.6em; - border-top: 1px solid #bbb; -} - -/* restrict content of certain boxes */ -.box#predicates .boxcontent, -.box#classes .boxcontent { - overflow: hidden; -} - -.box p { - margin: 0 2px 4px 0; -} - -.box ul, .box ol { - margin: 0px; -/* padding-left: 15px;*/ - list-style-position: inside; -} - -.box ul.no_bullet, .box ul.no_bullet { - list-style-type: none; -} - -.box ul li.horizontal, .box ol li.horizontal, -.box ul.horizontal, .box ol.horizontal { - display: inline; -} - -.box a.title_switch { - position: absolute; - right: 0.5em; - margin: auto 0; - color: #666; - border: 1px solid #bbb; - width: 1em; - height: 1em; - background-color: #fff; - text-align: center; -} - -.box a.title_switch:hover { - color: #02a; - text-decoration: none; - background-color: #eee; -} - -.box hr { - margin: 0.5em 0; - border: none; - border-top: 1px dotted #bbb; - height: 0; -} - -.box#classes .boxcontent a { - display: block; -} - -/*.box select { - width: 250px; /* TODO remove absolute size */ -}*/ - -.box input { - width: auto; -} - -.box td input { - width: 100%; -} - -.box img.rating { - position: relative; - top: 1px; -} - -.hidden { - display: none; -} - - -/* - * Links - */ - -a, a:link, a:visited { - color: #02a; - text-decoration: none; - cursor: pointer; -} - -a:hover { - text-decoration: underline; -} - - -/* - * Tabs - */ - -/* all the tabs */ -.tabs { - float: left; - width: 100%; - background: #fff url("../images/tabs_back.png") repeat-x bottom; -} - -.tabs ul { - list-style: none; -} - -.tabs li { - float: left; - margin-right: 1px; -} - -.tabs a { - display: block; - margin-top: 1px; - padding: 0.35em 1.35em; - background-image: url("../images/tab_back.png"); - background-repeat: repeat-x; - background-color: #cbcbcb; - border: 1px solid #bbb; -} - -.tabs a:hover { - background: #fff; - text-decoration: none; -} - -.tabs a.current { - background: #fff; - border-bottom: 1px solid #fff; -} - -/* horizontal line underneath the tabs */ -#tab-line { - height: 1em; - clear: both; -} - -#instances { - float: right; -} - -.selected { - background-color: #bde; /*#b4d5fe;*/ -} - -.button { - border: solid black 1px; - padding: 0px 1px; - background-color: #eee; -} - -/* - * Tables - */ - -tr.odd { - background-color: #ccc; -} - -tr.even { - background-color: #eee; -} - -table.instanceTable th { - text-align: left; -/* background-color: #eee;*/ -} - -table.instanceTable > tbody > tr > td { - padding-top: 0.5em; -} - -table.instanceTable td.property { - text-align: right; - font-style: italic; - padding-right: 5px; -} - -table.instanceTable ul { - margin: 0px; - padding-left: 20px; -} - -table.instanceTable { - width: 100%; -} - -.searchHighlight { - background-color: orange; -} - -table.tripletable { - width: 100%; - font-size: 90%; -} - -.tripletable td { - padding: 0.4em; -} - -table.blind tr td { - padding-top: 0.4em; -} - -/* - * Instances - */ - -.instance .instance { - margin-left: 13px; - background-color: #ddd; -} -.instance .instance td { - font-size: 90%; -} -.instance .instance .instance { - background-color: #eee; -} - -.instance .instance .instance .instance { - background-color: #fff; -} - -#instanceEdit { - border-spacing: 0px; - width: 100%; -} - -#instanceEdit input, #instanceEdit textarea { -/* width: 250px;*/ - background-color: #fff; - font-size: 95%; - font-family: "Lucida Grande", Helvetica, Arial, sans-serif; - padding: 0.1em 0; -} - -#instanceEdit > tbody > tr > td, #instanceEdit > tr > td { - background-color: #eee; - padding: 5px; - border-bottom: 2px solid #fdfdfd; -} - -/* - * Calendar - */ - -table.calendar { - margin-top: 1em; - width: 100%; - height: 730px; - table-layout: fixed; - font-size: 90%; -} - -.calendar .weekday0 { - background-color: #eee; - padding: 0.4em; -} -.calendar .weekday1 { - background-color: #f5f5f5; - padding: 0.4em; -} -.calendar .weekend0 { - background-color: #ddd; - padding: 0.4em; -} -.calendar .weekend1 { - background-color: #eaeaea; - padding: 0.4em; -} - -#map { - margin-top: 0.5em; - width: 100%; - height: 750px; - font-size: 90%; -} - -#map .instance td { - font-size: 80%; - padding: 0 3px; - border-bottom: 5px solid white; -} - -#superClassPath { - margin-bottom: 0.5em; -} - -img { - border: none; -} - -span.submit { - float: right; - padding-right: 100px; -} - -/* - * Autosuggest box - */ -div.autosuggest { - font-size: 85%; - position: absolute; - background-color: #fff; - border: 1px solid #bbb; -} - -div.autosuggest ul { - list-style-type: none; - list-style-position: inside; - padding-left: 0px; -} - -div.autosuggest ul li.selected { - background-color: #bde; -} - -div.autosuggest ul li { - display: block; - padding: 0.2em; -/* height: 22px;*/ - cursor: pointer; -} - -span.formal { - display: none; -} - -/* - * Layer - */ -#layer { - width: 100%; - height: 100%; - position: absolute; - background-image: url("../images/black_50.png"); - background-repeat: repeat; - z-index: 98; -} - -#layerContent { - margin-top: 100px; - margin: auto; - width: 500px; - height: 300px; - background-color: #ffb; - border: 2px solid #bbb; - z-index: 99; -} Copied: trunk/src/dbpedia-navigator/default.css (from rev 236, trunk/src/DBPedia-Navigator/default.css) =================================================================== --- trunk/src/dbpedia-navigator/default.css (rev 0) +++ trunk/src/dbpedia-navigator/default.css 2007-10-18 17:26:55 UTC (rev 240) @@ -0,0 +1,453 @@ +/** + * default.css + * main Ontowiki style sheet + * @author: Norman Heino + * @version: $Id: default.css 751 2007-02-14 19:20:17Z nheino $ + */ + +/* remove browser specific margins */ +* { + margin: 0; + padding: 0; +} + +html { + font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; +} + +p { + margin: 8px 0; +} + +h2 { + margin: 0.5em 0 0.1em 0; +/* background-color: #eee;*/ + font-size: 110%; +} + + +/* + * Main site structure + */ + +#wrapper { + position: relative; + max-width: 100%; + padding: 15px; +/* margin: 15px;*/ +} + +#content { + margin: 0 19em; + overflow: hidden; +/* border-left: 1px solid #bbb; + border-right: 1px solid #bbb; + padding: 0 5px;*/ +} + +/* + * Side bars are positioned absolutely due to several reasons: + * (1)Internet Explorer has problems displaying float elements, + * (2) the content's position in html is irrelevant, + * (3) positioning the content div is more straightforward. + */ +#leftSidebar { + position: absolute; + width: 18em; +} + +#rightSidebar { + position: absolute; + width: 18em; + top: 15px; + right: 15px; +} + +#clear { + clear: both; +} + + +/* + * sidebar content (boxes) + */ + +.box { + color: #666; + margin-bottom: 20px; + border: 1px solid #bbb; + font-size: 85%; +} + +/*.box td { + font-size: 100%; +}*/ + +.box .boxtitle { + color: #666; + background-color: #eee; + padding: 3px 0.4em; + font-weight: bold; + white-space: nowrap; +} + +.box .boxtitle .boxtitle_string { + width: 80%; + overflow: hidden; +/* display: none;*/ +} + +.box .boxcontent { + padding: 0.6em; + border-top: 1px solid #bbb; +} + +/* restrict content of certain boxes */ +.box#predicates .boxcontent, +.box#classes .boxcontent { + overflow: hidden; +} + +.box p { + margin: 0 2px 4px 0; +} + +.box ul, .box ol { + margin: 0px; +/* padding-left: 15px;*/ + list-style-position: inside; +} + +.box ul.no_bullet, .box ul.no_bullet { + list-style-type: none; +} + +.box ul li.horizontal, .box ol li.horizontal, +.box ul.horizontal, .box ol.horizontal { + display: inline; +} + +.box a.title_switch { + position: absolute; + right: 0.5em; + margin: auto 0; + color: #666; + border: 1px solid #bbb; + width: 1em; + height: 1em; + background-color: #fff; + text-align: center; +} + +.box a.title_switch:hover { + color: #02a; + text-decoration: none; + background-color: #eee; +} + +.box hr { + margin: 0.5em 0; + border: none; + border-top: 1px dotted #bbb; + height: 0; +} + +.box#classes .boxcontent a { + display: block; +} + +/*.box select { + width: 250px; /* TODO remove absolute size */ +}*/ + +.box input { + width: auto; +} + +.box td input { + width: 100%; +} + +.box img.rating { + position: relative; + top: 1px; +} + +.hidden { + display: none; +} + + +/* + * Links + */ + +a, a:link, a:visited { + color: #02a; + text-decoration: none; + cursor: pointer; +} + +a:hover { + text-decoration: underline; +} + + +/* + * Tabs + */ + +/* all the tabs */ +.tabs { + float: left; + width: 100%; + background: #fff url("../images/tabs_back.png") repeat-x bottom; +} + +.tabs ul { + list-style: none; +} + +.tabs li { + float: left; + margin-right: 1px; +} + +.tabs a { + display: block; + margin-top: 1px; + padding: 0.35em 1.35em; + background-image: url("../images/tab_back.png"); + background-repeat: repeat-x; + background-color: #cbcbcb; + border: 1px solid #bbb; +} + +.tabs a:hover { + background: #fff; + text-decoration: none; +} + +.tabs a.current { + background: #fff; + border-bottom: 1px solid #fff; +} + +/* horizontal line underneath the tabs */ +#tab-line { + height: 1em; + clear: both; +} + +#instances { + float: right; +} + +.selected { + background-color: #bde; /*#b4d5fe;*/ +} + +.button { + border: solid black 1px; + padding: 0px 1px; + background-color: #eee; +} + +/* + * Tables + */ + +tr.odd { + background-color: #ccc; +} + +tr.even { + background-color: #eee; +} + +table.instanceTable th { + text-align: left; +/* background-color: #eee;*/ +} + +table.instanceTable > tbody > tr > td { + padding-top: 0.5em; +} + +table.instanceTable td.property { + text-align: right; + font-style: italic; + padding-right: 5px; +} + +table.instanceTable ul { + margin: 0px; + padding-left: 20px; +} + +table.instanceTable { + width: 100%; +} + +.searchHighlight { + background-color: orange; +} + +table.tripletable { + width: 100%; + font-size: 90%; +} + +.tripletable td { + padding: 0.4em; +} + +table.blind tr td { + padding-top: 0.4em; +} + +/* + * Instances + */ + +.instance .instance { + margin-left: 13px; + background-color: #ddd; +} +.instance .instance td { + font-size: 90%; +} +.instance .instance .instance { + background-color: #eee; +} + +.instance .instance .instance .instance { + background-color: #fff; +} + +#instanceEdit { + border-spacing: 0px; + width: 100%; +} + +#instanceEdit input, #instanceEdit textarea { +/* width: 250px;*/ + background-color: #fff; + font-size: 95%; + font-family: "Lucida Grande", Helvetica, Arial, sans-serif; + padding: 0.1em 0; +} + +#instanceEdit > tbody > tr > td, #instanceEdit > tr > td { + background-color: #eee; + padding: 5px; + border-bottom: 2px solid #fdfdfd; +} + +/* + * Calendar + */ + +table.calendar { + margin-top: 1em; + width: 100%; + height: 730px; + table-layout: fixed; + font-size: 90%; +} + +.calendar .weekday0 { + background-color: #eee; + padding: 0.4em; +} +.calendar .weekday1 { + background-color: #f5f5f5; + padding: 0.4em; +} +.calendar .weekend0 { + background-color: #ddd; + padding: 0.4em; +} +.calendar .weekend1 { + background-color: #eaeaea; + padding: 0.4em; +} + +#map { + margin-top: 0.5em; + width: 100%; + height: 750px; + font-size: 90%; +} + +#map .instance td { + font-size: 80%; + padding: 0 3px; + border-bottom: 5px solid white; +} + +#superClassPath { + margin-bottom: 0.5em; +} + +img { + border: none; +} + +span.submit { + float: right; + padding-right: 100px; +} + +/* + * Autosuggest box + */ +div.autosuggest { + font-size: 85%; + position: absolute; + background-color: #fff; + border: 1px solid #bbb; +} + +div.autosuggest ul { + list-style-type: none; + list-style-position: inside; + padding-left: 0px; +} + +div.autosuggest ul li.selected { + background-color: #bde; +} + +div.autosuggest ul li { + display: block; + padding: 0.2em; +/* height: 22px;*/ + cursor: pointer; +} + +span.formal { + display: none; +} + +/* + * Layer + */ +#layer { + width: 100%; + height: 100%; + position: absolute; + background-image: url("../images/black_50.png"); + background-repeat: repeat; + z-index: 98; +} + +#layerContent { + margin-top: 100px; + margin: auto; + width: 500px; + height: 300px; + background-color: #ffb; + border: 2px solid #bbb; + z-index: 99; +} Deleted: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/DBPedia-Navigator/index.php 2007-10-18 16:24:22 UTC (rev 237) +++ trunk/src/dbpedia-navigator/index.php 2007-10-18 17:26:55 UTC (rev 240) @@ -1,110 +0,0 @@ -<?php - -@session_start(); -include_once("Settings.php"); -include_once("SparqlConnection.php"); - - ini_set('error_reporting',E_ALL); - ini_set('max_execution_time',200); - -$lastAction="View"; -$content=""; -$possibleActions=""; -$instances=" "; -$left=""; -$right=""; -$middle=""; -$search=""; -$system=""; - -$settings=new Settings(); - -echo "<a href='index.php?clearsession=clear'>start from scratch</a>"; -if(isset($_GET['clearsession']))$_SESSION['State_ID'] =false; - - - -if( (!isset($_SESSION['State_ID'] ) ) || ($_SESSION['State_ID']=="")) -{ - //get new ID - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); - $_SESSION['State_ID']=$sc->getID(); - -} - -else{ - //echo "Current ID is: ".$_SESSION['Learner_ID']."<br>"; - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['State_ID']); -} - - -//SearchBox - $search="<form action=\"index.php\" method=\"GET\">\n". - "<table border=\"0\">\n". - "<tr><tb>Search:<br/></tb></tr>\n". - "<tr><tb><input type=\"textfield\" name=\"search\"><select name=\"limit\" size=\"1\">\n". - "<option>1</option>\n". - "<option selected=\"selected\">5</option>\n". - "<option>10</option>\n". - "<option>15</option>\n". - "</select><br/></tb></tr>\n". - "<tr><tb><input type=\"submit\" name=\"action\" value=\"Search\"><input type=\"submit\" name=\"action\" value=\"Fulltext\"></tb></tr>\n". - "</table>\n". - "</form>\n"; - -//Get Search result - if (@$_GET['action']=='Search') - { - $label=$_GET['search']; - $limit=$_GET['limit']; - $subjects=$sc->getSubjects($label,$limit); - foreach ($subjects as $subject){ - $content.="<a href=\"index.php?action=showPage&subject=".$subject."\">".$subject."</a><br/>\n"; - } - } - -//Show Subject Page - if (@$_GET['action']=="showPage") - { - $triples=$sc->getTriples($_GET['subject']); - foreach ($triples as $triple){ - $content.="Subject: ".urldecode($triple[0])."<br/>Predicate: ".urldecode($triple[1])."<br/>Object: ".urldecode($triple[2])."<br/><br/>\n"; - } - } - - - include("master.php"); - - echo $masterContent; - - - - - - function makeBox($title,$content,$toggleBoxContent=true) - { - if($toggleBoxContent) - { - $click="<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a>"; - } - else{$click="";} - $ret=" - <div class=\"box\" id=\"ontology\"> - <div class=\"boxtitle\">".$title.$click."</div> - <div class=\"boxcontent\"> - ".$content." - </div> <!-- boxcontent --> - </div> <!-- box -->"; - return $ret; - } - - - function shorten($a) - { - if(($strpos=strpos($a,'#'))>=4){ - return substr($a,$strpos); - } - else {return $a;} - } - -?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/index.php (from rev 236, trunk/src/DBPedia-Navigator/index.php) =================================================================== --- trunk/src/dbpedia-navigator/index.php (rev 0) +++ trunk/src/dbpedia-navigator/index.php 2007-10-18 17:26:55 UTC (rev 240) @@ -0,0 +1,110 @@ +<?php + +@session_start(); +include_once("Settings.php"); +include_once("SparqlConnection.php"); + + ini_set('error_reporting',E_ALL); + ini_set('max_execution_time',200); + +$lastAction="View"; +$content=""; +$possibleActions=""; +$instances=" "; +$left=""; +$right=""; +$middle=""; +$search=""; +$system=""; + +$settings=new Settings(); + +echo "<a href='index.php?clearsession=clear'>start from scratch</a>"; +if(isset($_GET['clearsession']))$_SESSION['State_ID'] =false; + + + +if( (!isset($_SESSION['State_ID'] ) ) || ($_SESSION['State_ID']=="")) +{ + //get new ID + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + $_SESSION['State_ID']=$sc->getID(); + +} + +else{ + //echo "Current ID is: ".$_SESSION['Learner_ID']."<br>"; + $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['State_ID']); +} + + +//SearchBox + $search="<form action=\"index.php\" method=\"GET\">\n". + "<table border=\"0\">\n". + "<tr><tb>Search:<br/></tb></tr>\n". + "<tr><tb><input type=\"textfield\" name=\"search\"><select name=\"limit\" size=\"1\">\n". + "<option>1</option>\n". + "<option selected=\"selected\">5</option>\n". + "<option>10</option>\n". + "<option>15</option>\n". + "</select><br/></tb></tr>\n". + "<tr><tb><input type=\"submit\" name=\"action\" value=\"Search\"><input type=\"submit\" name=\"action\" value=\"Fulltext\"></tb></tr>\n". + "</table>\n". + "</form>\n"; + +//Get Search result + if (@$_GET['action']=='Search') + { + $label=$_GET['search']; + $limit=$_GET['limit']; + $subjects=$sc->getSubjects($label,$limit); + foreach ($subjects as $subject){ + $content.="<a href=\"index.php?action=showPage&subject=".$subject."\">".$subject."</a><br/>\n"; + } + } + +//Show Subject Page + if (@$_GET['action']=="showPage") + { + $triples=$sc->getTriples($_GET['subject']); + foreach ($triples as $triple){ + $content.="Subject: ".urldecode($triple[0])."<br/>Predicate: ".urldecode($triple[1])."<br/>Object: ".urldecode($triple[2])."<br/><br/>\n"; + } + } + + + include("master.php"); + + echo $masterContent; + + + + + + function makeBox($title,$content,$toggleBoxContent=true) + { + if($toggleBoxContent) + { + $click="<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a>"; + } + else{$click="";} + $ret=" + <div class=\"box\" id=\"ontology\"> + <div class=\"boxtitle\">".$title.$click."</div> + <div class=\"boxcontent\"> + ".$content." + </div> <!-- boxcontent --> + </div> <!-- box -->"; + return $ret; + } + + + function shorten($a) + { + if(($strpos=strpos($a,'#'))>=4){ + return substr($a,$strpos); + } + else {return $a;} + } + +?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/master.php =================================================================== --- trunk/src/DBPedia-Navigator/master.php 2007-10-18 16:24:22 UTC (rev 237) +++ trunk/src/dbpedia-navigator/master.php 2007-10-18 17:26:55 UTC (rev 240) @@ -1,57 +0,0 @@ -<?php - -$masterContent=" - - -<html> - <head> - <title>DL Learner</title> - <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\"/> - <link rel=\"stylesheet\" href=\"default.css\"/> - </head> - <body> -<script type=\"text/javascript\" src=\"jscript/wz_tooltip.js\"></script> -<script type=\"text/javascript\" src=\"jscript/scripts.js\"></script> -<h3>DBPedia-Navigator-Test</h3> -<div id=\"layer\" style=\"display:none\"><div id=\"layerContent\" style=\"display:none\"></div></div> -<div id=\"wrapper\"> - -<div id=\"leftSidebar\"> - -<div class=\"box\" id=\"search\"> - <div class=\"boxtitle\">Search<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a></div> - <div class=\"boxcontent\"> - ".$search." - </div> <!-- boxcontent --> - -</div> <!-- box --> - -".$left." - -<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> -</div><!-- END leftSidebar --> - -<div id=\"content\"> -<div class=\"box\" id=\"search\"> - <div class=\"boxtitle\">Content</div> - <div class=\"boxcontent\"> - ".$content." - </div> <!-- boxcontent --> -</div> <!-- box --> -".$middle." -<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> -</div><!-- content --> - -<div id=\"rightSidebar\"> - -<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> -</div><!-- rightSidebar --> - - <div id=\"clear\"></div> -</div><!-- wrapper --> - - </body> -</html> -"; - -?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/master.php (from rev 236, trunk/src/DBPedia-Navigator/master.php) =================================================================== --- trunk/src/dbpedia-navigator/master.php (rev 0) +++ trunk/src/dbpedia-navigator/master.php 2007-10-18 17:26:55 UTC (rev 240) @@ -0,0 +1,57 @@ +<?php + +$masterContent=" + + +<html> + <head> + <title>DL Learner</title> + <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\"/> + <link rel=\"stylesheet\" href=\"default.css\"/> + </head> + <body> +<script type=\"text/javascript\" src=\"jscript/wz_tooltip.js\"></script> +<script type=\"text/javascript\" src=\"jscript/scripts.js\"></script> +<h3>DBPedia-Navigator-Test</h3> +<div id=\"layer\" style=\"display:none\"><div id=\"layerContent\" style=\"display:none\"></div></div> +<div id=\"wrapper\"> + +<div id=\"leftSidebar\"> + +<div class=\"box\" id=\"search\"> + <div class=\"boxtitle\">Search<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a></div> + <div class=\"boxcontent\"> + ".$search." + </div> <!-- boxcontent --> + +</div> <!-- box --> + +".$left." + +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</div><!-- END leftSidebar --> + +<div id=\"content\"> +<div class=\"box\" id=\"search\"> + <div class=\"boxtitle\">Content</div> + <div class=\"boxcontent\"> + ".$content." + </div> <!-- boxcontent --> +</div> <!-- box --> +".$middle." +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</div><!-- content --> + +<div id=\"rightSidebar\"> + +<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br> +</div><!-- rightSidebar --> + + <div id=\"clear\"></div> +</div><!-- wrapper --> + + </body> +</html> +"; + +?> \ No newline at end of file Copied: trunk/src/dbpedia-navigator/pear (from rev 236, trunk/src/DBPedia-Navigator/pear) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2007-10-19 08:52:01
|
Revision: 244 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=244&view=rev Author: sknappe Date: 2007-10-19 01:51:59 -0700 (Fri, 19 Oct 2007) Log Message: ----------- added the DBPedia-Navigator Added Paths: ----------- trunk/src/DBPedia-Navigator/ trunk/src/DBPedia-Navigator/Settings.php trunk/src/DBPedia-Navigator/SparqlConnection.php trunk/src/DBPedia-Navigator/def0.xsd trunk/src/DBPedia-Navigator/def1.xsd trunk/src/DBPedia-Navigator/default.css trunk/src/DBPedia-Navigator/index.php trunk/src/DBPedia-Navigator/main.wsdl trunk/src/DBPedia-Navigator/master.php trunk/src/DBPedia-Navigator/pear/ trunk/src/DBPedia-Navigator/pear/HTTP_Request.php trunk/src/DBPedia-Navigator/pear/PEAR.php trunk/src/DBPedia-Navigator/pear/Socket.php trunk/src/DBPedia-Navigator/pear/URL.php trunk/src/DBPedia-Navigator/test.php Added: trunk/src/DBPedia-Navigator/Settings.php =================================================================== --- trunk/src/DBPedia-Navigator/Settings.php (rev 0) +++ trunk/src/DBPedia-Navigator/Settings.php 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,12 @@ +<?php + +class Settings{ + + +public $wsdluri="http://localhost:8181/services?wsdl"; + + +public $uri="http://localhost/dllearner/"; +public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; +} +?> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/SparqlConnection.php =================================================================== --- trunk/src/DBPedia-Navigator/SparqlConnection.php (rev 0) +++ trunk/src/DBPedia-Navigator/SparqlConnection.php 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,194 @@ +<?php + +require_once 'pear/HTTP_Request.php'; + +class SparqlConnection +{ + private $DBPediaUrl; + private $DLLearnerUri; + private $client; + + function SparqlConnection($DBPediaUrl,$DLLearnerUri) + { + ini_set("soap.wsdl_cache_enabled","0"); + $this->DBPediaUrl=$DBPediaUrl; + $this->DLLearnerUri=$DLLearnerUri; + $this->loadWSDLfiles($DLLearnerUri); + $this->client=new SoapClient("main.wsdl"); + } + + function getConceptFromExamples($posExamples,$negExamples) + { + $id=$this->client->generateID(); + + $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); + $this->client->applyConfigEntryInt($id, $ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryStringArray($id, $ksID, "instances", array_merge($posExamples,$negExamples)); + $this->client->applyConfigEntryInt($id, $ksID, "filterMode", 0); + $this->client->applyConfigEntryStringArray($id, $ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($id, $ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($id, $ksID, "classList", array()); + $this->client->applyConfigEntryString($id, $ksID, "format", "KB"); + $this->client->applyConfigEntryBoolean($id, $ksID, "dumpToFile", true); + + $this->client->setReasoner($id, "dig"); + $this->client->setLearningProblem($id, "posNegDefinition"); + $this->client->setPositiveExamples($id, $posExamples); + $this->client->setNegativeExamples($id, $negExamples); + $this->client->setLearningAlgorithm($id, "refinement"); + + $start = microtime(true); + + $this->client->init($id); + + $learn_start = microtime(true); + $init = $learn_start - $start; + echo 'components initialised in '.$init.' seconds<br />'; + + $threaded=true; + + if($threaded == false) { + + $concept = $this->client->learn($id); + + $learn = microtime(true) - $learn_start; + echo 'concept learned in '.$learn.' seconds<br />'; + + echo 'result: '.$concept; + + } else { + + $this->client->learnThreaded($id); + + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see what we have learned so far + $concept=$this->client->getCurrentlyBestConcept($id); + $running=$this->client->isAlgorithmRunning($id); + + $seconds = $i * $sleeptime; + + echo 'result after '.$seconds.' seconds of sleep: '.$concept.'<br />'; + + $i++; + } while($running); + + echo 'algorithm finished'; + } + return $concept; + } + + function getTriples($individual) + { + $id=$this->client->generateID(); + + $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); + $this->client->applyConfigEntryInt($id, $ksID, "numberOfRecursions", 1); + $this->client->applyConfigEntryStringArray($id, $ksID, "instances", array($individual)); + $this->client->applyConfigEntryInt($id, $ksID, "filterMode", 3); + $this->client->applyConfigEntryStringArray($id, $ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($id, $ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($id, $ksID, "classList", array()); + $this->client->applyConfigEntryString($id, $ksID, "format", "Array"); + $this->client->applyConfigEntryBoolean($id, $ksID, "dumpToFile", false); + $this->client->applyConfigEntryBoolean($id,$ksID,"useLits",true); + + $object=$this->client->getTriples($id,$ksID); + $array=$object->item; + $ret=array(); + foreach ($array as $element) + { + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + $ret[]=$items; + } + + return $ret; + } + + function getSubjects($label,$limit) + { + $id=$this->client->generateID(); + + $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); + $object=$this->client->getSubjects($id,$ksID,$label,$limit); + return $object->item; + } + + private function loadWSDLfiles($wsdluri){ + $main=$this->getwsdl($wsdluri); + $other=$this->getOtherWSDL($main); + $newMain=$this->changeWSDL($main); + $this->writeToFile("main.wsdl",$newMain); + $x=0; + foreach ($other as $o){ + $this->writeToFile("def".($x++).".xsd",$this->getwsdl($o)); + } + + } + + private function changeWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $newWSDL=""; + $desca="def"; + $descb=".xsd"; + $x=0; + while($posstart= strpos ( $wsdl, $before )){ + + $posstart+=strlen($before); + $newWSDL.=substr($wsdl,0,$posstart); + $wsdl=substr($wsdl,$posstart); + $newWSDL.=$desca.($x++).$descb; + $posend= strpos ( $wsdl, $after ); + $wsdl=substr($wsdl,$posend); + + } + return $newWSDL.$wsdl; + + } + + private function getOtherWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $ret=array(); + while($posstart= strpos ( $wsdl, $before )){ + $posstart+=strlen($before); + $wsdl=substr($wsdl,$posstart); + $posend= strpos ( $wsdl, $after ); + $tmp=substr($wsdl,0,$posend); + $ret[]=$tmp; + $wsdl=substr($wsdl,$posend+strlen($after)); + } + return $ret; + } + + + + + private function getwsdl($wsdluri){ + // this is copied from the Pear example + // please don't ask me how it works + $req = &new HTTP_Request($wsdluri); + $message=""; + $req->setMethod(HTTP_REQUEST_METHOD_GET); + $req->sendRequest(); + $ret=$req->getResponseBody(); + return $ret; + } + + + + private function writeToFile($filename,$content){ + + $fp=fopen($filename,"w"); + fwrite($fp,$content); + fclose($fp); + + } +} +?> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/def0.xsd =================================================================== --- trunk/src/DBPedia-Navigator/def0.xsd (rev 0) +++ trunk/src/DBPedia-Navigator/def0.xsd 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:tns="http://server.dllearner.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://server.dllearner.org/" version="1.0"> + + <xs:element name="ClientNotKnownException" type="tns:ClientNotKnownException"></xs:element> + + <xs:element name="ConfigOptionTypeException" type="tns:ConfigOptionTypeException"></xs:element> + + <xs:element name="UnknownComponentException" type="tns:UnknownComponentException"></xs:element> + + <xs:complexType name="ClientNotKnownException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="UnknownComponentException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ConfigOptionTypeException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/def1.xsd =================================================================== --- trunk/src/DBPedia-Navigator/def1.xsd (rev 0) +++ trunk/src/DBPedia-Navigator/def1.xsd 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array" version="1.0"> + + <xs:complexType final="#all" name="stringArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/default.css =================================================================== --- trunk/src/DBPedia-Navigator/default.css (rev 0) +++ trunk/src/DBPedia-Navigator/default.css 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,453 @@ +/** + * default.css + * main Ontowiki style sheet + * @author: Norman Heino + * @version: $Id: default.css 751 2007-02-14 19:20:17Z nheino $ + */ + +/* remove browser specific margins */ +* { + margin: 0; + padding: 0; +} + +html { + font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; +} + +p { + margin: 8px 0; +} + +h2 { + margin: 0.5em 0 0.1em 0; +/* background-color: #eee;*/ + font-size: 110%; +} + + +/* + * Main site structure + */ + +#wrapper { + position: relative; + max-width: 100%; + padding: 15px; +/* margin: 15px;*/ +} + +#content { + margin: 0 19em; + overflow: hidden; +/* border-left: 1px solid #bbb; + border-right: 1px solid #bbb; + padding: 0 5px;*/ +} + +/* + * Side bars are positioned absolutely due to several reasons: + * (1)Internet Explorer has problems displaying float elements, + * (2) the content's position in html is irrelevant, + * (3) positioning the content div is more straightforward. + */ +#leftSidebar { + position: absolute; + width: 18em; +} + +#rightSidebar { + position: absolute; + width: 18em; + top: 15px; + right: 15px; +} + +#clear { + clear: both; +} + + +/* + * sidebar content (boxes) + */ + +.box { + color: #666; + margin-bottom: 20px; + border: 1px solid #bbb; + font-size: 85%; +} + +/*.box td { + font-size: 100%; +}*/ + +.box .boxtitle { + color: #666; + background-color: #eee; + padding: 3px 0.4em; + font-weight: bold; + white-space: nowrap; +} + +.box .boxtitle .boxtitle_string { + width: 80%; + overflow: hidden; +/* display: none;*/ +} + +.box .boxcontent { + padding: 0.6em; + border-top: 1px solid #bbb; +} + +/* restrict content of certain boxes */ +.box#predicates .boxcontent, +.box#classes .boxcontent { + overflow: hidden; +} + +.box p { + margin: 0 2px 4px 0; +} + +.box ul, .box ol { + margin: 0px; +/* padding-left: 15px;*/ + list-style-position: inside; +} + +.box ul.no_bullet, .box ul.no_bullet { + list-style-type: none; +} + +.box ul li.horizontal, .box ol li.horizontal, +.box ul.horizontal, .box ol.horizontal { + display: inline; +} + +.box a.title_switch { + position: absolute; + right: 0.5em; + margin: auto 0; + color: #666; + border: 1px solid #bbb; + width: 1em; + height: 1em; + background-color: #fff; + text-align: center; +} + +.box a.title_switch:hover { + color: #02a; + text-decoration: none; + background-color: #eee; +} + +.box hr { + margin: 0.5em 0; + border: none; + border-top: 1px dotted #bbb; + height: 0; +} + +.box#classes .boxcontent a { + display: block; +} + +/*.box select { + width: 250px; /* TODO remove absolute size */ +}*/ + +.box input { + width: auto; +} + +.box td input { + width: 100%; +} + +.box img.rating { + position: relative; + top: 1px; +} + +.hidden { + display: none; +} + + +/* + * Links + */ + +a, a:link, a:visited { + color: #02a; + text-decoration: none; + cursor: pointer; +} + +a:hover { + text-decoration: underline; +} + + +/* + * Tabs + */ + +/* all the tabs */ +.tabs { + float: left; + width: 100%; + background: #fff url("../images/tabs_back.png") repeat-x bottom; +} + +.tabs ul { + list-style: none; +} + +.tabs li { + float: left; + margin-right: 1px; +} + +.tabs a { + display: block; + margin-top: 1px; + padding: 0.35em 1.35em; + background-image: url("../images/tab_back.png"); + background-repeat: repeat-x; + background-color: #cbcbcb; + border: 1px solid #bbb; +} + +.tabs a:hover { + background: #fff; + text-decoration: none; +} + +.tabs a.current { + background: #fff; + border-bottom: 1px solid #fff; +} + +/* horizontal line underneath the tabs */ +#tab-line { + height: 1em; + clear: both; +} + +#instances { + float: right; +} + +.selected { + background-color: #bde; /*#b4d5fe;*/ +} + +.button { + border: solid black 1px; + padding: 0px 1px; + background-color: #eee; +} + +/* + * Tables + */ + +tr.odd { + background-color: #ccc; +} + +tr.even { + background-color: #eee; +} + +table.instanceTable th { + text-align: left; +/* background-color: #eee;*/ +} + +table.instanceTable > tbody > tr > td { + padding-top: 0.5em; +} + +table.instanceTable td.property { + text-align: right; + font-style: italic; + padding-right: 5px; +} + +table.instanceTable ul { + margin: 0px; + padding-left: 20px; +} + +table.instanceTable { + width: 100%; +} + +.searchHighlight { + background-color: orange; +} + +table.tripletable { + width: 100%; + font-size: 90%; +} + +.tripletable td { + padding: 0.4em; +} + +table.blind tr td { + padding-top: 0.4em; +} + +/* + * Instances + */ + +.instance .instance { + margin-left: 13px; + background-color: #ddd; +} +.instance .instance td { + font-size: 90%; +} +.instance .instance .instance { + background-color: #eee; +} + +.instance .instance .instance .instance { + background-color: #fff; +} + +#instanceEdit { + border-spacing: 0px; + width: 100%; +} + +#instanceEdit input, #instanceEdit textarea { +/* width: 250px;*/ + background-color: #fff; + font-size: 95%; + font-family: "Lucida Grande", Helvetica, Arial, sans-serif; + padding: 0.1em 0; +} + +#instanceEdit > tbody > tr > td, #instanceEdit > tr > td { + background-color: #eee; + padding: 5px; + border-bottom: 2px solid #fdfdfd; +} + +/* + * Calendar + */ + +table.calendar { + margin-top: 1em; + width: 100%; + height: 730px; + table-layout: fixed; + font-size: 90%; +} + +.calendar .weekday0 { + background-color: #eee; + padding: 0.4em; +} +.calendar .weekday1 { + background-color: #f5f5f5; + padding: 0.4em; +} +.calendar .weekend0 { + background-color: #ddd; + padding: 0.4em; +} +.calendar .weekend1 { + background-color: #eaeaea; + padding: 0.4em; +} + +#map { + margin-top: 0.5em; + width: 100%; + height: 750px; + font-size: 90%; +} + +#map .instance td { + font-size: 80%; + padding: 0 3px; + border-bottom: 5px solid white; +} + +#superClassPath { + margin-bottom: 0.5em; +} + +img { + border: none; +} + +span.submit { + float: right; + padding-right: 100px; +} + +/* + * Autosuggest box + */ +div.autosuggest { + font-size: 85%; + position: absolute; + background-color: #fff; + border: 1px solid #bbb; +} + +div.autosuggest ul { + list-style-type: none; + list-style-position: inside; + padding-left: 0px; +} + +div.autosuggest ul li.selected { + background-color: #bde; +} + +div.autosuggest ul li { + display: block; + padding: 0.2em; +/* height: 22px;*/ + cursor: pointer; +} + +span.formal { + display: none; +} + +/* + * Layer + */ +#layer { + width: 100%; + height: 100%; + position: absolute; + background-image: url("../images/black_50.png"); + background-repeat: repeat; + z-index: 98; +} + +#layerContent { + margin-top: 100px; + margin: auto; + width: 500px; + height: 300px; + background-color: #ffb; + border: 2px solid #bbb; + z-index: 99; +} Added: trunk/src/DBPedia-Navigator/index.php =================================================================== --- trunk/src/DBPedia-Navigator/index.php (rev 0) +++ trunk/src/DBPedia-Navigator/index.php 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,163 @@ +<?php + +@session_start(); +include_once("Settings.php"); +include_once("SparqlConnection.php"); + + ini_set('error_reporting',E_ALL); + ini_set('max_execution_time',200); + +$content=""; +$search=""; +$examples=""; +$positiveAdd=""; +$negativeAdd=""; + +$settings=new Settings(); + +echo "<a href='index.php?clearsession=clear'>start from scratch</a>"; +if(isset($_GET['clearsession'])){ + unset($_SESSION['positive']); + unset($_SESSION['negative']); +} + +$sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); + +//add positives or negatives to session +if (@$_GET['action']=='AddPositive'){ + $_GET=$_SESSION["lastGet"]; + if (!isset($_SESSION['positive'])){ + $array=array($_GET['subject']); + $_SESSION['positive']=$array; + } + else{ + $array=$_SESSION['positive']; + $array[]=$_GET['subject']; + $_SESSION['positive']=$array; + } +} +if (@$_GET['action']=='AddNegative'){ + $_GET=$_SESSION["lastGet"]; + if (!isset($_SESSION['negative'])){ + $array=array($_GET['subject']); + $_SESSION['negative']=$array; + } + else{ + $array=$_SESSION['negative']; + $array[]=$_GET['subject']; + $_SESSION['negative']=$array; + } +} +if (@$_GET['action']=='ClearPositive'){ + $_GET=$_SESSION["lastGet"]; + unset($_SESSION['positive']); +} +if (@$_GET['action']=='ClearNegative'){ + $_GET=$_SESSION["lastGet"]; + unset($_SESSION['negative']); +} + +//learn a concept +if (@$_GET['action']=="GetConcept") +{ + $_GET=$_SESSION["lastGet"]; + $conc=$sc->getConceptFromExamples($_SESSION['positive'],$_SESSION['negative']); + $_SESSION['learnedConcept']=$conc; +} +if (isset($_SESSION['learnedConcept'])) $learnedConcept="<br/>Last learned Concept: ".$_SESSION['learnedConcept']; +else $learnedConcept=""; + +//SearchBox + $search="<form action=\"index.php\" method=\"GET\">\n". + "<table border=\"0\">\n". + "<tr><tb>Search:<br/></tb></tr>\n". + "<tr><tb><input type=\"textfield\" name=\"search\"><select name=\"limit\" size=\"1\">\n". + "<option>1</option>\n". + "<option selected=\"selected\">5</option>\n". + "<option>10</option>\n". + "<option>15</option>\n". + "</select><br/></tb></tr>\n". + "<tr><tb><input type=\"submit\" name=\"action\" value=\"Search\"><input type=\"submit\" name=\"action\" value=\"Fulltext\"></tb></tr>\n". + "</table>\n". + "</form>\n"; + +//Get Search result + if (@$_GET['action']=='Search') + { + $label=$_GET['search']; + $limit=$_GET['limit']; + $subjects=$sc->getSubjects($label,$limit); + foreach ($subjects as $subject){ + $content.="<a href=\"index.php?action=showPage&subject=".$subject."\">".$subject."</a><br/>\n"; + } + } + +//Show Subject Page + if (@$_GET['action']=="showPage") + { + $triples=$sc->getTriples($_GET['subject']); + foreach ($triples as $triple){ + $content.="Subject: ".urldecode($triple[0])."<br/>Predicate: ".urldecode($triple[1])."<br/>Object: ".urldecode($triple[2])."<br/><br/>\n"; + } + $positiveAdd="<input type=\"submit\" name=\"action\" value=\"AddPositive\">"; + $negativeAdd="<input type=\"submit\" name=\"action\" value=\"AddNegative\">"; + } + +//add box for adding articles to positive or negative + $examples.="<form action=\"index.php\" method=\"GET\">\n". + "Positive:<br/>\n"; + if (!isset($_SESSION['positive'])) $examples.="No positive example picked yet.<br/>\n"; + else{ + $pos=$_SESSION['positive']; + foreach ($pos as $p) + { + $examples.=$p."<br/>\n"; + } + } + $examples.="<br/>".$positiveAdd." <input type=\"submit\" name=\"action\" value=\"ClearPositive\">\n". + "</form>\n"; + + $examples.="<form action=\"index.php\" method=\"GET\">\n". + "<br/>Negative:<br/>\n"; + if (!isset($_SESSION['negative'])) $examples.="No negative example picked yet.<br/>\n"; + else{ + $neg=$_SESSION['negative']; + foreach ($neg as $n) + { + $examples.=$n."<br/>\n"; + } + } + $examples.="<br/>".$negativeAdd." <input type=\"submit\" name=\"action\" value=\"ClearNegative\">\n". + "</form>\n"; + +//fill concept box + $concept="<form action=\"index.php\" method=\"GET\">\n". + "<input type=\"submit\" name=\"action\" value=\"GetConcept\">\n". + "</form>\n"; + $concept.=$learnedConcept; + +//include master + $_SESSION['lastGet']=$_GET; + include("master.php"); + + echo $masterContent; + + + //make a box + function makeBox($title,$content,$toggleBoxContent=true) + { + if($toggleBoxContent) + { + $click="<a class=\"title_switch\" onclick=\"toggleBoxContent(this);\">\x96</a>"; + } + else{$click="";} + $ret=" + <div class=\"box\" id=\"ontology\"> + <div class=\"boxtitle\">".$title.$click."</div> + <div class=\"boxcontent\"> + ".$content." + </div> <!-- boxcontent --> + </div> <!-- box -->"; + return $ret; + } +?> \ No newline at end of file Added: trunk/src/DBPedia-Navigator/main.wsdl =================================================================== --- trunk/src/DBPedia-Navigator/main.wsdl (rev 0) +++ trunk/src/DBPedia-Navigator/main.wsdl 2007-10-19 08:51:59 UTC (rev 244) @@ -0,0 +1,934 @@ +<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> + <types> + <xsd:schema> + <xsd:import schemaLocation="def0.xsd" namespace="http://server.dllearner.org/"></xsd:import> + </xsd:schema> + <xsd:schema> + <xsd:import schemaLocation="def1.xsd" namespace="http://jaxb.dev.java.net/array"></xsd:import> + </xsd:schema> + </types> + <message name="generateID"></message> + <message name="generateIDResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getKnowledgeSources"></message> + <message name="getKnowledgeSourcesResponse"> + <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + </message> + <message name="getReasoners"></message> + <message name="getReasonersResponse"> + <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> + </message> + <message name="getLearningProblems"></message> + <message name="getLearningProblemsResponse"> + <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> + </message> + <message name="getLearningAlgorithms"></message> + <message name="getLearningAlgorithmsResponse"> + <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> + </message> + <message name="getConfigOptions"> + <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionsResponse"> + <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> + </message> + <message name="UnknownComponentException"> + <part element="tns:UnknownComponentException" name="fault"></part> + </message> + <message name="addKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="addKnowledgeSourceResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="ClientNotKnownException"> + <part element="tns:ClientNotKnownException" name="fault"></part> + </message> + <message name="removeKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="removeKnowledgeSourceResponse"></message> + <message name="setReasoner"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setReasonerResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningProblem"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningProblemResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningAlgorithm"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningAlgorithmResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="learn"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnThreaded"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnThreadedResponse"></message> + <message name="getCurrentlyBestConcept"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestConceptResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="isAlgorithmRunning"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="isAlgorithmRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="setPositiveExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns6="http://jaxb.dev.java.net/array" name="arg1" type="ns6:stringArray"></part> + </message> + <message name="setPositiveExamplesResponse"></message> + <message name="setNegativeExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns7="http://jaxb.dev.java.net/array" name="arg1" type="ns7:stringArray"></part> + </message> + <message name="setNegativeExamplesResponse"></message> + <message name="applyConfigEntryInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:int"></part> + </message> + <message name="applyConfigEntryIntResponse"></message> + <message name="applyConfigEntryString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:string"></part> + </message> + <message name="applyConfigEntryStringResponse"></message> + <message name="applyConfigEntryStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part xmlns:ns8="http://jaxb.dev.java.net/array" name="arg3" type="ns8:stringArray"></part> + </message> + <message name="applyConfigEntryStringArrayResponse"></message> + <message name="applyConfigEntryBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:boolean"></part> + </message> + <message name="applyConfigEntryBooleanResponse"></message> + <message name="getConfigOptionValueStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringArrayResponse"> + <part xmlns:ns9="http://jaxb.dev.java.net/array" name="return" type="ns9:stringArray"></part> + </message> + <message name="ConfigOptionTypeException"> + <part element="tns:ConfigOptionTypeException" name="fault"></part> + </message> + <message name="getConfigOptionValueString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDouble"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDoubleResponse"> + <part name="return" type="xsd:double"></part> + </message> + <message name="getConfigOptionValueBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueBooleanResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionValueInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueIntResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicConcepts"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicConceptsResponse"> + <part xmlns:ns10="http://jaxb.dev.java.net/array" name="return" type="ns10:stringArray"></part> + </message> + <message name="getSubsumptionHierarchy"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getSubsumptionHierarchyResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="retrieval"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="retrievalResponse"> + <part xmlns:ns11="http://jaxb.dev.java.net/array" name="return" type="ns11:stringArray"></part> + </message> + <message name="getAtomicRoles"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicRolesResponse"> + <part xmlns:ns12="http://jaxb.dev.java.net/array" name="return" type="ns12:stringArray"></part> + </message> + <message name="getInstances"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getInstancesResponse"> + <part xmlns:ns13="http://jaxb.dev.java.net/array" name="return" type="ns13:stringArray"></part> + </message> + <message name="getIndividualsForARole"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="getIndividualsForARoleResponse"> + <part xmlns:ns14="http://jaxb.dev.java.net/array" name="return" type="ns14:stringArray"></part> + </message> + <message name="getTriples"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getTriplesResponse"> + <part xmlns:ns15="http://jaxb.dev.java.net/array" name="return" type="ns15:stringArray"></part> + </message> + <message name="getSubjects"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:int"></part> + </message> + <message name="getSubjectsResponse"> + <part xmlns:ns16="http://jaxb.dev.java.net/array" name="return" type="ns16:stringArray"></part> + </message> + <message name="init"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="initResponse"></message> + <message name="stop"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="stopResponse"></message> + <message name="getComponents"></message> + <message name="getComponentsResponse"> + <part xmlns:ns17="http://jaxb.dev.java.net/array" name="return" type="ns17:stringArray"></part> + </message> + <portType name="DLLearnerWebService"> + <operation name="generateID" parameterOrder=""> + <input message="tns:generateID"></input> + <output message="tns:generateIDResponse"></output> + </operation> + <operation name="getKnowledgeSources" parameterOrder=""> + <input message="tns:getKnowledgeSources"></input> + <output message="tns:getKnowledgeSourcesResponse"></output> + </operation> + <operation name="getReasoners" parameterOrder=""> + <input message="tns:getReasoners"></input> + <output message="tns:getReasonersResponse"></output> + </operation> + <operation name="getLearningProblems" parameterOrder=""> + <input message="tns:getLearningProblems"></input> + <output message="tns:getLearningProblemsResponse"></output> + </operation> + <operation name="getLearningAlgorithms" parameterOrder=""> + <input message="tns:getLearningAlgorithms"></input> + <output message="tns:getLearningAlgorithmsResponse"></output> + </operation> + <operation name="getConfigOptions" parameterOrder="arg0 arg1"> + <input message="tns:getConfigOptions"></input> + <output message="tns:getConfigOptionsResponse"></output> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="addKnowledgeSource" parameterOrder="arg0 arg1 arg2"> + <input message="tns:addKnowledgeSource"></input> + <output message="tns:addKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="removeKnowledgeSource" parameterOrder="arg0 arg1"> + <input message="tns:removeKnowledgeSource"></input> + <output message="tns:removeKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setReasoner" parameterOrder="arg0 arg1"> + <input message="tns:setReasoner"></input> + <output message="tns:setReasonerResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningProblem" parameterOrder="arg0 arg1"> + <input message="tns:setLearningProblem"></input> + <output message="tns:setLearningProblemResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningAlgorithm" parameterOrder="arg0 arg1"> + <input message="tns:setLearningAlgorithm"></input> + <output message="tns:setLearningAlgorithmResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="learn" parameterOrder="arg0"> + <input message="tns:learn"></input> + <output message="tns:learnResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="learnThreaded" parameterOrder="arg0"> + <input message="tns:learnThreaded"></input> + <output message="tns:learnThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcept" parameterOrder="arg0"> + <input message="tns:getCurrentlyBestConcept"></input> + <output message="tns:getCurrentlyBestConceptResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isAlgorithmRunning" parameterOrder="arg0"> + <input message="tns:isAlgorithmRunning"></input> + <output message="tns:isAlgorithmRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setPositiveExamples" parameterOrder="arg0 arg1"> + <input message="tns:setPositiveExamples"></input> + <output message="tns:setPositiveExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setNegativeExamples" parameterOrder="arg0 arg1"> + <input message="tns:setNegativeExamples"></input> + <output message="tns:setNegativeExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="applyConfigEntryInt" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryInt"></input> + <output message="tns:applyConfigEntryIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryString" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryString"></input> + <output message="tns:applyConfigEntryStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryStringArray" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryStringArray"></input> + <output message="tns:applyConfigEntryStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryBoolean" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryBoolean"></input> + <output message="tns:applyConfigEntryBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="getConfigOptionValueStringArray" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueStringArray"></input> + <output message="tns:getConfigOptionValueStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueString" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueString"></input> + <output message="tns:getConfigOptionValueStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueDouble" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueDouble"></input> + <output message="tns:getConfigOptionValueDoubleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueBoolean" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueBoolean"></input> + <output message="tns:getConfigOptionValueBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueInt" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueInt"></input> + <output message="tns:getConfigOptionValueIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getAtomicConcepts" parameterOrder="arg0"> + <input message="tns:getAtomicConcepts"></input> + <output message="tns:getAtomicConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getSubsumptionHierarchy" parameterOrder="arg0"> + <input message="tns:getSubsumptionHierarchy"></input> + <output message="tns:getSubsumptionHierarchyResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="retrieval" parameterOrder="arg0 arg1"> + <input message="tns:retrieval"></input> + <output message="tns:retrievalResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getAtomicRoles" parameterOrder="arg0"> + <input message="tns:getAtomicRoles"></input> + <output message="tns:getAtomicRolesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getInstances" parameterOrder="arg0"> + <input message="tns:getInstances"></input> + <output message="tns:getInstancesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getIndividualsForARole" parameterOrder="arg0 arg1"> + <input message="tns:getIndividualsForARole"></input> + <output message="tns:getIndividualsForARoleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getTriples" parameterOrder="arg0 arg1"> + <input message="tns:getTriples"></input> + <output message="tns:getTriplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getSubjects" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:getSubjects"></input> + <output message="tns:getSubjectsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="init" parameterOrder="arg0 arg1"> + <input message="tns:init"></input> + <output message="tns:initResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="stop" parameterOrder="arg0"> + <input message="tns:stop"></input> + <output message="tns:stopResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getComponents" parameterOrder=""> + <input message="tns:getComponents"></input> + <output message="tns:getComponentsResponse"></output> + </operation> + </portType> + <binding name="DLLearnerWebServicePortBinding" type="tns:DLLearnerWebService"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <operation name="generateID"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getKnowledgeSources"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getReasoners"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningProblems"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningAlgorithms"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getConfigOptions"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="addKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="removeKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setReasoner"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningProblem"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningAlgorithm"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learn"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learnThreaded"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcept"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="isAlgorithmRunning"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setPositiveExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setNegativeExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueDouble"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getSubsumptionHierarchy"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="retrieval"> + <soap:operation soapAction=""></soap:operation> +... [truncated message content] |
From: <sk...@us...> - 2007-10-30 16:30:32
|
Revision: 274 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=274&view=rev Author: sknappe Date: 2007-10-30 09:30:24 -0700 (Tue, 30 Oct 2007) Log Message: ----------- All calls of the dllearner from the application are now done with threads Modified Paths: -------------- trunk/src/dbpedia-navigator/Ajax-Test/Settings.php trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php trunk/src/dbpedia-navigator/Ajax-Test/index.php trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Modified: trunk/src/dbpedia-navigator/Ajax-Test/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/Settings.php 2007-10-29 13:15:28 UTC (rev 273) +++ trunk/src/dbpedia-navigator/Ajax-Test/Settings.php 2007-10-30 16:30:24 UTC (rev 274) @@ -2,6 +2,7 @@ class Settings{ public $wsdluri="http://localhost:8181/services?wsdl"; - public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; + public $dbpediauri="http://dbpedia.openlinksw.com:8890/sparql"; + public $sparqlttl=40; } ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php 2007-10-29 13:15:28 UTC (rev 273) +++ trunk/src/dbpedia-navigator/Ajax-Test/SparqlConnection.php 2007-10-30 16:30:24 UTC (rev 274) @@ -16,7 +16,7 @@ $this->client=new SoapClient("main.wsdl"); } - function getConceptFromExamples($posExamples,$negExamples) + function getConceptFromExamples($ttl,$posExamples,$negExamples) { $id=$this->client->generateID(); @@ -64,13 +64,14 @@ $seconds = $i * $sleeptime; $i++; - } while($running); + } while($seconds<$ttl&&$running); + $this->client->stop($id); } return $concept; } - function getTriples($individual) + function getTriples($ttl,$individual) { $id=$this->client->generateID(); @@ -85,34 +86,93 @@ $this->client->applyConfigEntryBoolean($id, $ksID, "dumpToFile", false); $this->client->applyConfigEntryBoolean($id,$ksID,"useLits",true); - $object=$this->client->getTriples($id,$ksID); - $array=$object->item; - $ret=array(); - foreach ($array as $element) - { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[$items[1]]=$items[2]; - } + $options=array("triples"); + $this->client->startThread($id,$ksID,$options); + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($id,$ksID,"triples")) + { + $object=$this->client->getFromSparql($id,$ksID,"triples"); + $array=$object->item; + $ret=array(); + foreach ($array as $element) + { + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + $ret[$items[1]]=$items[2]; + } + return $ret; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); - return $ret; + $this->client->stopSparqlThread($id,$ksID,"triples"); + return array(); } - function getSubjects($label='Leipzig',$limit=5) + function getSubjects($ttl,$label='Leipzig',$limit=5) { $id=$this->client->generateID(); $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); - $object=$this->client->getSubjects($id,$ksID,$label,$limit); - return $object->item; + + $options=array("subjects",$label,$limit); + $this->client->startThread($id,$ksID,$options); + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($id,$ksID,"subjects")) + { + $object=$this->client->getFromSparql($id,$ksID,"subjects"); + return $object->item; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($id,$ksID,"subjects"); + return array(); } - function getSubjectsFromConcept($concept) + function getSubjectsFromConcept($ttl,$concept) { $id=$this->client->generateID(); $ksID = $this->client->addKnowledgeSource($id, "sparql", $this->DBPediaUrl); - $object=$this->client->getSubjectsFromConcept($id,$ksID,$concept); - return $object->item; + $options=array("conceptSubjects",$concept); + $this->client->startThread($id,$ksID,$options); + $i = 1; + $sleeptime = 1; + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($id,$ksID,"conceptSubjects")) + { + $object=$this->client->getFromSparql($id,$ksID,"conceptSubjects"); + return $object->item; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($id,$ksID,"conceptSubjects"); + return array(); } public function loadWSDLfiles($wsdluri){ Modified: trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php 2007-10-29 13:15:28 UTC (rev 273) +++ trunk/src/dbpedia-navigator/Ajax-Test/ajaxfunctions.php 2007-10-30 16:30:24 UTC (rev 274) @@ -1,4 +1,5 @@ <?php +ini_set('max_execution_time',200); session_start(); function getsubjects($label, $limit) { @@ -8,10 +9,13 @@ $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); $content=""; - $subjects=$sc->getSubjects($label,$limit); - foreach ($subjects as $subject) - { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."');return false;\">".urldecode(substr (strrchr ($subject, "/"), 1))."</a><br/>"; + $subjects=$sc->getSubjects($settings->sparqlttl,$label,$limit); + if (count($subjects)==0) $content.="No search result found in time."; + else{ + foreach ($subjects as $subject) + { + $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."');return false;\">".urldecode(substr (strrchr ($subject, "/"), 1))."</a><br/>"; + } } $objResponse = new xajaxResponse(); @@ -25,13 +29,16 @@ require_once("SparqlConnection.php"); $settings=new Settings(); $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); - $triples=$sc->getTriples($subject); - $content=""; - $content.="<img src=\"".$triples['http://xmlns.com/foaf/0.1/img']."\" alt=\"Picture of ".urldecode(substr (strrchr ($subject, "/"), 1))."\" width=\"50\"/ style=\"float:left\">"; - $content.="<div>".$triples['http://dbpedia.org/property/abstract']."</div>"; + $triples=$sc->getTriples($settings->sparqlttl,$subject); + if (count($triples)==0) $content.="Article not found."; + else { + $content=""; + $content.="<img src=\"".$triples['http://xmlns.com/foaf/0.1/img']."\" alt=\"Picture of ".urldecode(substr (strrchr ($subject, "/"), 1))."\" width=\"50\"/ style=\"float:left\">"; + $content.="<div>".$triples['http://dbpedia.org/property/abstract']."</div>"; + + $contentbuttons="<input type=\"button\" value=\"Positive\" class=\"button\" onclick=\"xajax_addPositive('".$subject."');return false;\" /> <input type=\"button\" value=\"Negative\" class=\"button\" onclick=\"xajax_addNegative('".$subject."');return false;\" />"; + } - $contentbuttons="<input type=\"button\" value=\"Positive\" class=\"button\" onclick=\"xajax_addPositive('".$subject."');return false;\" /> <input type=\"button\" value=\"Negative\" class=\"button\" onclick=\"xajax_addNegative('".$subject."');return false;\" />"; - $objResponse = new xajaxResponse(); $objResponse->assign("articlecontent", "innerHTML", $content); $objResponse->assign("contentbuttons", "innerHTML", $contentbuttons); @@ -103,9 +110,9 @@ $settings=new Settings(); $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); - $concept=$sc->getConceptFromExamples($_SESSION['positive'],$_SESSION['negative']); + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); $_SESSION['lastLearnedConcept']=$concept; - $concept=urldecode(substr (strrchr ($concept, "/"), 1)); + if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } else $concept="You must choose at least one<br/> positive and one negative example."; @@ -124,10 +131,13 @@ $content=""; if (isset($_SESSION['lastLearnedConcept'])) { - $subjects=$sc->getSubjectsFromConcept($_SESSION['lastLearnedConcept']); - foreach ($subjects as $subject) - { - $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."');return false;\">".urldecode(substr (strrchr ($subject, "/"), 1))."</a><br/>"; + $subjects=$sc->getSubjectsFromConcept($settings->sparqlttl,$_SESSION['lastLearnedConcept']); + if (count($subjects)==0) $content.="No examples for concept found in time."; + else { + foreach ($subjects as $subject) + { + $content.="<a href=\"\" onclick=\"xajax_getarticle('".$subject."');return false;\">".urldecode(substr (strrchr ($subject, "/"), 1))."</a><br/>"; + } } } else $content.="No concept to get Subjects from."; Modified: trunk/src/dbpedia-navigator/Ajax-Test/index.php =================================================================== --- trunk/src/dbpedia-navigator/Ajax-Test/index.php 2007-10-29 13:15:28 UTC (rev 273) +++ trunk/src/dbpedia-navigator/Ajax-Test/index.php 2007-10-30 16:30:24 UTC (rev 274) @@ -1,12 +1,13 @@ <?php +ini_set('error_reporting',E_ALL); +ini_set('max_execution_time',200); session_start(); echo "<a href='clearsession.php'>start from scratch</a>"; require("ajax.php"); - ini_set('error_reporting',E_ALL); - ini_set('max_execution_time',200); + echo '<?xml version="1.0" encoding="UTF-8"?>' ?> <html> @@ -14,7 +15,7 @@ <title>DL Learner</title> <meta http-equiv=\"content-type\" content=\"text/html; charset=ISO-8859-1\"/> <link rel="stylesheet" href="default.css"/> - <?php $xajax->printJavascript('xajax/'); ?> + <?php $xajax->printJavascript('xajax/'); ?> <script type="text/javascript"> showLoadingSubjects = function() { xajax.$('loadingSubject').style.display='block'; @@ -49,7 +50,7 @@ xajax.$('conceptsubjectcontent').style.display = 'block'; } </script> - </head> + </head> <body> <h3>DBPedia-Navigator-Test</h3> <div id="layer" style="display:none"><div id="layerContent" style="display:none"></div></div> @@ -59,7 +60,6 @@ <div class="box" id="search"> <div class="boxtitle">Search</div> <div class="boxcontent"> - <form action="index.php" method="GET" id="searchForm"> <table border="0"> <tr><tb>Search:<br/></tb></tr> <tr><tb><input type="textfield" name="label" id="label"> <select name="limit" size="1" id="limit"> @@ -68,9 +68,8 @@ <option>10</option> <option>15</option> </select><br/></tb></tr> - <tr><tb><input type="button" value="Search" class="button" onclick="xajax_getsubjects(document.getElementById('label').value,document.getElementById('limit').value);return false;" /></tb></tr> + <tr><tb><input type="button" value="Search" class="button" onclick="xajax_getsubjects(document.getElementById('label').value,document.getElementById('limit').value);return false;"/></tb></tr> </table> - </form> </div> <!-- boxcontent --> </div> <!-- box --> Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2007-10-29 13:15:28 UTC (rev 273) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlEndpoint.java 2007-10-30 16:30:24 UTC (rev 274) @@ -69,6 +69,39 @@ private boolean dumpToFile; private boolean useLits=false; + /** + * Holds the results of the calculateSubjects method + */ + private String[] subjects; + + /** + * Holds the results of the calculateTriples method + */ + private String[] triples; + + /** + * Holds the results of the calculateConceptSubjects method + */ + private String[] conceptSubjects; + + /** + * if a method is running this becomes true + */ + private boolean subjectThreadRunning=false; + + private boolean triplesThreadRunning=false; + + private boolean conceptThreadRunning=false; + + /** + * the Thread that is running a method + */ + private Thread subjectThread; + + private Thread triplesThread; + + private Thread conceptThread; + //received ontology as array, used if format=Array(an element of the //array consists of the subject, predicate and object separated by '<' private String[] ontArray; @@ -196,30 +229,96 @@ return ontArray; } - public String[] getSubjects(String label,int limit) + public void calculateSubjects(String label,int limit) { System.out.println("SparqlModul: Collecting Subjects"); SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - String[] ret=oc.getSubjectsFromLabel(label,limit); + subjects=oc.getSubjectsFromLabel(label,limit); System.out.println("SparqlModul: ****Finished"); - return ret; } - public String[] getTriples(){ + public void calculateTriples(){ System.out.println("SparqlModul: Collecting Triples"); SparqlOntologyCollector oc=new SparqlOntologyCollector(Datastructures.setToArray(instances), numberOfRecursions, filterMode, Datastructures.setToArray(predList),Datastructures.setToArray( objList),Datastructures.setToArray(classList),format,url,useLits); - String[] ret=oc.collectTriples(); + triples=oc.collectTriples(); System.out.println("SparqlModul: ****Finished"); - return ret; } - public String[] getSubjectsFromConcept(String concept) + public void calculateConceptSubjects(String concept) { System.out.println("SparqlModul: Collecting Subjects"); SparqlOntologyCollector oc=new SparqlOntologyCollector(url); - String[] ret=oc.getSubjectsFromConcept(concept); + conceptSubjects=oc.getSubjectsFromConcept(concept); System.out.println("SparqlModul: ****Finished"); - return ret; } + + public boolean subjectThreadIsRunning() + { + return subjectThreadRunning; + } + + public void setSubjectThreadRunning(boolean bool) + { + subjectThreadRunning=bool; + } + + public boolean triplesThreadIsRunning() + { + return triplesThreadRunning; + } + + public void setTriplesThreadRunning(boolean bool) + { + triplesThreadRunning=bool; + } + + public boolean conceptThreadIsRunning() + { + return conceptThreadRunning; + } + + public void setConceptThreadRunning(boolean bool) + { + conceptThreadRunning=bool; + } + + public String[] getSubjects() + { + return subjects; + } + + public Thread getSubjectThread() { + return subjectThread; + } + + public void setSubjectThread(Thread subjectThread) { + this.subjectThread = subjectThread; + } + + public Thread getTriplesThread() { + return triplesThread; + } + + public void setTriplesThread(Thread triplesThread) { + this.triplesThread = triplesThread; + } + + public Thread getConceptThread() { + return conceptThread; + } + + public void setConceptThread(Thread conceptThread) { + this.conceptThread = conceptThread; + } + + public String[] getTriples() + { + return triples; + } + + public String[] getConceptSubjects() + { + return conceptSubjects; + } } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-29 13:15:28 UTC (rev 273) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2007-10-30 16:30:24 UTC (rev 274) @@ -449,27 +449,99 @@ return Datastructures.sortedSet2StringListIndividuals(individuals); } + //////////////////////////////////// + // sparql modul methods // + //////////////////////////////////// + + @WebMethod - public String[] getTriples(int id, int componentID) throws ClientNotKnownException + public void startThread(int id, int componentID, String[] options) throws ClientNotKnownException { - ClientState state=getState(id); + final ClientState state = getState(id); + final Component component = state.getComponent(componentID); + String method=options[0]; + Thread thread=null; + if (method.equals("subjects")){ + final String label=options[1]; + final int limit=Integer.parseInt(options[2]); + thread = new Thread() { + @Override + public void run() { + ((SparqlEndpoint)component).setSubjectThread(this); + ((SparqlEndpoint)component).setSubjectThreadRunning(true); + ((SparqlEndpoint)component).calculateSubjects(label,limit); + ((SparqlEndpoint)component).setSubjectThreadRunning(false); + } + }; + } else if (method.equals("triples")){ + thread = new Thread() { + @Override + public void run() { + ((SparqlEndpoint)component).setTriplesThread(this); + ((SparqlEndpoint)component).setTriplesThreadRunning(true); + ((SparqlEndpoint)component).calculateTriples(); + ((SparqlEndpoint)component).setTriplesThreadRunning(false); + } + }; + } else if (method.equals("conceptSubjects")){ + final String concept=options[1]; + thread = new Thread() { + @Override + public void run() { + ((SparqlEndpoint)component).setConceptThread(this); + ((SparqlEndpoint)component).setConceptThreadRunning(true); + ((SparqlEndpoint)component).calculateConceptSubjects(concept); + ((SparqlEndpoint)component).setConceptThreadRunning(false); + } + }; + } + thread.start(); + } + + @WebMethod + public boolean isThreadRunning(int id, int componentID, String option) throws ClientNotKnownException + { + ClientState state = getState(id); Component component = state.getComponent(componentID); - return ((SparqlEndpoint)component).getTriples(); + if (option.equals("subjects")) + return ((SparqlEndpoint)component).subjectThreadIsRunning(); + else if (option.equals("triples")) + return ((SparqlEndpoint)component).triplesThreadIsRunning(); + else if (option.equals("conceptSubjects")) + return ((SparqlEndpoint)component).conceptThreadIsRunning(); + return true; } @WebMethod - public String[] getSubjects(int id, int componentID, String label, int limit) throws ClientNotKnownException + public void stopSparqlThread(int id, int componentID, String option) throws ClientNotKnownException { - ClientState state=getState(id); + ClientState state = getState(id); Component component = state.getComponent(componentID); - return ((SparqlEndpoint)component).getSubjects(label,limit); + if (option.equals("subjects")) + ((SparqlEndpoint)component).getSubjectThread().stop(); + else if (option.equals("triples")) + ((SparqlEndpoint)component).getTriplesThread().stop(); + else if (option.equals("conceptSubjects")) + ((SparqlEndpoint)component).getConceptThread().stop(); } @WebMethod - public String[] getSubjectsFromConcept(int id, int componentID, String concept) throws ClientNotKnownException + public String[] getFromSparql(int id, int componentID, String option) throws ClientNotKnownException { - ClientState state=getState(id); + ClientState state = getState(id); Component component = state.getComponent(componentID); - return ((SparqlEndpoint)component).getSubjectsFromConcept(concept); + if (option.equals("subjects")) + return ((SparqlEndpoint)component).getSubjects(); + else if (option.equals("triples")) + return ((SparqlEndpoint)component).getTriples(); + else if (option.equals("conceptSubjects")) + return ((SparqlEndpoint)component).getConceptSubjects(); + return new String[0]; } + + @WebMethod + public void debug(String deb) + { + System.out.println(deb); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-09 11:25:39
|
Revision: 354 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=354&view=rev Author: jenslehmann Date: 2008-01-09 03:25:03 -0800 (Wed, 09 Jan 2008) Log Message: ----------- - changed calls in DBpedia navigator and DLLearner web service to new SPARQL component - basic search functionality working (learning not working yet) - code improvements Modified Paths: -------------- trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/clearsession.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/images/ajax-loader.gif Removed Paths: ------------- trunk/src/dbpedia-navigator/SparqlConnection.php trunk/src/dbpedia-navigator/ajax-loader.gif Copied: trunk/src/dbpedia-navigator/DLLearnerConnection.php (from rev 351, trunk/src/dbpedia-navigator/SparqlConnection.php) =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php (rev 0) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 11:25:03 UTC (rev 354) @@ -0,0 +1,243 @@ +<?php + +class DLLearnerConnection +{ + private $DBPediaUrl; + private $DLLearnerUri; + private $client; + private $id; + private $ksID; + + function DLLearnerConnection($DBPediaUrl,$DLLearnerUri,$id=0,$ksID=0) + { + ini_set('default_socket_timeout',200); + $this->DBPediaUrl=$DBPediaUrl; + $this->DLLearnerUri=$DLLearnerUri; + $this->client=new SoapClient("main.wsdl"); + $this->id=$id; + $this->ksID=$ksID; + } + + function getIDs() + { + $id=$this->client->generateID(); + $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->DBPediaUrl); + return array(0 => $id, 1 => $ksID); + } + + function test() + { + $object=$this->client->test($this->id,$this->ksID); + return $object->item; + } + + function getConceptFromExamples($ttl,$posExamples,$negExamples) + { + $this->client->applyConfigEntryInt($this->id, $this->ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); + $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); + $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); + $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); + + $this->client->setReasoner($this->id, "dig"); + $this->client->setLearningProblem($this->id, "posNegDefinition"); + $this->client->setPositiveExamples($this->id, $posExamples); + $this->client->setNegativeExamples($this->id, $negExamples); + $this->client->setLearningAlgorithm($this->id, "refinement"); + + $start = microtime(true); + + $this->client->init($this->id); + + $threaded=true; + + if($threaded == false) { + + $concept = $this->client->learn($this->id); + + } else { + + $this->client->learnThreaded($this->id); + + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see what we have learned so far + $concept=$this->client->getCurrentlyBestConcept($this->id); + $running=$this->client->isAlgorithmRunning($this->id); + + $seconds = $i * $sleeptime; + + $i++; + } while($seconds<$ttl&&$running); + + $this->client->stop($this->id); + } + return $concept; + } + + function getTriples($ttl,$individual) + { + $options=array("triples",$individual); + $this->client->startThread($this->id,$this->ksID,$options); + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($this->id,$this->ksID,"triples")) + { + $object=$this->client->getFromSparql($this->id,$this->ksID,"triples"); + $array=$object->item; + if (count($array)==1) return $array; + $ret=array(); + foreach ($array as $element) + { + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + $ret[$items[0]]=$items[1]; + } + return $ret; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($this->id,$this->ksID,"triples"); + return array(); + } + + function getSubjects($ttl,$label) + { + $options=array("subjects",$label,15); + $this->client->startThread($this->id,$this->ksID,$options); + $i = 1; + $sleeptime = 1; + + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($this->id,$this->ksID,"subjects")) + { + $object=$this->client->getFromSparql($this->id,$this->ksID,"subjects"); + return $object->item; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($this->id,$this->ksID,"subjects"); + return array(); + } + + function getSubjectsFromConcept($ttl,$concept) + { + $options=array("conceptSubjects",$concept); + $this->client->startThread($this->id,$this->ksID,$options); + $i = 1; + $sleeptime = 1; + do { + // sleep a while + sleep($sleeptime); + + // see if algorithm is running + if (!$this->client->isThreadRunning($this->id,$this->ksID,"conceptSubjects")) + { + $object=$this->client->getFromSparql($this->id,$this->ksID,"conceptSubjects"); + return $object->item; + } + + $seconds = $i * $sleeptime; + $i++; + } while($seconds<$ttl); + + $this->client->stopSparqlThread($this->id,$this->ksID,"conceptSubjects"); + return array(); + } + + public function loadWSDLfiles($wsdluri){ + $main=DLLearnerConnection::getwsdl($wsdluri); + $other=DLLearnerConnection::getOtherWSDL($main); + $newMain=DLLearnerConnection::changeWSDL($main); + DLLearnerConnection::writeToFile("main.wsdl",$newMain); + $x=0; + foreach ($other as $o){ + DLLearnerConnection::writeToFile("def".($x++).".xsd",DLLearnerConnection::getwsdl($o)); + } + + } + + private function changeWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $newWSDL=""; + $desca="def"; + $descb=".xsd"; + $x=0; + while($posstart= strpos ( $wsdl, $before )){ + + $posstart+=strlen($before); + $newWSDL.=substr($wsdl,0,$posstart); + $wsdl=substr($wsdl,$posstart); + $newWSDL.=$desca.($x++).$descb; + $posend= strpos ( $wsdl, $after ); + $wsdl=substr($wsdl,$posend); + + } + return $newWSDL.$wsdl; + + } + + private function getOtherWSDL($wsdl){ + $before="<xsd:import schemaLocation=\""; + $after="\" namespace=\""; + $ret=array(); + while($posstart= strpos ( $wsdl, $before )){ + $posstart+=strlen($before); + $wsdl=substr($wsdl,$posstart); + $posend= strpos ( $wsdl, $after ); + $tmp=substr($wsdl,0,$posend); + $ret[]=$tmp; + $wsdl=substr($wsdl,$posend+strlen($after)); + } + return $ret; + } + + + + + private function getwsdl($wsdluri){ + // this is copied from the Pear example + // please don't ask me how it works + $req = &new HTTP_Request($wsdluri); + $message=""; + $req->setMethod(HTTP_REQUEST_METHOD_GET); + $req->sendRequest(); + $ret=$req->getResponseBody(); + return $ret; + } + + + + private function writeToFile($filename,$content){ + + $fp=fopen($filename,"w"); + fwrite($fp,$content); + fclose($fp); + + } +} +?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/Settings.php 2008-01-09 11:25:03 UTC (rev 354) @@ -1,8 +1,12 @@ <?php class Settings{ - public $wsdluri="http://localhost:8181/services?wsdl"; - public $dbpediauri="http://localhost:8890/sparql"; + public $wsdluri='http://localhost:8181/services?wsdl'; + // local OpenLink SPARQL endpoint + // public $dbpediauri="http://localhost:8890/sparql"; + // public DBpedia SPARQL endpoint + public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; public $sparqlttl=60; -} +} + ?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/SparqlConnection.php =================================================================== --- trunk/src/dbpedia-navigator/SparqlConnection.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/SparqlConnection.php 2008-01-09 11:25:03 UTC (rev 354) @@ -1,243 +0,0 @@ -<?php - -class SparqlConnection -{ - private $DBPediaUrl; - private $DLLearnerUri; - private $client; - private $id; - private $ksID; - - function SparqlConnection($DBPediaUrl,$DLLearnerUri,$id=0,$ksID=0) - { - ini_set('default_socket_timeout',200); - $this->DBPediaUrl=$DBPediaUrl; - $this->DLLearnerUri=$DLLearnerUri; - $this->client=new SoapClient("main.wsdl"); - $this->id=$id; - $this->ksID=$ksID; - } - - function getIDs() - { - $id=$this->client->generateID(); - $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->DBPediaUrl); - return array(0 => $id, 1 => $ksID); - } - - function test() - { - $object=$this->client->test($this->id,$this->ksID); - return $object->item; - } - - function getConceptFromExamples($ttl,$posExamples,$negExamples) - { - $this->client->applyConfigEntryInt($this->id, $this->ksID, "numberOfRecursions", 2); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); - $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); - $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); - - $this->client->setReasoner($this->id, "dig"); - $this->client->setLearningProblem($this->id, "posNegDefinition"); - $this->client->setPositiveExamples($this->id, $posExamples); - $this->client->setNegativeExamples($this->id, $negExamples); - $this->client->setLearningAlgorithm($this->id, "refinement"); - - $start = microtime(true); - - $this->client->init($this->id); - - $threaded=true; - - if($threaded == false) { - - $concept = $this->client->learn($this->id); - - } else { - - $this->client->learnThreaded($this->id); - - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see what we have learned so far - $concept=$this->client->getCurrentlyBestConcept($this->id); - $running=$this->client->isAlgorithmRunning($this->id); - - $seconds = $i * $sleeptime; - - $i++; - } while($seconds<$ttl&&$running); - - $this->client->stop($this->id); - } - return $concept; - } - - function getTriples($ttl,$individual) - { - $options=array("triples",$individual); - $this->client->startThread($this->id,$this->ksID,$options); - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see if algorithm is running - if (!$this->client->isThreadRunning($this->id,$this->ksID,"triples")) - { - $object=$this->client->getFromSparql($this->id,$this->ksID,"triples"); - $array=$object->item; - if (count($array)==1) return $array; - $ret=array(); - foreach ($array as $element) - { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[$items[0]]=$items[1]; - } - return $ret; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$ttl); - - $this->client->stopSparqlThread($this->id,$this->ksID,"triples"); - return array(); - } - - function getSubjects($ttl,$label) - { - $options=array("subjects",$label,15); - $this->client->startThread($this->id,$this->ksID,$options); - $i = 1; - $sleeptime = 1; - - do { - // sleep a while - sleep($sleeptime); - - // see if algorithm is running - if (!$this->client->isThreadRunning($this->id,$this->ksID,"subjects")) - { - $object=$this->client->getFromSparql($this->id,$this->ksID,"subjects"); - return $object->item; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$ttl); - - $this->client->stopSparqlThread($this->id,$this->ksID,"subjects"); - return array(); - } - - function getSubjectsFromConcept($ttl,$concept) - { - $options=array("conceptSubjects",$concept); - $this->client->startThread($this->id,$this->ksID,$options); - $i = 1; - $sleeptime = 1; - do { - // sleep a while - sleep($sleeptime); - - // see if algorithm is running - if (!$this->client->isThreadRunning($this->id,$this->ksID,"conceptSubjects")) - { - $object=$this->client->getFromSparql($this->id,$this->ksID,"conceptSubjects"); - return $object->item; - } - - $seconds = $i * $sleeptime; - $i++; - } while($seconds<$ttl); - - $this->client->stopSparqlThread($this->id,$this->ksID,"conceptSubjects"); - return array(); - } - - public function loadWSDLfiles($wsdluri){ - $main=SparqlConnection::getwsdl($wsdluri); - $other=SparqlConnection::getOtherWSDL($main); - $newMain=SparqlConnection::changeWSDL($main); - SparqlConnection::writeToFile("main.wsdl",$newMain); - $x=0; - foreach ($other as $o){ - SparqlConnection::writeToFile("def".($x++).".xsd",SparqlConnection::getwsdl($o)); - } - - } - - private function changeWSDL($wsdl){ - $before="<xsd:import schemaLocation=\""; - $after="\" namespace=\""; - $newWSDL=""; - $desca="def"; - $descb=".xsd"; - $x=0; - while($posstart= strpos ( $wsdl, $before )){ - - $posstart+=strlen($before); - $newWSDL.=substr($wsdl,0,$posstart); - $wsdl=substr($wsdl,$posstart); - $newWSDL.=$desca.($x++).$descb; - $posend= strpos ( $wsdl, $after ); - $wsdl=substr($wsdl,$posend); - - } - return $newWSDL.$wsdl; - - } - - private function getOtherWSDL($wsdl){ - $before="<xsd:import schemaLocation=\""; - $after="\" namespace=\""; - $ret=array(); - while($posstart= strpos ( $wsdl, $before )){ - $posstart+=strlen($before); - $wsdl=substr($wsdl,$posstart); - $posend= strpos ( $wsdl, $after ); - $tmp=substr($wsdl,0,$posend); - $ret[]=$tmp; - $wsdl=substr($wsdl,$posend+strlen($after)); - } - return $ret; - } - - - - - private function getwsdl($wsdluri){ - // this is copied from the Pear example - // please don't ask me how it works - $req = &new HTTP_Request($wsdluri); - $message=""; - $req->setMethod(HTTP_REQUEST_METHOD_GET); - $req->sendRequest(); - $ret=$req->getResponseBody(); - return $ret; - } - - - - private function writeToFile($filename,$content){ - - $fp=fopen($filename,"w"); - fwrite($fp,$content); - fclose($fp); - - } -} -?> \ No newline at end of file Deleted: trunk/src/dbpedia-navigator/ajax-loader.gif =================================================================== (Binary files differ) Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 11:25:03 UTC (rev 354) @@ -10,9 +10,9 @@ function getsubjects($label) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; $subjects=$sc->getSubjects($settings->sparqlttl,$label); @@ -46,9 +46,9 @@ } if ($fromCache==-1) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $triples=$sc->getTriples($settings->sparqlttl,$subject); $content=""; if (count($triples)==1) @@ -157,9 +157,9 @@ if (isset($_SESSION['positive'])&&isset($_SESSION['negative'])) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); $_SESSION['lastLearnedConcept']=$concept; @@ -175,9 +175,9 @@ function getSubjectsFromConcept() { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; if (isset($_SESSION['lastLearnedConcept'])) @@ -206,10 +206,10 @@ function searchAndShowArticle($keyword) { require_once("Settings.php"); - require_once("SparqlConnection.php"); + require_once("DLLearnerConnection.php"); $settings=new Settings(); - $sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); + $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); $content=""; Modified: trunk/src/dbpedia-navigator/clearsession.php =================================================================== --- trunk/src/dbpedia-navigator/clearsession.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/clearsession.php 2008-01-09 11:25:03 UTC (rev 354) @@ -4,10 +4,10 @@ session_unset(); ob_start(); require_once 'pear/HTTP_Request.php'; -require_once 'SparqlConnection.php'; +require_once 'DLLearnerConnection.php'; require_once 'Settings.php'; $settings=new Settings(); -SparqlConnection::loadWSDLfiles($settings->wsdluri); +DLLearnerConnection::loadWSDLfiles($settings->wsdluri); $index_uri = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).'/index.php'; header('Location: ' . $index_uri); ?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 11:25:03 UTC (rev 354) @@ -18,14 +18,15 @@ p { margin: 8px 0; } - -h2 { - margin: 0.5em 0 0.1em 0; -/* background-color: #eee;*/ - font-size: 110%; + +h1 { + margin: 0.2em; } + +h2 { + margin: 0.1em; +} - /* * Main site structure */ @@ -66,8 +67,11 @@ #clear { clear: both; } + +#validation { + padding: 0.5em; +} - /* * sidebar content (boxes) */ @@ -181,7 +185,7 @@ a, a:link, a:visited { color: #02a; text-decoration: none; - cursor: pointer; + /* cursor: pointer; */ } a:hover { Copied: trunk/src/dbpedia-navigator/images/ajax-loader.gif (from rev 351, trunk/src/dbpedia-navigator/ajax-loader.gif) =================================================================== (Binary files differ) Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 11:25:03 UTC (rev 354) @@ -1,12 +1,14 @@ -<?php +<?php + ini_set('error_reporting',E_ALL); ini_set('max_execution_time',200); -ini_set("soap.wsdl_cache_enabled","1"); +ini_set("soap.wsdl_cache_enabled","1"); + session_start(); require_once('Settings.php'); -require_once('SparqlConnection.php'); +require_once('DLLearnerConnection.php'); $settings=new Settings(); -$sc=new SparqlConnection($settings->dbpediauri,$settings->wsdluri); +$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); $ids=$sc->getIDs(); $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; @@ -20,7 +22,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> - <title>DL Learner</title> + <title>DBpedia Navigator</title> <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" href="default.css"/> <?php $xajax->printJavascript('xajax/'); ?> @@ -60,95 +62,99 @@ </script> </head> <body> + <p><a href='clearsession.php'>start from scratch</a></p> -<h3>DBPedia-Navigator-Test</h3> -<div id="layer" style="display:none"><div id="layerContent" style="display:none"></div></div> +<h1>DBPedia Navigator</h1> +<div id="layer" style="display:none"> + <div id="layerContent" style="display:none"></div> +</div> <div id="wrapper"> -<div id="leftSidebar"> + <div id="leftSidebar"> -<div class="box"> - <div class="boxtitle">Search</div> - <div class="boxcontent" id="search"> - Search:<br/> - <input type="text" name="label" id="label" /><br/> - <input type="button" value="Article" class="button" onclick="xajax_searchAndShowArticle(document.getElementById('label').value);return false;" /> - <input type="button" value="Fulltext" class="button" onclick=""/> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitle">Search DBpedia</div> + <div class="boxcontent" id="search"> + <!-- Search:<br/> --> + <input type="text" name="label" id="label" /><br/> + <input type="button" value="Search" class="button" onclick="xajax_searchAndShowArticle(document.getElementById('label').value);return false;" /> + <!-- <input type="button" value="Fulltext" class="button" onclick=""/> --> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box"> - <div class="boxtitle">Searchresults</div> - <div class="boxcontent"> - <div id="searchcontent" style="display:block"></div> - <div id="loadingSubject" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitle">Search Results</div> + <div class="boxcontent"> + <div id="searchcontent" style="display:block"></div> + <div id="loadingSubject" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box" id="concept"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Learned Concept</td><td class="right"><input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /></td></tr></table></div> - <div class="boxcontent"> - <div id="conceptcontent" style="display:none"></div> - <div id="loadingConcept" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box" id="concept"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Learned Concept</td><td class="right"><input type="button" value="Learn" class="button" onclick="xajax_learnConcept();return false;" /></td></tr></table></div> + <div class="boxcontent"> + <div id="conceptcontent" style="display:none"></div> + <div id="loadingConcept" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box" id="conceptSubjects"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Subjects From Concept</td><td class="right"><input type="button" value="Show" class="button" onclick="xajax_getSubjectsFromConcept();return false;" /></td></tr></table></div> - <div class="boxcontent"> - <div id="conceptsubjectcontent" style="display:none"></div> - <div id="loadingConceptSubjects" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box" id="conceptSubjects"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Subjects From Concept</td><td class="right"><input type="button" value="Show" class="button" onclick="xajax_getSubjectsFromConcept();return false;" /></td></tr></table></div> + <div class="boxcontent"> + <div id="conceptsubjectcontent" style="display:none"></div> + <div id="loadingConceptSubjects" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> + + <div id="validation"> + <?php + $uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; + + echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; + echo '><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; + echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; + echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; + ?> + </div> + + </div><!-- END leftSidebar --> -<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> -</div><!-- END leftSidebar --> + <div id="content"> + <div class="box"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left" id="ArticleTitle">Article</td><td class="right"><span id="contentbuttons"></span></td></tr></table></div> + <div class="boxcontent" id="article"> + <div id="articlecontent" style="display:block"></div> + <div id="loadingArticle" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> + </div> <!-- boxcontent --> + </div> <!-- box --> + </div><!-- content --> + + <div id="rightSidebar"> -<div id="content"> -<div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left" id="ArticleTitle">Article</td><td class="right"><span id="contentbuttons"></span></td></tr></table></div> - <div class="boxcontent" id="article"> - <div id="articlecontent" style="display:block"></div> - <div id="loadingArticle" style="display:none"><img src="ajax-loader.gif" alt="Loading..."/></div> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Positives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></td></tr></table></div> + <div class="boxcontent" id="Positives"> + </div> <!-- boxcontent --> + </div> <!-- box --> -<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> -</div><!-- content --> -<div id="rightSidebar"> + <div class="box"> + <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Negatives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></td></tr></table></div> + <div class="boxcontent" id="Negatives"> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Positives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></td></tr></table></div> - <div class="boxcontent" id="Positives"> - </div> <!-- boxcontent --> -</div> <!-- box --> + <div class="box"> + <div class="boxtitle">Last Articles</div> + <div class="boxcontent" id="lastarticles"> + </div> <!-- boxcontent --> + </div> <!-- box --> -<div class="box"> - <div class="boxtitlewithbutton"><table border="0" class="titletable"><tr><td class="left">Negatives</td><td class="right"><input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></td></tr></table></div> - <div class="boxcontent" id="Negatives"> - </div> <!-- boxcontent --> -</div> <!-- box --> - -<div class="box"> - <div class="boxtitle">Last Articles</div> - <div class="boxcontent" id="lastarticles"> - </div> <!-- boxcontent --> -</div> <!-- box --> - -<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /> -</div><!-- rightSidebar --> -<div id="clear"></div> -</div> -<?php + </div><!-- rightSidebar --> + + <!-- <div id="clear"></div> --> + -$uri = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; - -echo '<div><a href="http://validator.w3.org/check?uri='.$uri.'"'; -echo '><img src="images/valid-xhtml10.png" alt="valid XHTML 1.0" /></a>'."\n"; -echo '<a href="http://jigsaw.w3.org/css-validator/validator?uri='.$uri.'"'; -echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; - -?> - + +</div><!-- wrapper --> </body> </html> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-09 09:37:00 UTC (rev 353) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-09 11:25:03 UTC (rev 354) @@ -46,6 +46,7 @@ import org.dllearner.core.dl.Individual; import org.dllearner.kb.OWLFile; import org.dllearner.kb.SparqlEndpoint; +import org.dllearner.kb.SparqlEndpointRestructured; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; @@ -59,7 +60,6 @@ * DL-Learner web service interface. * * @author Jens Lehmann - * @author Sebastian Hellmann * */ @WebService(name = "DLLearnerWebService") @@ -79,7 +79,8 @@ public DLLearnerWS() { knowledgeSourceMapping.put("owlfile", OWLFile.class); - knowledgeSourceMapping.put("sparql", SparqlEndpoint.class); + knowledgeSourceMapping.put("sparqlold", SparqlEndpoint.class); + knowledgeSourceMapping.put("sparql", SparqlEndpointRestructured.class); reasonerMapping.put("dig", DIGReasoner.class); learningProblemMapping.put("posNegDefinition", PosNegDefinitionLP.class); learningProblemMapping.put("posNegInclusion", PosNegInclusionLP.class); @@ -460,11 +461,10 @@ return Datastructures.sortedSet2StringListIndividuals(individuals); } - //////////////////////////////////// - // sparql modul methods // - //////////////////////////////////// + //////////////////////////////////////// + // SPARQL component methods // + //////////////////////////////////////// - @WebMethod public void startThread(int id, int componentID, String[] options) throws ClientNotKnownException { @@ -478,10 +478,10 @@ thread = new Thread() { @Override public void run() { - ((SparqlEndpoint)component).setSubjectThread(this); - ((SparqlEndpoint)component).setSubjectThreadRunning(true); - ((SparqlEndpoint)component).calculateSubjects(label,limit); - ((SparqlEndpoint)component).setSubjectThreadRunning(false); + ((SparqlEndpointRestructured)component).setSubjectThread(this); + ((SparqlEndpointRestructured)component).setSubjectThreadRunning(true); + ((SparqlEndpointRestructured)component).calculateSubjects(label,limit); + ((SparqlEndpointRestructured)component).setSubjectThreadRunning(false); } }; } else if (method.equals("triples")){ @@ -489,10 +489,10 @@ thread = new Thread() { @Override public void run() { - ((SparqlEndpoint)component).setTriplesThread(this); - ((SparqlEndpoint)component).setTriplesThreadRunning(true); - ((SparqlEndpoint)component).calculateTriples(subject); - ((SparqlEndpoint)component).setTriplesThreadRunning(false); + ((SparqlEndpointRestructured)component).setTriplesThread(this); + ((SparqlEndpointRestructured)component).setTriplesThreadRunning(true); + ((SparqlEndpointRestructured)component).calculateTriples(subject); + ((SparqlEndpointRestructured)component).setTriplesThreadRunning(false); } }; } else if (method.equals("conceptSubjects")){ @@ -500,10 +500,10 @@ thread = new Thread() { @Override public void run() { - ((SparqlEndpoint)component).setConceptThread(this); - ((SparqlEndpoint)component).setConceptThreadRunning(true); - ((SparqlEndpoint)component).calculateConceptSubjects(concept); - ((SparqlEndpoint)component).setConceptThreadRunning(false); + ((SparqlEndpointRestructured)component).setConceptThread(this); + ((SparqlEndpointRestructured)component).setConceptThreadRunning(true); + ((SparqlEndpointRestructured)component).calculateConceptSubjects(concept); + ((SparqlEndpointRestructured)component).setConceptThreadRunning(false); } }; } @@ -516,11 +516,11 @@ ClientState state = getState(id); Component component = state.getComponent(componentID); if (option.equals("subjects")) - return ((SparqlEndpoint)component).subjectThreadIsRunning(); + return ((SparqlEndpointRestructured)component).subjectThreadIsRunning(); else if (option.equals("triples")) - return ((SparqlEndpoint)component).triplesThreadIsRunning(); + return ((SparqlEndpointRestructured)component).triplesThreadIsRunning(); else if (option.equals("conceptSubjects")) - return ((SparqlEndpoint)component).conceptThreadIsRunning(); + return ((SparqlEndpointRestructured)component).conceptThreadIsRunning(); return true; } @@ -530,11 +530,11 @@ ClientState state = getState(id); Component component = state.getComponent(componentID); if (option.equals("subjects")) - ((SparqlEndpoint)component).getSubjectThread().stop(); + ((SparqlEndpointRestructured)component).getSubjectThread().stop(); else if (option.equals("triples")) - ((SparqlEndpoint)component).getTriplesThread().stop(); + ((SparqlEndpointRestructured)component).getTriplesThread().stop(); else if (option.equals("conceptSubjects")) - ((SparqlEndpoint)component).getConceptThread().stop(); + ((SparqlEndpointRestructured)component).getConceptThread().stop(); } @WebMethod @@ -543,11 +543,11 @@ ClientState state = getState(id); Component component = state.getComponent(componentID); if (option.equals("subjects")) - return ((SparqlEndpoint)component).getSubjects(); + return ((SparqlEndpointRestructured)component).getSubjects(); else if (option.equals("triples")) - return ((SparqlEndpoint)component).getTriples(); + return ((SparqlEndpointRestructured)component).getTriples(); else if (option.equals("conceptSubjects")) - return ((SparqlEndpoint)component).getConceptSubjects(); + return ((SparqlEndpointRestructured)component).getConceptSubjects(); return new String[0]; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-09 17:55:29
|
Revision: 357 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=357&view=rev Author: jenslehmann Date: 2008-01-09 09:55:25 -0800 (Wed, 09 Jan 2008) Log Message: ----------- fixed bug which caused some triples not to appear Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/default.css trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-09 17:55:25 UTC (rev 357) @@ -103,8 +103,12 @@ $ret=array(); foreach ($array as $element) { - $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); - $ret[$items[0]]=$items[1]; + $items=preg_split("[<]",$element,-1, PREG_SPLIT_NO_EMPTY); + + // each property can occur multiple times (!) + // bug: $ret[$items[0]]=$items[1]; + + $ret[$items[0]][] = $items[1]; } return $ret; } Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-09 17:55:25 UTC (rev 357) @@ -68,14 +68,14 @@ // display a picture if there is one if(isset($triples['http://xmlns.com/foaf/0.1/depiction'])) - $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; + $content.='<img src="'.$triples['http://xmlns.com/foaf/0.1/depiction'][0].'" alt="Picture of '.$subject_nice.'" style="float:right; max-width:200px;" \>'; // add short description in english - $content.="<h3>Short Description</h3><p>".urldecode($triples['http://dbpedia.org/property/abstract'])."</p>"; + $content.="<h4>Short Description</h4><p>".urldecode($triples['http://dbpedia.org/property/abstract'][0])."</p>"; // give the link to the corresponding Wikipedia article if(isset($triples['http://xmlns.com/foaf/0.1/page'])) - $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'].'">view Wikipedia article</a>, '; + $content .= '<p><img src="images/wikipedia_favicon.png" alt"Wikipedia" /> <a href="'.$triples['http://xmlns.com/foaf/0.1/page'][0].'">view Wikipedia article</a>, '; $content .= '<a href="'.$subject.'">view DBpedia resource description</a></p>'; // display a list of classes @@ -248,9 +248,15 @@ // helper function function get_triple_table($triples) { + $table = '<table border="1"><tr><td>predicate</td><td>object</td></tr>'; foreach($triples as $predicate=>$object) { - $table .= '<tr><td>'.$predicate.'</td><td>'.$object.'</td></tr>'; + $table .= '<tr><td>'.$predicate.'</td>'; + $table .= '<td><ul>'; + foreach($object as $element) { + $table .= '<li>'.$element.'</li>'; + } + $table .= '</ul></td>'; } $table .= '</table>'; return $table; Modified: trunk/src/dbpedia-navigator/default.css =================================================================== --- trunk/src/dbpedia-navigator/default.css 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/default.css 2008-01-09 17:55:25 UTC (rev 357) @@ -12,7 +12,7 @@ } html { - font: 80%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; + font: 85%/1.2 "Lucida Grande", Helvetica, Arial, sans-serif; } p { @@ -367,7 +367,8 @@ } #ArticleTitle { - font-size: 110%; + font-size: 150%; + color:black; } #footer { Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dbpedia-navigator/index.php 2008-01-09 17:55:25 UTC (rev 357) @@ -12,6 +12,12 @@ $ids=$sc->getIDs(); $_SESSION['id']=$ids[0]; $_SESSION['ksID']=$ids[1]; + +// debugging code +// echo '<pre>'; +// $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); +// print_r($sc->getTriples($settings->sparqlttl,'http://dbpedia.org/resource/Dog')); +// echo '</pre>'; require("ajax.php"); @@ -184,6 +190,9 @@ <li>get local DBpedia SPARQL endpoint working</li> <li>many queries work correctly on the server, but yield to response in the interface (seems to be rather random)</li> <li>fix sometimes occurring PHP errors and warnings</li> + <li>would be interesting to somehow view the Wikipedia article (without the left navigation part, + tabs etc.) as an overlay, because the Wikipedia article will almost always be a human-friendlier + description of an object compared to the extracted one</li> </ul> </p> </div> Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-09 16:32:14 UTC (rev 356) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-09 17:55:25 UTC (rev 357) @@ -47,7 +47,7 @@ boolean print_flag=false; SparqlQueryMaker q; - SparqlCache c; + SparqlCache cache; URL url; SparqlFilter sf; String[] subjectList; @@ -90,7 +90,7 @@ this.numberOfRecursions=numberOfRecursions; this.format=format; this.q=new SparqlQueryMaker(); - this.c=new SparqlCache("cache"); + this.cache=new SparqlCache("cache"); if(defClasses!=null && defClasses.length>0 ){ this.defaultClasses=defClasses; } @@ -108,7 +108,7 @@ public SparqlOntologyCollector(URL url) { this.q=new SparqlQueryMaker(); - this.c=new SparqlCache("cache"); + this.cache=new SparqlCache("cache"); this.url=url; } @@ -131,16 +131,16 @@ public String[] collectTriples(String subject) throws IOException{ System.out.println("Searching for Article: "+subject); String sparql=q.makeArticleQuery(subject); - String FromCache=c.get(subject, sparql); + String fromCache=cache.get(subject, sparql); String xml; // if not in cache get it from dbpedia - if(FromCache==null){ + if(fromCache==null){ xml=sendAndReceive(sparql); - c.put(subject, xml, sparql); + cache.put(subject, xml, sparql); System.out.print("\n"); } else{ - xml=FromCache; + xml=fromCache; System.out.println("FROM CACHE"); } @@ -181,12 +181,12 @@ public String[] getSubjectsFromLabel(String label, int limit) throws IOException{ System.out.println("Searching for Label: "+label); String sparql=q.makeLabelQuery(label,limit); - String FromCache=c.get(label, sparql); + String FromCache=cache.get(label, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(label, xml, sparql); + cache.put(label, xml, sparql); System.out.print("\n"); } else{ @@ -201,12 +201,12 @@ { System.out.println("Searching for Subjects of type: "+concept); String sparql=q.makeConceptQuery(concept); - String FromCache=c.get(concept, sparql); + String FromCache=cache.get(concept, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(concept, xml, sparql); + cache.put(concept, xml, sparql); System.out.print("\n"); } else{ @@ -242,12 +242,12 @@ String sparql=q.makeQueryFilter(StartingSubject,this.sf); // checks cache - String FromCache=c.get(StartingSubject, sparql); + String FromCache=cache.get(StartingSubject, sparql); String xml; // if not in cache get it from dbpedia if(FromCache==null){ xml=sendAndReceive(sparql); - c.put(StartingSubject, xml, sparql); + cache.put(StartingSubject, xml, sparql); System.out.print("\n"); } else{ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-10 16:34:02
|
Revision: 362 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=362&view=rev Author: jenslehmann Date: 2008-01-10 08:30:32 -0800 (Thu, 10 Jan 2008) Log Message: ----------- - enabled lazy ReasoningService initialisation - fixed some learning bugs in DBpedia Navigator (learning still not working) Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-client/testnew.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 16:30:32 UTC (rev 362) @@ -1,11 +1,23 @@ <?php +/** + * Encapsulates all functions, which require communication with DL-Learner. + * + * @author Jens Lehmann + * @author Sebastian Knappe + */ class DLLearnerConnection { private $DBPediaUrl; private $DLLearnerUri; + + // private $client; + + // ID given to this client by the web service private $id; + + // ID of the DBpedia knowledge source private $ksID; function DLLearnerConnection($DBPediaUrl,$DLLearnerUri,$id=0,$ksID=0) @@ -33,9 +45,9 @@ function getConceptFromExamples($ttl,$posExamples,$negExamples) { - $this->client->applyConfigEntryInt($this->id, $this->ksID, "numberOfRecursions", 2); + $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth", 2); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); + // $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); @@ -43,9 +55,13 @@ $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); $this->client->setReasoner($this->id, "dig"); - $this->client->setLearningProblem($this->id, "posNegDefinition"); + if(!isset($negExamples)) + $this->client->setLearningProblem($this->id, "posOnlyDefinition"); + else + $this->client->setLearningProblem($this->id, "posNegDefinition"); $this->client->setPositiveExamples($this->id, $posExamples); - $this->client->setNegativeExamples($this->id, $negExamples); + if(isset($negExamples)) + $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); $start = microtime(true); Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 16:30:32 UTC (rev 362) @@ -181,7 +181,7 @@ function learnConcept() { - if (isset($_SESSION['positive'])&&isset($_SESSION['negative'])) + if (isset($_SESSION['positive'])) { require_once("Settings.php"); require_once("DLLearnerConnection.php"); @@ -192,7 +192,7 @@ $_SESSION['lastLearnedConcept']=$concept; if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } - else $concept="You must choose at least one<br/> positive and one negative example."; + else $concept="You must choose at least one<br/> positive example."; $objResponse = new xajaxResponse(); $objResponse->assign("conceptcontent", "innerHTML", $concept); Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 16:30:32 UTC (rev 362) @@ -92,9 +92,12 @@ public ReasoningService(ReasonerComponent reasoner) { this.reasoner = reasoner; - // list view - atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); - atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); + // list view: the following two lines are commented out, because otherwise the ReasonerComponent + // already has to be initialised when a ReasoningService instance is created; this is problematic + // e.g. for the web service interface, which does not expose the ReasoningService + // (because it is not a component itself) + // atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); + // atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); resetStatistics(); } @@ -428,10 +431,12 @@ } public List<AtomicConcept> getAtomicConceptsList() { + // not working, see message in constructor return atomicConceptsList; } public List<AtomicRole> getAtomicRolesList() { + // not working, see message in constructor return atomicRolesList; } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-10 16:30:32 UTC (rev 362) @@ -239,7 +239,7 @@ * @param id Session ID. */ @WebMethod - public void init(int id) throws ClientNotKnownException { + public void initAll(int id) throws ClientNotKnownException { ClientState state = getState(id); for(KnowledgeSource ks : state.getKnowledgeSources()) ks.init(); @@ -249,6 +249,20 @@ } /** + * Initialise the specified component. + * @param id Session-ID. + * @param componentID Component-ID. + * @throws ClientNotKnownException Thrown if the client ID is nor registered. + * @throws UnknownComponentException Thrown if the component is unknown. + */ + @WebMethod + public void init(int id, int componentID) throws ClientNotKnownException, UnknownComponentException { + ClientState state = getState(id); + Component component = state.getComponent(componentID); + component.init(); + } + + /** * Starts the learning algorithm and returns the best concept found. This * method will block until learning is completed. * Modified: trunk/src/php-client/testnew.php =================================================================== --- trunk/src/php-client/testnew.php 2008-01-10 09:12:48 UTC (rev 361) +++ trunk/src/php-client/testnew.php 2008-01-10 16:30:32 UTC (rev 362) @@ -6,6 +6,7 @@ $wsdluri="http://localhost:8181/services?wsdl"; $ontology="file:/home/jl/promotion/dl-learner-svn/trunk/examples/father.owl"; +// $ontology="file:/home/jl/programmierung/eclipse_workspace/DL-Learner-SVN/examples/father.owl"; $posExamples = array('http://example.com/father#stefan', 'http://example.com/father#markus', @@ -53,7 +54,7 @@ $start = microtime(true); -$client->init($id); +$client->initAll($id); $learn_start = microtime(true); $init = $learn_start - $start; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-11 09:23:52
|
Revision: 365 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=365&view=rev Author: jenslehmann Date: 2008-01-11 01:23:49 -0800 (Fri, 11 Jan 2008) Log Message: ----------- fixed some smaller problems Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 09:23:49 UTC (rev 365) @@ -55,18 +55,18 @@ $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); $this->client->setReasoner($this->id, "dig"); - if(!isset($negExamples)) + if(empty($negExamples)) $this->client->setLearningProblem($this->id, "posOnlyDefinition"); else $this->client->setLearningProblem($this->id, "posNegDefinition"); $this->client->setPositiveExamples($this->id, $posExamples); - if(isset($negExamples)) + if(!empty($negExamples)) $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); $start = microtime(true); - $this->client->init($this->id); + $this->client->initAll($this->id); $threaded=true; Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 09:23:49 UTC (rev 365) @@ -187,8 +187,11 @@ require_once("DLLearnerConnection.php"); $settings=new Settings(); $sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri,$_SESSION['id'],$_SESSION['ksID']); - - $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); + + if(isset($_SESSION['negative'])) + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'],$_SESSION['negative']); + else + $concept=$sc->getConceptFromExamples($settings->sparqlttl,$_SESSION['positive'], array()); $_SESSION['lastLearnedConcept']=$concept; if (strlen(substr (strrchr ($concept, "/"), 1))>0) $concept=urldecode(substr (strrchr ($concept, "/"), 1)); } Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-01-11 09:23:49 UTC (rev 365) @@ -21,6 +21,7 @@ package org.dllearner.core; import java.io.File; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Set; @@ -79,25 +80,22 @@ // private SortedSet<Concept> retrievalsSet = new TreeSet<Concept>(new ConceptComparator()); - // Caching f�r allgemeinere/speziellere atomare Konzepte => wird innerhalb der Reasoner gemacht - // private Map<Concept,Set<Concept>> moreGeneralConcepts = new HashMap<Concept,Set<Concept>>(); - // private Map<Concept,Set<Concept>> moreSpecialConcepts = new HashMap<Concept,Set<Concept>>(); - private Reasoner reasoner; - // note that you must not modify the underlying knowledge base of - // a reasoning service (if you do, you have to create a new reasoning - // service object) + /** + * Constructs a reasoning service object. Note that you must not + * modify the underlying knowledge base of a reasoning service + * (if you do, you have to create a new reasoning service object). + * Further note, that the initialisation is lazy, e.g. you can + * feed the constructor with a non-initialised reasoner component. + * However, of course you need to make sure that the resoner component + * is initialised before the first reasoner query. + * + * @param reasoner + */ public ReasoningService(ReasonerComponent reasoner) { this.reasoner = reasoner; - // list view: the following two lines are commented out, because otherwise the ReasonerComponent - // already has to be initialised when a ReasoningService instance is created; this is problematic - // e.g. for the web service interface, which does not expose the ReasoningService - // (because it is not a component itself) - // atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); - // atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); - resetStatistics(); } @@ -430,12 +428,14 @@ } public List<AtomicConcept> getAtomicConceptsList() { - // not working, see message in constructor + if(atomicConceptsList == null) + atomicConceptsList = new LinkedList<AtomicConcept>(getAtomicConcepts()); return atomicConceptsList; } public List<AtomicRole> getAtomicRolesList() { - // not working, see message in constructor + if(atomicRolesList == null) + atomicRolesList = new LinkedList<AtomicRole>(getAtomicRoles()); return atomicRolesList; } Modified: trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-10 18:52:03 UTC (rev 364) +++ trunk/src/dl-learner/org/dllearner/kb/SparqlOntologyCollector.java 2008-01-11 09:23:49 UTC (rev 365) @@ -46,7 +46,7 @@ public class SparqlOntologyCollector { boolean print_flag=false; - SparqlQueryMaker q; + SparqlQueryMaker queryMaker; SparqlCache cache; URL url; SparqlFilter sf; @@ -89,7 +89,7 @@ this.subjectList=subjectList; this.numberOfRecursions=numberOfRecursions; this.format=format; - this.q=new SparqlQueryMaker(); + this.queryMaker=new SparqlQueryMaker(); this.cache=new SparqlCache("cache"); if(defClasses!=null && defClasses.length>0 ){ this.defaultClasses=defClasses; @@ -107,7 +107,7 @@ public SparqlOntologyCollector(URL url) { - this.q=new SparqlQueryMaker(); + this.queryMaker=new SparqlQueryMaker(); this.cache=new SparqlCache("cache"); this.url=url; } @@ -130,7 +130,7 @@ public String[] collectTriples(String subject) throws IOException{ System.out.println("Searching for Article: "+subject); - String sparql=q.makeArticleQuery(subject); + String sparql=queryMaker.makeArticleQuery(subject); String fromCache=cache.get(subject, sparql); String xml; // if not in cache get it from dbpedia @@ -180,7 +180,7 @@ public String[] getSubjectsFromLabel(String label, int limit) throws IOException{ System.out.println("Searching for Label: "+label); - String sparql=q.makeLabelQuery(label,limit); + String sparql=queryMaker.makeLabelQuery(label,limit); String FromCache=cache.get(label, sparql); String xml; // if not in cache get it from dbpedia @@ -200,7 +200,7 @@ public String[] getSubjectsFromConcept(String concept) throws IOException { System.out.println("Searching for Subjects of type: "+concept); - String sparql=q.makeConceptQuery(concept); + String sparql=queryMaker.makeConceptQuery(concept); String FromCache=cache.get(concept, sparql); String xml; // if not in cache get it from dbpedia @@ -240,7 +240,7 @@ return; else {NumberofRecursions--;} - String sparql=q.makeQueryFilter(StartingSubject,this.sf); + String sparql=queryMaker.makeQueryFilter(StartingSubject,this.sf); // checks cache String FromCache=cache.get(StartingSubject, sparql); String xml; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-11 17:01:08
|
Revision: 367 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=367&view=rev Author: jenslehmann Date: 2008-01-11 09:01:00 -0800 (Fri, 11 Jan 2008) Log Message: ----------- basic learning in DBpedia Navigator working again Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dbpedia-navigator/Settings.php trunk/src/dbpedia-navigator/ajaxfunctions.php trunk/src/dbpedia-navigator/index.php trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dbpedia-navigator/rebuild.php Removed Paths: ------------- trunk/src/dbpedia-navigator/clearsession.php Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-11 17:01:00 UTC (rev 367) @@ -35,7 +35,7 @@ $id=$this->client->generateID(); $ksID=$this->client->addKnowledgeSource($id,"sparql",$this->DBPediaUrl); return array(0 => $id, 1 => $ksID); - } + } function test() { @@ -47,12 +47,11 @@ { $this->client->applyConfigEntryInt($this->id, $this->ksID, "recursionDepth", 2); $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "instances", array_merge($posExamples,$negExamples)); - // $this->client->applyConfigEntryInt($this->id, $this->ksID, "filterMode", 0); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); - $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); - $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); - $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); + // $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "predList", array()); + // $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "objList", array()); + // $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "classList", array()); + // $this->client->applyConfigEntryString($this->id, $this->ksID, "format", "KB"); + // $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "dumpToFile", true); $this->client->setReasoner($this->id, "dig"); if(empty($negExamples)) @@ -64,8 +63,8 @@ $this->client->setNegativeExamples($this->id, $negExamples); $this->client->setLearningAlgorithm($this->id, "refinement"); - $start = microtime(true); - + $start = microtime(true); + $this->client->initAll($this->id); $threaded=true; Modified: trunk/src/dbpedia-navigator/Settings.php =================================================================== --- trunk/src/dbpedia-navigator/Settings.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/Settings.php 2008-01-11 17:01:00 UTC (rev 367) @@ -1,11 +1,41 @@ <?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/>. + * + */ + +/** + * DBpedia navigator settings. + * + * @author Sebastian Knappe + * @author Jens Lehmann + */ +class Settings{ -class Settings{ public $wsdluri='http://localhost:8181/services?wsdl'; + // local OpenLink SPARQL endpoint // public $dbpediauri="http://localhost:8890/sparql"; // public DBpedia SPARQL endpoint - public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; + public $dbpediauri='http://dbpedia.openlinksw.com:8890/sparql'; + // public DBpedia mirror + // public $dbpediauri='http://dbpedia2.openlinksw.com:8890/isparql'; + public $sparqlttl=60; } Modified: trunk/src/dbpedia-navigator/ajaxfunctions.php =================================================================== --- trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/ajaxfunctions.php 2008-01-11 17:01:00 UTC (rev 367) @@ -81,7 +81,7 @@ // display a list of classes if(isset($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type'])) - $content .= '<p>Classes: '.array_to_comma($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; + $content .= '<p>classes: '.formatClassArray($triples['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']).'</p>'; // filter out uninteresting properties unset($triples['http://xmlns.com/foaf/0.1/page']); @@ -273,10 +273,34 @@ return $table; } -function array_to_comma_separated_list($ar) { +function formatClassArray($ar) { + $string = formatClass($ar[0]); + for($i=1; $i<count($ar); $i++) { + $string .= ', ' . formatClass($ar[$i]); + } + return $string; +} + +// format a class nicely, i.e. link to it and possibly display +// it in a better way +function formatClass($className) { + $yagoPrefix = 'http://dbpedia.org/class/yago/'; + if(substr($className,0,30)==$yagoPrefix) { + return '<a href="'.$className.'">'.substr($className,30).'</a>'; + // DBpedia is Linked Data, so it makes always sense to link it + // ToDo: instead of linking to other pages, the resource should better + // be openened within DBpedia Navigator + } else if(substr($className,0,14)=='http://dbpedia') { + return '<a href="'.$className.'">'.$className.'</a>'; + } else { + return $className; + } +} + +function arrayToCommaSseparatedList($ar) { $string = $ar[0]; for($i=1; $i<count($ar); $i++) { - $string .= $ar[$i] . ', '; + $string .= ', ' . $ar[$i]; } return $string; } Deleted: trunk/src/dbpedia-navigator/clearsession.php =================================================================== --- trunk/src/dbpedia-navigator/clearsession.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/clearsession.php 2008-01-11 17:01:00 UTC (rev 367) @@ -1,13 +0,0 @@ -<?php -session_start(); - -session_unset(); -ob_start(); -require_once 'pear/HTTP_Request.php'; -require_once 'DLLearnerConnection.php'; -require_once 'Settings.php'; -$settings=new Settings(); -DLLearnerConnection::loadWSDLfiles($settings->wsdluri); -$index_uri = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).'/index.php'; -header('Location: ' . $index_uri); -?> \ No newline at end of file Modified: trunk/src/dbpedia-navigator/index.php =================================================================== --- trunk/src/dbpedia-navigator/index.php 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dbpedia-navigator/index.php 2008-01-11 17:01:00 UTC (rev 367) @@ -147,13 +147,13 @@ <div id="rightSidebar"> <div class="box"> - <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <input type="button" value="Clear" class="button" onclick="xajax_clearPositives();return false;" /></div> + <div class="boxtitlewithbutton" id="positivesboxtitle">search relevant <img src="images/remove.png" onclick="xajax_clearPositives()" /> </div> <div class="boxcontent" id="Positives"> </div> <!-- boxcontent --> </div> <!-- box --> <div class="box"> - <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <input type="button" value="Clear" class="button" onclick="xajax_clearNegatives();return false;" /></div> + <div class="boxtitlewithbutton" id="negativesboxtitle">not relevant <img src="images/remove.png" onclick="xajax_clearNegatives()" /> </div> <div class="boxcontent" id="Negatives"> </div> <!-- boxcontent --> </div> <!-- box --> @@ -182,7 +182,7 @@ echo '><img src="images/valid-css.png" alt="valid CSS" /></a></div>'."\n"; ?> </div> - <p><a href='clearsession.php'>restart session and redownload WSDL file (for debugging)</a></p> + <p><a href='rebuild.php'>rebuild [restart session and redownload WSDL file (for debugging)]</a></p> <p> ToDo: <ul> Copied: trunk/src/dbpedia-navigator/rebuild.php (from rev 363, trunk/src/dbpedia-navigator/clearsession.php) =================================================================== --- trunk/src/dbpedia-navigator/rebuild.php (rev 0) +++ trunk/src/dbpedia-navigator/rebuild.php 2008-01-11 17:01:00 UTC (rev 367) @@ -0,0 +1,27 @@ +<?php +session_start(); + +session_unset(); +ob_start(); +require_once 'pear/HTTP_Request.php'; +require_once 'DLLearnerConnection.php'; +require_once 'Settings.php'; +$settings=new Settings(); + +// download new WSDL file +DLLearnerConnection::loadWSDLfiles($settings->wsdluri); + +// we need to make sure that PHP really uses the new WSDL file +// and does not cache, so we disable the cache and load it +ini_set("soap.wsdl_cache_enabled","0"); +$sc=new DLLearnerConnection($settings->dbpediauri,$settings->wsdluri); +//$sc->getIDs(); +// TODO: does not work; +// maybe try to set ttl of cache to 1 second, +// wait for 1 second and then redirect to start page + +// redirect to index page +$index_uri = 'http://'.$_SERVER['SERVER_NAME'].dirname($_SERVER['SCRIPT_NAME']).'/index.php'; +header('Location: ' . $index_uri); + +?> \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-11 11:45:18 UTC (rev 366) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-11 17:01:00 UTC (rev 367) @@ -32,6 +32,7 @@ import javax.jws.WebService; import javax.jws.soap.SOAPBinding; +import org.dllearner.Info; import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; @@ -92,6 +93,15 @@ } /** + * Returns the DL-Learner version this web service is based on. + * @return DL-Learner-Build. + */ + @WebMethod + public String getBuild() { + return Info.build; + } + + /** * Generates a unique ID for the client and initialises a session. * Using the ID the client can call the other web service methods. * Two calls to this method are guaranteed to return different results. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-01-24 12:53:01
|
Revision: 426 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=426&view=rev Author: jenslehmann Date: 2008-01-24 04:52:57 -0800 (Thu, 24 Jan 2008) Log Message: ----------- - cleanup in new learning algorithm - php-client renamed to php-client-old as it is not longer working with the current DL-Learner web service Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java Added Paths: ----------- trunk/src/php-client-old/ Removed Paths: ------------- trunk/src/php-client/ Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-01-24 10:13:14 UTC (rev 425) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-01-24 12:52:57 UTC (rev 426) @@ -104,6 +104,7 @@ private boolean useAllConstructor = true; private boolean useExistsConstructor = true; private boolean useNegation = true; + private double noisePercentage = 0.0; // Variablen zur Einstellung der Protokollierung // boolean quiet = false; @@ -159,7 +160,11 @@ options.add(CommonConfigOptions.ignoredRoles()); options.add(CommonConfigOptions.useAllConstructor()); options.add(CommonConfigOptions.useExistsConstructor()); - options.add(CommonConfigOptions.useNegation()); + options.add(CommonConfigOptions.useNegation()); + DoubleConfigOption noisePercentage = new DoubleConfigOption("noisePercentage", "the (approximated) percentage of noise within the examples"); + noisePercentage.setLowerLimit(0.0); + noisePercentage.setUpperLimit(1.0); + options.add(noisePercentage); return options; } @@ -208,6 +213,8 @@ useExistsConstructor = (Boolean) entry.getValue(); } else if(name.equals("useNegation")) { useNegation = (Boolean) entry.getValue(); + } else if(name.equals("noisePercentage")) { + noisePercentage = (Double) entry.getValue(); } } @@ -282,8 +289,9 @@ learningProblem, operator, algHeuristic, - usedConcepts, - usedRoles, + // usedConcepts, + // usedRoles, + noisePercentage, writeSearchTree, replaceSearchTree, searchTreeFile, @@ -291,6 +299,9 @@ useOverlyGeneralList, useShortConceptConstruction ); + // note: used concepts and roles do not need to be passed + // as argument, because it is sufficient to prepare the + // concept and role hierarchy accordingly } public static String getName() { Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-01-24 10:13:14 UTC (rev 425) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLearner.java 2008-01-24 12:52:57 UTC (rev 426) @@ -21,7 +21,6 @@ import java.io.File; import java.text.DecimalFormat; -import java.util.Comparator; import java.util.Iterator; import java.util.LinkedList; import java.util.List; @@ -29,13 +28,12 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.apache.log4j.Logger; import org.dllearner.algorithms.refinement.RefinementOperator; import org.dllearner.algorithms.refinement.RhoDown; import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; -import org.dllearner.core.dl.AtomicConcept; -import org.dllearner.core.dl.AtomicRole; import org.dllearner.core.dl.Concept; import org.dllearner.core.dl.MultiConjunction; import org.dllearner.core.dl.MultiDisjunction; @@ -51,98 +49,86 @@ * Implements the example based refinement operator learning * approach. * + * TODO: Implement noise handling (here and/or in heuristics). When the + * noise level in the examples is set to a certain percentage, we + * compute the number of positive examples corresponding to this + * percentage. This is the maximum number of positive examples, which + * can be misclassified (everything above is considered a too weak + * concept wrt. the noise percentage). + * * @author Jens Lehmann * */ public class ExampleBasedROLearner { - // all configuration options, which were passed to the - // learning algorithms + private static Logger logger = Logger + .getLogger(ExampleBasedROLearner.class); + + // basic setup: learning problem and reasoning service + private ReasoningService rs; + private PosNegLP learningProblem; + private PosOnlyDefinitionLP posOnlyLearningProblem; + private boolean posOnly = false; + + // search tree options private boolean writeSearchTree; private File searchTreeFile; private boolean replaceSearchTree = false; - Set<AtomicConcept> allowedConcepts; - Set<AtomicRole> allowedRoles; - Set<AtomicConcept> ignoredConcepts; - Set<AtomicRole> ignoredRoles; - // these are computed as the result of the previous four settings - Set<AtomicConcept> usedConcepts; - Set<AtomicRole> usedRoles; + // constructs to improve performance private boolean useTooWeakList = true; private boolean useOverlyGeneralList = true; private boolean useShortConceptConstruction = true; - private double horizontalExpansionFactor = 0.6; - - private boolean quiet = false; - + // setting to true gracefully stops the algorithm private boolean stop = false; - private ReasoningService rs; + // solution protocol + private boolean solutionFound = false; + private List<Concept> solutions = new LinkedList<Concept>(); - private PosNegLP learningProblem; - private PosOnlyDefinitionLP posOnlyLearningProblem; - private boolean posOnly = false; + // used refinement operator and heuristic (exchangeable) + private RhoDown operator; + // private ExampleBasedHeuristic heuristic; - // non-configuration variables - - // Lösungen protokollieren - boolean solutionFound = false; - List<Concept> solutions = new LinkedList<Concept>(); + // specifies whether to compute and log benchmark information + private boolean computeBenchmarkInformation = false; - // verwendeter Refinement-Operator (momentan werden für Statistik RhoDown-spezifische - // Sachen abgefragt) - // RefinementOperator operator; - RhoDown operator; - - // Variablen zur Einstellung der Protokollierung - // boolean quiet = false; - boolean showBenchmarkInformation = false; - // boolean createTreeString = false; - // String searchTree = new String(); - - // Konfiguration des Algorithmus - // Faktor für horizontale Erweiterung (notwendig für completeness) - // double horizontalExpansionFactor = 0.6; - - - - private Comparator<ExampleBasedNode> nodeComparator; + // comparator used to maintain a stable ordering of nodes, i.e. + // an ordering which does not change during the run of the algorithm private NodeComparatorStable nodeComparatorStable = new NodeComparatorStable(); + // stable candidate set; it has no functional part in the algorithm, + // but is a list of the currently best concepts found + private TreeSet<ExampleBasedNode> candidatesStable = new TreeSet<ExampleBasedNode>(nodeComparatorStable); + + // comparator used to create ordered sets of concepts private ConceptComparator conceptComparator = new ConceptComparator(); - DecimalFormat df = new DecimalFormat(); - // Menge von Kandidaten für Refinement - // (wird für Direktzugriff auf Baumknoten verwendet) + // utility variables + private DecimalFormat df = new DecimalFormat(); + + // candidates for refinement (used for directly accessing + // nodes in the search tree) private TreeSet<ExampleBasedNode> candidates; - // während eines Durchlaufs neu gefundene Knoten + + // new nodes found during a run of the algorithm private List<ExampleBasedNode> newCandidates = new LinkedList<ExampleBasedNode>(); - // stabiles candidate set, da sich die Knoten nach dem einfügen nicht - // verschieben können => das Set enthält nicht die aktuellen horizontal - // expansions, es dient nur dazu die besten Konzepte zu speichern; hat also - // keine Funktion im Algorithmus - private TreeSet<ExampleBasedNode> candidatesStable = new TreeSet<ExampleBasedNode>(nodeComparatorStable); - // vorhandene Konzepte, die irgendwann als proper eingestuft worden + + // all concepts which have been evaluated as being proper refinements private SortedSet<Concept> properRefinements = new TreeSet<Concept>(conceptComparator); - // speichert Konzept und deren Evaluierung, um sie leicht wiederzufinden für - // Strategien wie Konzeptverkürzung etc. - // Zahl = covered negatives, -1 = too weak - // private Map<Concept, Integer> evaluationCache = new TreeMap<Concept, Integer>(conceptComparator); - // Blacklists + + // blacklists private SortedSet<Concept> tooWeakList = new TreeSet<Concept>(conceptComparator); private SortedSet<Concept> overlyGeneralList = new TreeSet<Concept>(conceptComparator); + // set of expanded nodes (TODO: better explanation) TreeSet<ExampleBasedNode> expandedNodes = new TreeSet<ExampleBasedNode>(nodeComparatorStable); - // statistische Variablen + // statistic variables private int maxRecDepth = 0; private int maxNrOfRefinements = 0; private int maxNrOfChildren = 0; private int redundantConcepts = 0; - int maximumHorizontalExpansion; - int minimumHorizontalExpansion; - // private int propernessTests = 0; private int propernessTestsReasoner = 0; private int propernessTestsAvoidedByShortConceptConstruction = 0; private int propernessTestsAvoidedByTooWeakList = 0; @@ -150,7 +136,7 @@ private int conceptTestsOverlyGeneralList = 0; private int conceptTestsReasoner = 0; - // Zeitvariablen + // time variables private long algorithmStartTime; private long propernessCalcTimeNs = 0; private long propernessCalcReasoningTimeNs = 0; @@ -159,15 +145,14 @@ private long redundancyCheckTimeNs = 0; private long evaluateSetCreationTimeNs = 0; private long improperConceptsRemovalTimeNs = 0; - long someTimeNs = 0; - int someCount = 0; public ExampleBasedROLearner( LearningProblem learningProblem, RefinementOperator operator, ExampleBasedHeuristic heuristic, - Set<AtomicConcept> allowedConcepts, - Set<AtomicRole> allowedRoles, + // Set<AtomicConcept> allowedConcepts, + // Set<AtomicRole> allowedRoles, + double noisePercentage, boolean writeSearchTree, boolean replaceSearchTree, File searchTreeFile, @@ -183,8 +168,9 @@ posOnly = true; } + // this.heuristic = heuristic; // candidate sets entsprechend der gewählten Heuristik initialisieren - candidates = new TreeSet<ExampleBasedNode>(nodeComparator); + candidates = new TreeSet<ExampleBasedNode>(heuristic); // newCandidates = new TreeSet<Node>(nodeComparator); } @@ -208,22 +194,11 @@ solutions.add(top); int loop = 0; - - // Voreinstellung für horizontal expansion - maximumHorizontalExpansion = 0; - minimumHorizontalExpansion = 0; algorithmStartTime = System.nanoTime(); - // TODO: effizienter Traversal der Subsumption-Hierarchie - // TODO: Äquivalenzen nutzen - // TODO: Gibt es auch eine andere Abbruchbedingung? Es könnte sein, dass irgendwann keine - // proper refinements mehr gefunden werden, aber wie stelle man das fest? - while(!solutionFound && !stop) { + while(!solutionFound && !stop) { - if(!quiet) - printStatistics(false); - // besten Knoten nach Heuristik auswählen ExampleBasedNode bestNode = candidates.last(); // besten Knoten erweitern @@ -234,67 +209,7 @@ candidates.add(bestNode); candidates.addAll(newCandidates); candidatesStable.addAll(newCandidates); - - // minimum horizontal expansion berechnen - if(bestNode.getHorizontalExpansion()>maximumHorizontalExpansion) - maximumHorizontalExpansion = bestNode.getHorizontalExpansion(); - minimumHorizontalExpansion = (int) Math.floor(horizontalExpansionFactor*maximumHorizontalExpansion); - - // neu: es werden solange Knoten erweitert bis wirklich jeder Knoten die - // notwendige minimum horizontal expansion hat - boolean nodesExpanded; - do { - nodesExpanded = false; - - - // es darf nicht candidatesStable geklont werden, da diese Menge nicht - // aktualisiert wird, also die falschen horizontal expansions vorliegen - // TODO: bei Tests war die Performance der clone-Operation ganz gut, aber - // es skaliert natürlich nicht so gut mit größer werdenden candidate set - // => Lösung ist vielleicht einfach einen Iterator zu verwenden und das - // aktuelle Konzept gleich hier zu löschen (wird dann bei expansion wieder - // hinzugefügt) - // TreeSet<Node> candidatesClone = (TreeSet<Node>) candidates.clone(); - newCandidates.clear(); - - - // for(Node candidate : candidatesClone) { - Iterator<ExampleBasedNode> it = candidates.iterator(); - List<ExampleBasedNode> changedNodes = new LinkedList<ExampleBasedNode>(); - while(it.hasNext()){ - ExampleBasedNode candidate = it.next(); - // alle Kandidaten, die nicht too weak sind und unter minimumHorizontalExpansion - // liegen, werden erweitert - if(!candidate.isTooWeak() && candidate.getHorizontalExpansion()<minimumHorizontalExpansion) { - // Vorsicht, falls candidates irgendwann in extendProper benutzt - // werden sollten! Es könnten auf diese Weise Knoten fehlen - // (momentan wird candidates nur zur Auswahl des besten Knotens - // benutzt). - it.remove(); - extendNodeProper(candidate, minimumHorizontalExpansion); - nodesExpanded = true; - - changedNodes.add(candidate); - } - } - - long someTimeStart = System.nanoTime(); - someCount++; - // geänderte temporär entfernte Knoten wieder hinzufügen - candidates.addAll(changedNodes); - // neu gefundene Knoten hinzufügen - candidates.addAll(newCandidates); - candidatesStable.addAll(newCandidates); - someTimeNs += System.nanoTime() - someTimeStart; - - } while(nodesExpanded && !stop); - - //System.out.println("candidate set:"); - //for(Node n : candidates) { - // System.out.println(n); - //} - if(writeSearchTree) { // String treeString = ""; String treeString = "best expanded node: " + bestNode+ "\n"; @@ -305,13 +220,9 @@ } } expandedNodes.clear(); - treeString += "horizontal expansion: " + minimumHorizontalExpansion + " to " + maximumHorizontalExpansion + "\n"; treeString += topNode.getTreeString(); treeString += "\n"; - // System.out.println(treeString); - // searchTree += treeString + "\n"; - // TODO: ev. immer nur einen search tree speichern und den an die - // Datei anhängen => spart Speicher + if(replaceSearchTree) Files.createFile(searchTreeFile, treeString); else @@ -321,38 +232,16 @@ // Anzahl Schleifendurchläufe loop++; - if(!quiet) - System.out.println("--- loop " + loop + " finished ---"); + logger.debug("--- loop " + loop + " finished ---"); } - // Suchbaum in Datei schreiben -// if(writeSearchTree) -// Files.createFile(searchTreeFile, searchTree); - - // Ergebnisausgabe - /* - System.out.println("candidate set:"); - for(Node n : candidates) { - System.out.println(n); - }*/ - - // Set<Concept> solutionsSorted = new TreeSet(conceptComparator); - // solutionsSorted.addAll(solutions); - - // System.out.println("retrievals:"); - // for(Concept c : ReasoningService.retrievals) { - // System.out.println(c); - // } - if(solutionFound) { - System.out.println(); - System.out.println("solutions:"); + logger.info("\nsolutions:"); for(Concept c : solutions) { - System.out.println(" " + c + " (length " + c.getLength() +", depth " + c.getDepth() + ")"); + logger.info(" " + c + " (length " + c.getLength() +", depth " + c.getDepth() + ")"); } } - System.out.println("horizontal expansion: " + minimumHorizontalExpansion + " to " + maximumHorizontalExpansion); System.out.println("size of candidate set: " + candidates.size()); printStatistics(true); @@ -724,16 +613,13 @@ // searchTree += expandedNodeString + "\n"; System.out.println(expandedNodeString); System.out.println("algorithm runtime " + Helper.prettyPrintNanoSeconds(algorithmRuntime)); - String expansionString = "horizontal expansion: " + minimumHorizontalExpansion + " to " + maximumHorizontalExpansion; - // searchTree += expansionString + "\n"; - System.out.println(expansionString); System.out.println("size of candidate set: " + candidates.size()); // System.out.println("properness max recursion depth: " + maxRecDepth); // System.out.println("max. number of one-step refinements: " + maxNrOfRefinements); // System.out.println("max. number of children of a node: " + maxNrOfChildren); } - if(showBenchmarkInformation) { + if(computeBenchmarkInformation) { long reasoningTime = rs.getOverallReasoningTimeNs(); @@ -753,15 +639,11 @@ double onnfTimePercentage = 100 * ConceptTransformation.onnfTimeNs/(double)algorithmRuntime; double shorteningTimePercentage = 100 * ConceptTransformation.shorteningTimeNs/(double)algorithmRuntime; - // nur temporär - double someTimePercentage = 100 * someTimeNs/(double)algorithmRuntime; - System.out.println("reasoning percentage: " + df.format(reasoningPercentage) + "%"); System.out.println(" subsumption check time: " + df.format(subPercentage) + "%"); System.out.println("proper calculation percentage (wo. reasoning): " + df.format(propPercentage) + "%"); System.out.println(" deletion time percentage: " + df.format(deletionPercentage) + "%"); System.out.println(" refinement calculation percentage: " + df.format(refinementPercentage) + "%"); - System.out.println(" some time percentage: " + df.format(someTimePercentage) + "% " + Helper.prettyPrintNanoSeconds(someTimeNs) + " " + someCount + " times"); System.out.println(" m calculation percentage: " + df.format(mComputationTimePercentage) + "%"); System.out.println(" top calculation percentage: " + df.format(topComputationTimePercentage) + "%"); System.out.println(" redundancy check percentage: " + df.format(redundancyCheckPercentage) + "%"); Copied: trunk/src/php-client-old (from rev 425, trunk/src/php-client) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <sk...@us...> - 2008-01-29 12:03:29
|
Revision: 451 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=451&view=rev Author: sknappe Date: 2008-01-29 04:03:11 -0800 (Tue, 29 Jan 2008) Log Message: ----------- Caching of Sparql-Queries is now working Modified Paths: -------------- trunk/src/dbpedia-navigator/DLLearnerConnection.php trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java trunk/src/dl-learner/org/dllearner/kb/sparql/query/SparqlQuery.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/kb/sparql/query/CachedSparqlQueryTest.java Modified: trunk/src/dbpedia-navigator/DLLearnerConnection.php =================================================================== --- trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-29 10:11:45 UTC (rev 450) +++ trunk/src/dbpedia-navigator/DLLearnerConnection.php 2008-01-29 12:03:11 UTC (rev 451) @@ -112,6 +112,7 @@ function getSparqlResult($query) { $this->client->applyConfigEntryStringArray($this->id, $this->ksID, "defaultGraphURIs", array("http://dbpedia.org")); + $this->client->applyConfigEntryBoolean($this->id, $this->ksID, "cached", true); $queryID=$this->client->sparqlQueryThreaded($this->id,$this->ksID,$query); $running=true; $i = 1; Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-01-29 10:11:45 UTC (rev 450) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2008-01-29 12:03:11 UTC (rev 451) @@ -46,6 +46,8 @@ import org.dllearner.core.dl.KB; import org.dllearner.kb.sparql.configuration.SparqlEndpoint; import org.dllearner.kb.sparql.configuration.SparqlQueryType; +import org.dllearner.kb.sparql.query.Cache; +import org.dllearner.kb.sparql.query.CachedSparqlQueryTest; import org.dllearner.kb.sparql.query.SparqlQuery; import org.dllearner.parser.KBParser; import org.dllearner.reasoning.DIGConverter; @@ -101,6 +103,8 @@ // received ontology as KB, the internal format private KB kb; + + private boolean cached=true; public static String getName() { return "SPARQL Endpoint"; @@ -158,7 +162,8 @@ "role to learn Domain/Range from")); options.add(new StringConfigOption("blankNodeIdentifier", "used to identify blanknodes in Tripels")); - + options.add(new BooleanConfigOption("cached", + "use Cache")); options.add(new StringTupleListConfigOption("example", "example")); options.add(new StringTupleListConfigOption("replacePredicate", "rule for replacing predicates")); @@ -217,6 +222,8 @@ dumpToFile = (Boolean) entry.getValue(); } else if (option.equals("useLits")) { useLits = (Boolean) entry.getValue(); + } else if (option.equals("cached")) { + cached = (Boolean) entry.getValue(); } else if (option.equals("getAllSuperClasses")) { getAllSuperClasses = (Boolean) entry.getValue(); /* @@ -391,7 +398,8 @@ public SparqlQuery sparqlQuery(String query) { this.endpoint = new SparqlEndpoint(url, defaultGraphURIs, namedGraphURIs); - return new SparqlQuery(query, endpoint); + if (cached) return new CachedSparqlQueryTest(endpoint, new Cache("cache"),""+query.hashCode(),query); + else return new SparqlQuery(query, endpoint); } /*public static void main(String[] args) throws MalformedURLException { Added: trunk/src/dl-learner/org/dllearner/kb/sparql/query/CachedSparqlQueryTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/query/CachedSparqlQueryTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/query/CachedSparqlQueryTest.java 2008-01-29 12:03:11 UTC (rev 451) @@ -0,0 +1,30 @@ +package org.dllearner.kb.sparql.query; + +import org.dllearner.kb.sparql.configuration.SparqlEndpoint; + +public class CachedSparqlQueryTest extends SparqlQuery { + + private Cache cache; + private String key; + + public CachedSparqlQueryTest(SparqlEndpoint endpoint, Cache cache, String key, + String queryString) { + super(queryString,endpoint); + this.cache = cache; + this.key = key; + } + + public void send() + { + String FromCache = cache.get(key, queryString); + + // if not in cache get it from EndPoint + if (FromCache == null) { + super.send(); + this.cache.put(key, queryString, getAsJSON()); + } else { + this.rs=SparqlQuery.JSONtoResultSet(FromCache); + System.out.println("FROM CACHE"); + } + } +} Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/query/SparqlQuery.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/query/SparqlQuery.java 2008-01-29 10:11:45 UTC (rev 450) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/query/SparqlQuery.java 2008-01-29 12:03:11 UTC (rev 451) @@ -30,7 +30,6 @@ import org.dllearner.kb.sparql.configuration.SparqlEndpoint; import org.dllearner.utilities.StringTuple; -import com.hp.hpl.jena.query.QueryExecution; import com.hp.hpl.jena.query.ResultSet; import com.hp.hpl.jena.query.ResultSetFactory; import com.hp.hpl.jena.query.ResultSetFormatter; @@ -47,11 +46,11 @@ public class SparqlQuery { private boolean print_flag = false; - private boolean isRunning = false; - private String queryString; - private QueryExecution queryExecution; - SparqlEndpoint endpoint; - private ResultSet rs=null; + protected boolean isRunning = false; + protected String queryString; + protected QueryEngineHTTP queryExecution; + protected SparqlEndpoint endpoint; + protected ResultSet rs=null; /** * simplest contructor, works only with some endpoints, @@ -74,19 +73,21 @@ this.endpoint = endpoint; } + public void setIsRunning(boolean running){ + this.isRunning=running; + } /** * method used for sending over Jena * @return jena ResultSet */ public void send() { - this.isRunning=true; p(queryString); String service = endpoint.getURL().toString(); p(endpoint.getURL().toString()); // Jena access to SPARQL endpoint - QueryEngineHTTP queryExecution=new QueryEngineHTTP(service,queryString); + queryExecution=new QueryEngineHTTP(service,queryString); for (String dgu : endpoint.getDefaultGraphURIs()){ queryExecution.addDefaultGraph(dgu); } @@ -99,7 +100,6 @@ rs = queryExecution.execSelect(); p(rs.getResultVars().toString()); //p(ResultSetFormatter.asXMLString(rs)); - this.isRunning=false; } public void stop() { Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-29 10:11:45 UTC (rev 450) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-01-29 12:03:11 UTC (rev 451) @@ -47,6 +47,7 @@ import org.dllearner.core.dl.Individual; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.SparqlKnowledgeSource; +import org.dllearner.kb.sparql.query.SparqlQuery; import org.dllearner.learningproblems.PosNegDefinitionLP; import org.dllearner.learningproblems.PosNegInclusionLP; import org.dllearner.learningproblems.PosOnlyDefinitionLP; @@ -517,7 +518,10 @@ Thread sparqlThread = new Thread() { @Override public void run() { - state.getQuery(id).send(); + SparqlQuery query=state.getQuery(id); + query.setIsRunning(true); + query.send(); + query.setIsRunning(false); } }; sparqlThread.start(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-02-15 16:52:09
|
Revision: 577 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=577&view=rev Author: jenslehmann Date: 2008-02-15 08:18:52 -0800 (Fri, 15 Feb 2008) Log Message: ----------- - added php-examples directory, which should contain simple examples of web service interface usage - created small Utilities class (partially from old LearnerClient file) - added reasoning example Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Added Paths: ----------- trunk/src/php-examples/ trunk/src/php-examples/Reasoning.php trunk/src/php-examples/Utilities.php Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-15 12:44:08 UTC (rev 576) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-15 16:18:52 UTC (rev 577) @@ -35,6 +35,10 @@ import javax.jws.soap.SOAPBinding; import org.dllearner.Info; +import org.dllearner.algorithms.BruteForceLearner; +import org.dllearner.algorithms.RandomGuesser; +import org.dllearner.algorithms.gp.GP; +import org.dllearner.algorithms.refexamples.ExampleBasedROLComponent; import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.core.Component; import org.dllearner.core.ComponentManager; @@ -57,6 +61,7 @@ import org.dllearner.parser.KBParser; import org.dllearner.parser.ParseException; import org.dllearner.reasoning.DIGReasoner; +import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.Datastructures; import org.dllearner.utilities.Helper; @@ -87,10 +92,15 @@ knowledgeSourceMapping.put("owlfile", OWLFile.class); knowledgeSourceMapping.put("sparql", SparqlKnowledgeSource.class); reasonerMapping.put("dig", DIGReasoner.class); + reasonerMapping.put("owlapi", OWLAPIReasoner.class); learningProblemMapping.put("posNegDefinition", PosNegDefinitionLP.class); learningProblemMapping.put("posNegInclusion", PosNegInclusionLP.class); learningProblemMapping.put("posOnlyDefinition", PosOnlyDefinitionLP.class); - learningAlgorithmMapping.put("refinement", ROLearner.class); + learningAlgorithmMapping.put("random", RandomGuesser.class); + learningAlgorithmMapping.put("bruteForce", BruteForceLearner.class); + learningAlgorithmMapping.put("genetic", ROLearner.class); + learningAlgorithmMapping.put("refinement", GP.class); + learningAlgorithmMapping.put("refexamples", ExampleBasedROLComponent.class); components = Helper.union(knowledgeSourceMapping.keySet(),reasonerMapping.keySet()); components = Helper.union(components, learningProblemMapping.keySet()); components = Helper.union(components, learningAlgorithmMapping.keySet()); Added: trunk/src/php-examples/Reasoning.php =================================================================== --- trunk/src/php-examples/Reasoning.php (rev 0) +++ trunk/src/php-examples/Reasoning.php 2008-02-15 16:18:52 UTC (rev 577) @@ -0,0 +1,59 @@ +<?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 reasoning. + * + * @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); +$client->init($id, $ksID); +$rID = $client->setReasoner($id, "dig"); +$client->init($id, $rID); + +// create a concept in internal DL-Learner syntax +// ( = all female persons having at least one child) +$concept = '"http://example.com/father#female" AND EXISTS "http://example.com/father#hasChild".TOP'; +$instances = $client->retrieval($id, $concept); + +// print instances +echo 'instances of ' . $concept . ': <br />'; +echo '<pre>'; +print_r($instances->item); +echo '</pre>'; + +?> \ No newline at end of file Added: trunk/src/php-examples/Utilities.php =================================================================== --- trunk/src/php-examples/Utilities.php (rev 0) +++ trunk/src/php-examples/Utilities.php 2008-02-15 16:18:52 UTC (rev 577) @@ -0,0 +1,167 @@ +<?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/>. + * + */ + +// Pear HTTP_Request class required +include ('HTTP/Request.php'); + +/** + * Collection of static utility functions. + * + * @author Jens Lehmann + * @author Sebastian Hellmann + */ + +class Utilities { + + /** + * Loads WSDL and imported XSD files from web service and stores them + * locally. + */ + public static function loadWSDLfiles($wsdluri) { + $main = self :: getRequest($wsdluri); + $other = self :: getXSDImports($main); + $newMain = self :: changeXSDImports($main); + self :: writeToFile("main.wsdl", $newMain); + $x = 0; + foreach ($other as $o) { + self :: writeToFile("def" . ($x++) . ".xsd", self :: getRequest($o)); + } + } + + /** + * Change XSD imports in WSDL file to point to local imports. + */ + public static function changeXSDImports($wsdlFileContent) { + $before = "<xsd:import schemaLocation=\""; + $after = "\" namespace=\""; + $newWSDL = ""; + $desca = "def"; + $descb = ".xsd"; + $x = 0; + while ($posstart = strpos($wsdlFileContent, $before)) { + $posstart += strlen($before); + $newWSDL .= substr($wsdlFileContent, 0, $posstart); + $wsdlFileContent = substr($wsdlFileContent, $posstart); + $newWSDL .= $desca . ($x++) . $descb; + $posend = strpos($wsdlFileContent, $after); + $wsdlFileContent = substr($wsdlFileContent, $posend); + } + return $newWSDL . $wsdlFileContent; + } + + /** + * Extracts XSD imports from WSDL file. + */ + public static function getXSDImports($wsdlFileContent) { + $before = "<xsd:import schemaLocation=\""; + $after = "\" namespace=\""; + $ret = array (); + while ($posstart = strpos($wsdlFileContent, $before)) { + $posstart += strlen($before); + $wsdlFileContent = substr($wsdlFileContent, $posstart); + $posend = strpos($wsdlFileContent, $after); + $tmp = substr($wsdlFileContent, 0, $posend); + $ret[] = $tmp; + $wsdlFileContent = substr($wsdlFileContent, $posend +strlen($after)); + } + return $ret; + } + + /** + * Peforms a GET request and returns body of result. + */ + public static function getRequest($uri) { + $req = & new HTTP_Request($uri); + $req->setMethod(HTTP_REQUEST_METHOD_GET); + $req->sendRequest(); + $ret = $req->getResponseBody(); + return $ret; + } + + /** + * Writes $content to file $filename. + */ + public static function writeToFile($filename, $content) { + $fp = fopen($filename, "w"); + fwrite($fp, $content); + fclose($fp); + } + + /** + * Prints a list of all Web Service components and their configuration options. + */ + public static function printWebserviceComponents($client) { + echo '<h1>Web Service Information</h1>'; + + echo '<h2>Knowledge Sources</h2>'; + Utilities :: printComponentsInfo($client, $client->getKnowledgeSources()->item); + + echo '<h2>Reasoners</h2>'; + Utilities :: printComponentsInfo($client, $client->getReasoners()->item); + + echo '<h2>Learning Problems</h2>'; + Utilities :: printComponentsInfo($client, $client->getLearningProblems()->item); + + echo '<h2>Learning Algorithms</h2>'; + Utilities :: printComponentsInfo($client, $client->getLearningAlgorithms()->item); + } + + /** + * Print information about all given components. + */ + public static function printComponentsInfo($client, $components) { + foreach ($components as $component) + Utilities :: printComponentInfo($client, $component); + } + + /** + * Print information about a component. + */ + public static function printComponentInfo($client, $component) { + echo '<h3>component: ' . $component . '</h3>'; + + $options = $client->getConfigOptions($component, true)->item; + if (!is_array($options)) + $options = array ( + $options + ); + + foreach ($options as $option) + Utilities :: printOption($option); + } + + /** + * Prints information about an option. + * + * @param String Option as returned by the DL-Learner web service + * getConfigOption() method. + */ + public static function printOption($option) { + $parts = split('#', $option); + echo 'option name: <b>' . $parts[0] . '</b><br />'; + echo 'option description: ' . $parts[1] . '<br />'; + echo 'option class: ' . $parts[2] . '<br />'; + if ($parts[3] != 'null') + echo 'option name: ' . $parts[3] . '<br />'; + echo '<br />'; + } +} +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <jen...@us...> - 2008-02-26 07:13:35
|
Revision: 639 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=639&view=rev Author: jenslehmann Date: 2008-02-25 23:13:31 -0800 (Mon, 25 Feb 2008) Log Message: ----------- - fixed parser problem reported by Maria - Web Service now throws parse exceptions when input strings cannot be parsed correctly Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/parser/KBParser.java trunk/src/dl-learner/org/dllearner/parser/kb.jj trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-examples/Reasoning.php Added Paths: ----------- trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java Modified: trunk/src/dl-learner/org/dllearner/parser/KBParser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-25 17:58:40 UTC (rev 638) +++ trunk/src/dl-learner/org/dllearner/parser/KBParser.java 2008-02-26 07:13:31 UTC (rev 639) @@ -19,8 +19,15 @@ } public static Description parseConcept(String string) throws ParseException { - KBParser parser = new KBParser(new StringReader(string)); - return parser.Concept(); + // when just parsing the string as concept, we have no guarantee + // that the parser uses all symbols, e.g. a AND b returns just a + // because the brackets were forgotten; + // so instead we create an equivalent class axiom and return its + // right hand side + String eq = "tmp = " + string + "."; + KBParser parser = new KBParser(new StringReader(eq)); + EquivalentClassesAxiom eqAxiom = parser.TBoxEquiv(); + return eqAxiom.getConcept2(); } public static KB parseKBFile(String content) throws IOException, ParseException { @@ -668,39 +675,6 @@ finally { jj_save(5, xla); } } - final private boolean jj_3_1() { - if (jj_3R_2()) return true; - if (jj_scan_token(22)) return true; - if (jj_3R_3()) return true; - if (jj_scan_token(23)) return true; - if (jj_scan_token(COMMAND_END)) return true; - return false; - } - - final private boolean jj_3R_14() { - if (jj_scan_token(20)) return true; - if (jj_3R_20()) return true; - if (jj_3R_4()) return true; - if (jj_scan_token(COMMAND_END)) return true; - if (jj_3R_2()) return true; - return false; - } - - final private boolean jj_3R_17() { - if (jj_3R_21()) return true; - return false; - } - - final private boolean jj_3R_4() { - Token xsp; - xsp = jj_scanpos; - if (jj_3R_17()) { - jj_scanpos = xsp; - if (jj_3R_18()) return true; - } - return false; - } - final private boolean jj_3R_13() { if (jj_scan_token(19)) return true; if (jj_3R_20()) return true; @@ -901,6 +875,39 @@ return false; } + final private boolean jj_3_1() { + if (jj_3R_2()) return true; + if (jj_scan_token(22)) return true; + if (jj_3R_3()) return true; + if (jj_scan_token(23)) return true; + if (jj_scan_token(COMMAND_END)) return true; + return false; + } + + final private boolean jj_3R_14() { + if (jj_scan_token(20)) return true; + if (jj_3R_20()) return true; + if (jj_3R_4()) return true; + if (jj_scan_token(COMMAND_END)) return true; + if (jj_3R_2()) return true; + return false; + } + + final private boolean jj_3R_17() { + if (jj_3R_21()) return true; + return false; + } + + final private boolean jj_3R_4() { + Token xsp; + xsp = jj_scanpos; + if (jj_3R_17()) { + jj_scanpos = xsp; + if (jj_3R_18()) return true; + } + return false; + } + public KBParserTokenManager token_source; SimpleCharStream jj_input_stream; public Token token, jj_nt; Modified: trunk/src/dl-learner/org/dllearner/parser/kb.jj =================================================================== --- trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-25 17:58:40 UTC (rev 638) +++ trunk/src/dl-learner/org/dllearner/parser/kb.jj 2008-02-26 07:13:31 UTC (rev 639) @@ -48,8 +48,15 @@ } public static Description parseConcept(String string) throws ParseException { - KBParser parser = new KBParser(new StringReader(string)); - return parser.Concept(); + // when just parsing the string as concept, we have no guarantee + // that the parser uses all symbols, e.g. a AND b returns just a + // because the brackets were forgotten; + // so instead we create an equivalent class axiom and return its + // right hand side + String eq = "tmp = " + string + "."; + KBParser parser = new KBParser(new StringReader(eq)); + EquivalentClassesAxiom eqAxiom = parser.TBoxEquiv(); + return eqAxiom.getConcept2(); } public static KB parseKBFile(String content) throws IOException, ParseException { Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-25 17:58:40 UTC (rev 638) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-02-26 07:13:31 UTC (rev 639) @@ -460,31 +460,20 @@ } @WebMethod - public String[] retrieval(int id, String conceptString) throws ClientNotKnownException { + public String[] retrieval(int id, String conceptString) throws ClientNotKnownException, ParseException { ClientState state = getState(id); // call parser to parse concept Description concept = null; - try { - concept = KBParser.parseConcept(conceptString); - } catch (ParseException e) { - e.printStackTrace(); - } + concept = KBParser.parseConcept(conceptString); Set<Individual> individuals = state.getReasoningService().retrieval(concept); return Datastructures.sortedSet2StringListIndividuals(individuals); } @WebMethod - public int getConceptLength(String conceptString) { + public int getConceptLength(String conceptString) throws ParseException { // call parser to parse concept - Description concept = null; - try { - System.out.println(conceptString); - concept = KBParser.parseConcept(conceptString); - } catch (ParseException e) { - e.printStackTrace(); - } - return concept.getLength(); - } + return KBParser.parseConcept(conceptString).getLength(); + } @WebMethod public String[] getAtomicRoles(int id) throws ClientNotKnownException { Added: trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/server/jaxws/ParseExceptionBean.java 2008-02-26 07:13:31 UTC (rev 639) @@ -0,0 +1,41 @@ + +package org.dllearner.server.jaxws; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlRootElement; +import javax.xml.bind.annotation.XmlType; + + +/** + * This class was generated by the JAXWS SI. + * JAX-WS RI 2.0_02-b08-fcs + * Generated source version: 2.0_02 + * + */ +@XmlRootElement(name = "ParseException", namespace = "http://server.dllearner.org/") +@XmlAccessorType(XmlAccessType.FIELD) +@XmlType(name = "ParseException", namespace = "http://server.dllearner.org/") +public class ParseExceptionBean { + + private String message; + + /** + * + * @return + * returns String + */ + public String getMessage() { + return this.message; + } + + /** + * + * @param message + * the value for the message property + */ + public void setMessage(String message) { + this.message = message; + } + +} Modified: trunk/src/php-examples/Reasoning.php =================================================================== --- trunk/src/php-examples/Reasoning.php 2008-02-25 17:58:40 UTC (rev 638) +++ trunk/src/php-examples/Reasoning.php 2008-02-26 07:13:31 UTC (rev 639) @@ -47,7 +47,7 @@ // create a concept in internal DL-Learner syntax // ( = all female persons having at least one child) -$concept = '"http://example.com/father#female" AND EXISTS "http://example.com/father#hasChild".TOP'; +$concept = '("http://example.com/father#female" AND EXISTS "http://example.com/father#hasChild".TOP)'; $instances = $client->retrieval($id, $concept); // print instances This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Jen...@us...> - 2008-06-03 14:29:32
|
Revision: 934 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=934&view=rev Author: JensLehmann Date: 2008-06-03 07:29:22 -0700 (Tue, 03 Jun 2008) Log Message: ----------- intermediate commit (evaluation script) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java trunk/src/dl-learner/org/dllearner/core/ReasoningService.java trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java trunk/src/dl-learner/org/dllearner/scripts/CrossValidation.java trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java trunk/src/php-examples/LearningSimple.php Modified: trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/algorithms/refexamples/ExampleBasedROLComponent.java 2008-06-03 14:29:22 UTC (rev 934) @@ -30,6 +30,7 @@ import org.apache.log4j.Logger; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; +import org.dllearner.core.ReasoningMethodUnsupportedException; import org.dllearner.core.ReasoningService; import org.dllearner.core.Score; import org.dllearner.core.config.BooleanConfigOption; @@ -111,6 +112,7 @@ private boolean useCardinalityRestrictions = CommonConfigOptions.useCardinalityRestrictionsDefault; private boolean useNegation = CommonConfigOptions.useNegationDefault; private boolean useBooleanDatatypes = CommonConfigOptions.useBooleanDatatypesDefault; + private boolean useDoubleDatatypes = CommonConfigOptions.useDoubleDatatypesDefault; private double noisePercentage = 0.0; private NamedClass startClass = null; private boolean usePropernessChecks = false; @@ -178,6 +180,7 @@ options.add(CommonConfigOptions.useCardinalityRestrictions()); options.add(CommonConfigOptions.useNegation()); options.add(CommonConfigOptions.useBooleanDatatypes()); + options.add(CommonConfigOptions.useDoubleDatatypes()); options.add(CommonConfigOptions.maxExecutionTimeInSeconds()); options.add(CommonConfigOptions.minExecutionTimeInSeconds()); options.add(CommonConfigOptions.guaranteeXgoodDescriptions()); @@ -244,6 +247,8 @@ noisePercentage = (Double) entry.getValue(); } else if(name.equals("useBooleanDatatypes")) { useBooleanDatatypes = (Boolean) entry.getValue(); + } else if(name.equals("useDoubleDatatypes")) { + useDoubleDatatypes = (Boolean) entry.getValue(); } else if(name.equals("usePropernessChecks")) { usePropernessChecks = (Boolean) entry.getValue(); } else if(name.equals("maxPosOnlyExpansion")) { @@ -321,7 +326,9 @@ if(improveSubsumptionHierarchy) rs.getSubsumptionHierarchy().improveSubsumptionHierarchy(); rs.prepareRoleHierarchy(usedRoles); - rs.prepareDatatypePropertyHierarchy(); + // prepare datatype hierarchy only if necessary + if(rs.hasDatatypeSupport()) + rs.prepareDatatypePropertyHierarchy(); // create a refinement operator and pass all configuration // variables to it @@ -334,6 +341,7 @@ useCardinalityRestrictions, useNegation, useBooleanDatatypes, + useDoubleDatatypes, startClass ); Modified: trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/core/ReasonerComponent.java 2008-06-03 14:29:22 UTC (rev 934) @@ -45,6 +45,8 @@ */ public abstract class ReasonerComponent extends Component implements Reasoner { + public abstract boolean hasDatatypeSupport(); + public boolean subsumes(Description superConcept, Description subConcept) throws ReasoningMethodUnsupportedException { throw new ReasoningMethodUnsupportedException(); Modified: trunk/src/dl-learner/org/dllearner/core/ReasoningService.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/core/ReasoningService.java 2008-06-03 14:29:22 UTC (rev 934) @@ -80,7 +80,7 @@ // private SortedSet<Concept> retrievalsSet = new TreeSet<Concept>(new ConceptComparator()); - private Reasoner reasoner; + private ReasonerComponent reasoner; /** * Constructs a reasoning service object. Note that you must not @@ -459,6 +459,10 @@ return result; } + public boolean hasDatatypeSupport() { + return reasoner.hasDatatypeSupport(); + } + public Map<Individual, SortedSet<Double>> getDoubleDatatypeMembers(DatatypeProperty datatypeProperty) { try { return reasoner.getDoubleDatatypeMembers(datatypeProperty); Modified: trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/core/config/CommonConfigOptions.java 2008-06-03 14:29:22 UTC (rev 934) @@ -29,6 +29,8 @@ */ public final class CommonConfigOptions { + // some default values + //public static boolean applyAllFilterDefault = true; //public static boolean applyExistsFilterDefault = true; //public static boolean useTooWeakListDefault = true; @@ -40,14 +42,13 @@ public static boolean useCardinalityRestrictionsDefault = true; public static boolean useNegationDefault = true; public static boolean useBooleanDatatypesDefault = true; + public static boolean useDoubleDatatypesDefault = true; public static int maxExecutionTimeInSecondsDefault = 0; public static int minExecutionTimeInSecondsDefault = 0; public static int guaranteeXgoodDescriptionsDefault = 1; public static String logLevelDefault = "DEBUG"; //public static double noisePercentageDefault = 0.0; - - public static StringConfigOption getVerbosityOption() { StringConfigOption verbosityOption = new StringConfigOption("verbosity", "control verbosity of output for this component", "warning"); String[] allowedValues = new String[] {"quiet", "error", "warning", "notice", "info", "debug"}; @@ -110,6 +111,10 @@ return new BooleanConfigOption("useBooleanDatatypes", "specifies whether boolean datatypes are used in the learning algorothm",useBooleanDatatypesDefault); } + public static BooleanConfigOption useDoubleDatatypes() { + return new BooleanConfigOption("useBooleanDatatypes", "specifies whether boolean datatypes are used in the learning algorothm",useDoubleDatatypesDefault); + } + public static IntegerConfigOption maxExecutionTimeInSeconds() { return new IntegerConfigOption("maxExecutionTimeInSeconds", "algorithm will stop after specified seconds",maxExecutionTimeInSecondsDefault); } Modified: trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/reasoning/DIGReasoner.java 2008-06-03 14:29:22 UTC (rev 934) @@ -795,4 +795,9 @@ return null; } + @Override + public boolean hasDatatypeSupport() { + return false; + } + } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastInstanceChecker.java 2008-06-03 14:29:22 UTC (rev 934) @@ -630,5 +630,11 @@ public void setReasonerType(String type){ reasonerType=type; } + + + @Override + public boolean hasDatatypeSupport() { + return true; + } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/reasoning/FastRetrievalReasoner.java 2008-06-03 14:29:22 UTC (rev 934) @@ -193,4 +193,9 @@ public void releaseKB() { rc.releaseKB(); } + + @Override + public boolean hasDatatypeSupport() { + return true; + } } Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-06-03 14:29:22 UTC (rev 934) @@ -904,4 +904,9 @@ reasonerType=type; } + @Override + public boolean hasDatatypeSupport() { + return true; + } + } Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/RhoDRDown.java 2008-06-03 14:29:22 UTC (rev 934) @@ -167,11 +167,11 @@ // private Map<NamedClass,Map<NamedClass,Boolean>> notABMeaningful = new TreeMap<NamedClass,Map<NamedClass,Boolean>>(); public RhoDRDown(ReasoningService reasoningService) { - this(reasoningService, true, true, true, true, true, true, true, null); + this(reasoningService, true, true, true, true, true, true, true, true, null); } public RhoDRDown(ReasoningService reasoningService, boolean applyAllFilter, boolean applyExistsFilter, boolean useAllConstructor, - boolean useExistsConstructor,boolean useCardinalityRestrictions,boolean useNegation, boolean useBooleanDatatypes, NamedClass startClass) { + boolean useExistsConstructor,boolean useCardinalityRestrictions,boolean useNegation, boolean useBooleanDatatypes, boolean useDoubleDatatypes, NamedClass startClass) { this.rs = reasoningService; this.applyAllFilter = applyAllFilter; this.applyExistsFilter = applyExistsFilter; @@ -180,6 +180,7 @@ this.useCardinalityRestrictions = useCardinalityRestrictions; this.useNegation = useNegation; this.useBooleanDatatypes = useBooleanDatatypes; + this.useDoubleDatatypes = useDoubleDatatypes; subHierarchy = rs.getSubsumptionHierarchy(); Modified: trunk/src/dl-learner/org/dllearner/scripts/CrossValidation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/CrossValidation.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/scripts/CrossValidation.java 2008-06-03 14:29:22 UTC (rev 934) @@ -57,6 +57,11 @@ private static Logger logger = Logger.getRootLogger(); + // statistical values + private Stat runtime = new Stat(); + private Stat accuracy = new Stat(); + private Stat length = new Stat(); + public static void main(String[] args) { File file = new File(args[0]); @@ -90,7 +95,11 @@ } public CrossValidation(File file, int folds, boolean leaveOneOut) { + this(file, folds, leaveOneOut, null); + } + public CrossValidation(File file, int folds, boolean leaveOneOut, LearningAlgorithm la) { + DecimalFormat df = new DecimalFormat(); ComponentManager cm = ComponentManager.getInstance(); @@ -178,11 +187,6 @@ System.exit(0); } - // statistical values - Stat runtime = new Stat(); - Stat accuracy = new Stat(); - Stat length = new Stat(); - // run the algorithm for(int currFold=0; currFold<folds; currFold++) { // we always perform a full initialisation to make sure that @@ -204,7 +208,8 @@ // es fehlt init zwischendurch - LearningAlgorithm la = start.getLearningAlgorithm(); + if(la == null) + la = start.getLearningAlgorithm(); // init again, because examples have changed try { la.init(); @@ -315,4 +320,16 @@ return str; } + public Stat getAccuracy() { + return accuracy; + } + + public Stat getLength() { + return length; + } + + public Stat getRuntime() { + return runtime; + } + } Modified: trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/dl-learner/org/dllearner/scripts/PaperStatistics.java 2008-06-03 14:29:22 UTC (rev 934) @@ -25,21 +25,16 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.SortedSet; import org.dllearner.algorithms.gp.GP; import org.dllearner.core.ComponentManager; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.LearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.OntologyFormat; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.ReasoningService; -import org.dllearner.core.Score; import org.dllearner.kb.OWLFile; import org.dllearner.learningproblems.PosNegDefinitionLP; -import org.dllearner.parser.ConfParser; import org.dllearner.reasoning.DIGReasoner; import org.dllearner.utilities.Files; import org.dllearner.utilities.Helper; @@ -69,6 +64,7 @@ // experimental setup: + // 5 fold cross validation // algorithms: refinement, GP, hybrid GP (YinYang) // settings GP: // - average over 10 runs @@ -95,18 +91,18 @@ // - uncle (FORTE) // - more? - String exampleBaseDir = "examples/"; + String exampleBaseDir = "examples/cross-benchmark/"; String gnuplotBaseDir = "log/gnuplot/"; String statBaseDir = "log/stat/"; - File[] confFiles = new File[7]; - confFiles[0] = new File(exampleBaseDir + "trains", "trains_owl.conf"); - confFiles[1] = new File(exampleBaseDir + "arch", "arch_owl.conf"); - confFiles[2] = new File(exampleBaseDir + "moral_reasoner", "moral_43examples_owl.conf"); - confFiles[3] = new File(exampleBaseDir + "moral_reasoner", "moral_43examples_complex_owl.conf"); - confFiles[4] = new File(exampleBaseDir + "poker", "pair_owl.conf"); - confFiles[5] = new File(exampleBaseDir + "poker", "straight_owl.conf"); - confFiles[6] = new File(exampleBaseDir + "forte", "forte_uncle_owl.conf"); + File[] confFiles = new File[1]; +// confFiles[0] = new File(exampleBaseDir + "trains", "trains_owl"); + confFiles[0] = new File(exampleBaseDir + "arch", "arch"); +// confFiles[2] = new File(exampleBaseDir + "moral_reasoner", "moral_43examples_owl"); +// confFiles[3] = new File(exampleBaseDir + "moral_reasoner", "moral_43examples_complex_owl"); +// confFiles[4] = new File(exampleBaseDir + "poker", "pair_owl"); +// confFiles[5] = new File(exampleBaseDir + "poker", "straight_owl"); +// confFiles[6] = new File(exampleBaseDir + "forte", "forte_uncle_owl"); String[] examples = new String[7]; examples[0] = "trains"; @@ -118,192 +114,31 @@ examples[6] = "uncle (FORTE data set)"; int startExampleNr = 0; - String[] algorithms = new String[3]; - algorithms[0] = "refinement"; - algorithms[1] = "gp"; - algorithms[2] = "hybrid"; - - int[] algorithmRuns = {1,10,10}; + // for any example, we create conf files for each configuration to be tested + String[] algorithmPostfix = new String[4]; + algorithmPostfix[0] = "_refexamples"; + algorithmPostfix[1] = "_refexamples_fast"; + algorithmPostfix[2] = "_gp"; + algorithmPostfix[3] = "_hybrid"; int startAlgorithmNr = 0; - // Config.GP.maxConceptLength = 30; - // Config.writeDIGProtocol = true; - // Config.digProtocolFile = new File(statBaseDir, "dig.log"); - - // do not plot anything - // File[][][] gnuplotFiles = new File[examples.length][algorithms.length][3]; - // for(int i=0; i<examples.length; i++) { - // for(int j=0; j<algorithms.length; j++) { - // gnuplotFiles[i][j][0] = new File(gnuplotBaseDir, examples[i] + "_classification_" + algorithms[j] + ".data"); - // gnuplotFiles[i][j][1] = new File(gnuplotBaseDir, examples[i] + "_length_" + algorithms[j] + ".data"); - // gnuplotFiles[i][j][2] = new File(gnuplotBaseDir, examples[i] + "_runtime_" + algorithms[j] + ".data"); - // } - //} - File statFile = new File(statBaseDir, "statistics.txt"); - File statDetailsFile = new File(statBaseDir, "statistics_details.txt"); String statString = "**automatically generated statistics**\n\n"; - String statDetailsString = statString; - ComponentManager cm = ComponentManager.getInstance(); - - // just set default options -// ConfigurationManager confMgr = new ConfigurationManager(); -// confMgr.applyOptions(); - for(int exampleNr=startExampleNr; exampleNr < examples.length; exampleNr++) { - // parse current conf file - ConfParser learner = ConfParser.parseFile(confFiles[exampleNr]); - - String baseDir = confFiles[exampleNr].getParent(); - - // read which files were imported (internal KB is ignored) and initialise reasoner - Map<URL, OntologyFormat> imports = getImports(learner.getFunctionCalls(), confFiles[exampleNr]); - //Map<URL, Class<? extends KnowledgeSource>> imports = Start.getImportedFiles(learner, baseDir); - - // detect specified positive and negative examples - SortedSet<String> positiveExamples = learner.getPositiveExamples(); - SortedSet<String> negativeExamples = learner.getNegativeExamples(); - int nrOfExamples = positiveExamples.size() + negativeExamples.size(); - - statString += "example: " + examples[exampleNr] + "\n\n"; - - for(int algorithmNr=startAlgorithmNr; algorithmNr < algorithms.length; algorithmNr++) { + for(int algorithmNr=startAlgorithmNr; algorithmNr < algorithmPostfix.length; algorithmNr++) { // reset algorithm number (next example starts with first algorithm) startAlgorithmNr = 0; + File confFile = new File(confFiles[exampleNr] + algorithmPostfix[algorithmNr] + ".conf"); + + CrossValidation cv = new CrossValidation(confFile, 5, false); Stat classification = new Stat(); Stat length = new Stat(); Stat runtime = new Stat(); - for(int runNr=0; runNr < algorithmRuns[algorithmNr]; runNr++) { - - // create reasoner (this has to be done in this inner loop to - // ensure that none of the algorithm benefits from e.g. caching - // of previous reasoning requests - // Reasoner reasoner = Main.createReasoner(new KB(), imports); - // TODO: needs fixing - KnowledgeSource ks = cm.knowledgeSource(OWLFile.class); - ReasonerComponent reasoner = cm.reasoner(DIGReasoner.class, ks); - ReasoningService rs = new ReasoningService(reasoner); - - // System.out.println(positiveExamples); - // System.out.println(negativeExamples); - // System.exit(0); - - // create learning problem - // LearningProblem learningProblem = new LearningProblem(rs, positiveExamples, negativeExamples); - LearningProblem learningProblem = cm.learningProblem(PosNegDefinitionLP.class, rs); - - // prepare reasoner for using subsumption and role hierarchy - // TODO: currently, it is a small unfairness that each algorithm - // uses the same reasoning object (e.g. the second algorithm may - // have a small advantage if the reasoner cached reasoning requests - // of the first algorithm) -// Helper.autoDetectConceptsAndRoles(rs); -// try { -// reasoner.prepareSubsumptionHierarchy(); -// reasoner.prepareRoleHierarchy(); -// // improving the subsumption hierarchy makes only sense -// // for the refinement based algorithm -// if(algorithmNr==0) -// reasoner.getSubsumptionHierarchy().improveSubsumptionHierarchy(); -// } catch (ReasoningMethodUnsupportedException e) { -// e.printStackTrace(); -// } - - LearningAlgorithm learningAlgorithm = null; - if(algorithmNr==0) { - // Config.algorithm = Algorithm.REFINEMENT; - // Config.Refinement.heuristic = Config.Refinement.Heuristic.FLEXIBLE; -// Config.Refinement.horizontalExpansionFactor = 0.6; -// Config.Refinement.quiet = true; - // Config.percentPerLengthUnit = 0.05; - // learningAlgorithm = new ROLearner(learningProblem); - // learningAlgorithm = cm.learningAlgorithm(ROLearner.class, learningProblem); - } else if(algorithmNr==1) { - // Config.algorithm = Algorithm.GP; -// Config.GP.algorithmType = GP.AlgorithmType.GENERATIONAL; -//// Config.GP.selectionType = GP.SelectionType.RANK_SELECTION; -// Config.GP.generations = 50; -// Config.GP.useFixedNumberOfGenerations = true; -// Config.GP.numberOfIndividuals = 201; - // if(exampleNr == 3 || exampleNr == 4) - // Config.GP.numberOfIndividuals = 51; -// Config.GP.refinementProbability = 0; -// Config.GP.mutationProbability = 0.02; -// Config.GP.crossoverProbability = 0.8; -// Config.GP.hillClimbingProbability = 0; - // Config.percentPerLengthUnit = 0.005; - // give GP a chance to find the long solution of the - // uncle problem - // if(exampleNr==3 || exampleNr==5 || exampleNr == 6) - // Config.percentPerLengthUnit = 0.002; - // learningAlgorithm = new GP(learningProblem); - try { - learningAlgorithm = cm.learningAlgorithm(GP.class, learningProblem, rs); - } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } else if(algorithmNr==2) { - // Config.algorithm = Algorithm.HYBRID_GP; -// Config.GP.algorithmType = GP.AlgorithmType.GENERATIONAL; -// Config.GP.selectionType = GP.SelectionType.RANK_SELECTION; -// Config.GP.generations = 50; -// Config.GP.useFixedNumberOfGenerations = true; -// Config.GP.numberOfIndividuals = 201; - //if(exampleNr == 3 || exampleNr == 4) - // Config.GP.numberOfIndividuals = 51; -// Config.GP.refinementProbability = 0.65; -// Config.GP.mutationProbability = 0.02; -// Config.GP.crossoverProbability = 0.2; -// Config.GP.hillClimbingProbability = 0; - // Config.percentPerLengthUnit = 0.005; - // if(exampleNr == 3 || exampleNr==5 || exampleNr==6) -// Config.percentPerLengthUnit = 0.002; - // learningAlgorithm = new GP(learningProblem); - try { - learningAlgorithm = cm.learningAlgorithm(GP.class, learningProblem, rs); - } catch (LearningProblemUnsupportedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - // rs.resetStatistics(); - - long algorithmStartTime = System.nanoTime(); - learningAlgorithm.start(); - long algorithmTime = System.nanoTime() - algorithmStartTime; - // long algorithmTimeSeconds = algorithmTime / 1000000000; - - int conceptLength = learningAlgorithm.getBestSolution().getLength(); - Score bestScore = learningAlgorithm.getSolutionScore(); - int misClassifications = bestScore.getCoveredNegatives().size() - + bestScore.getNotCoveredPositives().size(); - double classificationRatePercent = 100 * ((nrOfExamples - misClassifications) / (double) nrOfExamples); - - classification.addNumber(classificationRatePercent); - length.addNumber(conceptLength); - runtime.addNumber(algorithmTime); - - // free knowledge base to avoid memory leaks - ((DIGReasoner) reasoner).releaseKB(); - - statDetailsString += "example: " + examples[exampleNr] + "\n"; - statDetailsString += "algorithm: " + algorithms[algorithmNr] + "\n"; - statDetailsString += "learned concept: " + learningAlgorithm.getBestSolution() + "\n"; - statDetailsString += "classification: " + classificationRatePercent + "%\n"; - statDetailsString += "concept length: " + conceptLength + "\n"; - statDetailsString += "runtime: " + Helper.prettyPrintNanoSeconds(algorithmTime) + "\n\n"; - - Files.createFile(statDetailsFile, statDetailsString); - - } // end run loop - - statString += "algorithm: " + algorithms[algorithmNr] + " (runs: " + algorithmRuns[algorithmNr] + ")\n"; + statString += "conf file: " + confFile + "\n"; statString += "classification: " + classification.getMean() + "% (standard deviation: " + classification.getStandardDeviation() + "%)\n"; statString += "concept length: " + length.getMean() + " (standard deviation: " + length.getStandardDeviation() + ")\n"; statString += "runtime: " + Helper.prettyPrintNanoSeconds(Math.round(runtime.getMean())) + " (standard deviation: " + Helper.prettyPrintNanoSeconds(Math.round(runtime.getStandardDeviation())) + ")\n\n"; @@ -316,6 +151,7 @@ } + @SuppressWarnings({"unused"}) private static Map<URL, OntologyFormat> getImports(Map<String,List<List<String>>> functionCalls, File confFile) { Map<URL, OntologyFormat> importedFiles = new HashMap<URL, OntologyFormat>(); @@ -358,9 +194,6 @@ return importedFiles; } - // erzeugt Statistiken für MLDM-Paper zur Verarbeitung mit GnuPlot - // Vorsicht: Laufzeit von mehreren Stunden - /** * Has been used to create the statistics for the MLDM 2007 paper. * Warning: this method runs for several hours Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2008-06-02 12:36:06 UTC (rev 933) +++ trunk/src/php-examples/LearningSimple.php 2008-06-03 14:29:22 UTC (rev 934) @@ -30,7 +30,7 @@ // 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); +Utilities::loadWSDLfiles($wsdluri); // specifiy ontology $ontology = 'file:'.realpath("../../examples/family/father.owl"); @@ -42,7 +42,7 @@ // 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"); +$rID = $client->setReasoner($id, "owlapi"); // create a learning problem $posExamples = array('http://example.com/father#stefan', This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-06-04 11:50:57
|
Revision: 937 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=937&view=rev Author: jenslehmann Date: 2008-06-04 04:50:54 -0700 (Wed, 04 Jun 2008) Log Message: ----------- music recommender started Added Paths: ----------- trunk/src/music-recommender/ trunk/src/music-recommender/ajax.php trunk/src/music-recommender/def0.xsd trunk/src/music-recommender/def1.xsd trunk/src/music-recommender/index.php trunk/src/music-recommender/main.wsdl Added: trunk/src/music-recommender/ajax.php =================================================================== --- trunk/src/music-recommender/ajax.php (rev 0) +++ trunk/src/music-recommender/ajax.php 2008-06-04 11:50:54 UTC (rev 937) @@ -0,0 +1,50 @@ +<?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/>. + * + */ + + /** + * Music recommender index page. + * + * @author Jens Lehmann + * @author Anita Janassary + */ + +require_once '../dbpedia-navigator/xajax/xajax_core/xajax.inc.php'; + +$xajax = new xajax(); + +// register functions +$xajax->registerFunction("doSearch"); + + +$xajax->processRequest(); + +// 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 + + $objResponse = new xajaxResponse(); + $objResponse->assign("searchElement","innerHTML", $newContent); + return $objResponse; +} + +?> \ No newline at end of file Added: trunk/src/music-recommender/def0.xsd =================================================================== --- trunk/src/music-recommender/def0.xsd (rev 0) +++ trunk/src/music-recommender/def0.xsd 2008-06-04 11:50:54 UTC (rev 937) @@ -0,0 +1,58 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:tns="http://server.dllearner.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://server.dllearner.org/" version="1.0"> + + <xs:element name="ClientNotKnownException" type="tns:ClientNotKnownException"></xs:element> + + <xs:element name="ComponentInitException" type="tns:ComponentInitException"></xs:element> + + <xs:element name="ConfigOptionTypeException" type="tns:ConfigOptionTypeException"></xs:element> + + <xs:element name="LearningProblemUnsupportedException" type="tns:LearningProblemUnsupportedException"></xs:element> + + <xs:element name="ParseException" type="tns:ParseException"></xs:element> + + <xs:element name="SparqlQueryException" type="tns:SparqlQueryException"></xs:element> + + <xs:element name="UnknownComponentException" type="tns:UnknownComponentException"></xs:element> + + <xs:complexType name="ParseException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ClientNotKnownException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="SparqlQueryException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="UnknownComponentException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ConfigOptionTypeException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="ComponentInitException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType name="LearningProblemUnsupportedException"> + <xs:sequence> + <xs:element name="message" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/music-recommender/def1.xsd =================================================================== --- trunk/src/music-recommender/def1.xsd (rev 0) +++ trunk/src/music-recommender/def1.xsd 2008-06-04 11:50:54 UTC (rev 937) @@ -0,0 +1,14 @@ +<?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jaxb.dev.java.net/array" version="1.0"> + + <xs:complexType final="#all" name="stringArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:string" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> + + <xs:complexType final="#all" name="intArray"> + <xs:sequence> + <xs:element nillable="true" maxOccurs="unbounded" name="item" type="xs:int" minOccurs="0"></xs:element> + </xs:sequence> + </xs:complexType> +</xs:schema> \ No newline at end of file Added: trunk/src/music-recommender/index.php =================================================================== --- trunk/src/music-recommender/index.php (rev 0) +++ trunk/src/music-recommender/index.php 2008-06-04 11:50:54 UTC (rev 937) @@ -0,0 +1,77 @@ +<?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/>. + * + */ + + /** + * Music recommender index page. + * + * @author Jens Lehmann + * @author Anita Janassary + */ + +// NOTE: We use the xajax-Framework already included in DBpedia-Navigator, so we assume that +// the "dbpedia-navigator" is in the same directory as "music-recommender". + +ini_set("soap.wsdl_cache_enabled","0"); +// due to bugs in Java _and_ PHP, we have to download the WSDL and XSD +// files locally (if even this does not work you have to do it by hand); +// whenever the web service changes, you have to delete those files +if(!file_exists('main.wsdl')) { + include('../php-examples/Utilities.php'); + $wsdluri="http://localhost:8181/services?wsdl"; + Utilities::loadWSDLfiles($wsdluri); +} + +// $client = new SoapClient('main.wsdl'); +// $build = $client->getBuild(); +// echo $build; + +require_once 'ajax.php'; + +echo '<?xml version="1.0" encoding="UTF-8"?>'; +?> +<!DOCTYPE html + PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> + <head> + <title>DL-Learner Music Recommender</title> + <meta http-equiv="content-type" content="text/html; charset=UTF-8"/> + <?php $xajax->printJavascript('../dbpedia-navigator/xajax/'); ?> + <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> + </head> + <body> + <h1>Music Recommender</h1> + + <h2>Search</h2> + <!-- search form --> + <input type="text" id="label" /> + <button onclick="xajax_doSearch(document.getElementById('label').value);">search</button> + + <!-- search result display --> + <div id="searchElement"></div> + + <h2>Song List</h2> + <a href="http://mediaplayer.yahoo.com/example1.mp3">song 1</a> <br /> + <a href="http://mediaplayer.yahoo.com/example2.mp3">song 2</a> <br /> + <a href="http://mediaplayer.yahoo.com/example3.mp3">song 3</a> + + </body> +</html> Added: trunk/src/music-recommender/main.wsdl =================================================================== --- trunk/src/music-recommender/main.wsdl (rev 0) +++ trunk/src/music-recommender/main.wsdl 2008-06-04 11:50:54 UTC (rev 937) @@ -0,0 +1,1238 @@ +<?xml version="1.0" encoding="UTF-8"?><definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> + <types> + <xsd:schema> + <xsd:import schemaLocation="def0.xsd" namespace="http://server.dllearner.org/"></xsd:import> + </xsd:schema> + <xsd:schema> + <xsd:import schemaLocation="def1.xsd" namespace="http://jaxb.dev.java.net/array"></xsd:import> + </xsd:schema> + </types> + <message name="init"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="initResponse"></message> + <message name="ClientNotKnownException"> + <part element="tns:ClientNotKnownException" name="fault"></part> + </message> + <message name="UnknownComponentException"> + <part element="tns:UnknownComponentException" name="fault"></part> + </message> + <message name="ComponentInitException"> + <part element="tns:ComponentInitException" name="fault"></part> + </message> + <message name="debug"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="debugResponse"></message> + <message name="stop"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="stopResponse"></message> + <message name="getBuild"></message> + <message name="getBuildResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="generateID"></message> + <message name="generateIDResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getComponents"></message> + <message name="getComponentsResponse"> + <part xmlns:ns1="http://jaxb.dev.java.net/array" name="return" type="ns1:stringArray"></part> + </message> + <message name="getKnowledgeSources"></message> + <message name="getKnowledgeSourcesResponse"> + <part xmlns:ns2="http://jaxb.dev.java.net/array" name="return" type="ns2:stringArray"></part> + </message> + <message name="getReasoners"></message> + <message name="getReasonersResponse"> + <part xmlns:ns3="http://jaxb.dev.java.net/array" name="return" type="ns3:stringArray"></part> + </message> + <message name="getLearningProblems"></message> + <message name="getLearningProblemsResponse"> + <part xmlns:ns4="http://jaxb.dev.java.net/array" name="return" type="ns4:stringArray"></part> + </message> + <message name="getLearningAlgorithms"></message> + <message name="getLearningAlgorithmsResponse"> + <part xmlns:ns5="http://jaxb.dev.java.net/array" name="return" type="ns5:stringArray"></part> + </message> + <message name="getConfigOptions"> + <part name="arg0" type="xsd:string"></part> + <part name="arg1" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionsResponse"> + <part xmlns:ns6="http://jaxb.dev.java.net/array" name="return" type="ns6:stringArray"></part> + </message> + <message name="addKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="addKnowledgeSourceResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="removeKnowledgeSource"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="removeKnowledgeSourceResponse"></message> + <message name="setReasoner"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setReasonerResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningProblem"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningProblemResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="setLearningAlgorithm"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="setLearningAlgorithmResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="LearningProblemUnsupportedException"> + <part element="tns:LearningProblemUnsupportedException" name="fault"></part> + </message> + <message name="initAll"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="initAllResponse"></message> + <message name="learn"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="learnResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="learnThreaded"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="learnThreadedResponse"></message> + <message name="getCurrentlyBestConcept"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestConceptResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getCurrentlyBestConcepts"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getCurrentlyBestConceptsResponse"> + <part xmlns:ns7="http://jaxb.dev.java.net/array" name="return" type="ns7:stringArray"></part> + </message> + <message name="isAlgorithmRunning"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="isAlgorithmRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="setPositiveExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns8="http://jaxb.dev.java.net/array" name="arg1" type="ns8:stringArray"></part> + </message> + <message name="setPositiveExamplesResponse"></message> + <message name="setNegativeExamples"> + <part name="arg0" type="xsd:int"></part> + <part xmlns:ns9="http://jaxb.dev.java.net/array" name="arg1" type="ns9:stringArray"></part> + </message> + <message name="setNegativeExamplesResponse"></message> + <message name="applyConfigEntryInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:int"></part> + </message> + <message name="applyConfigEntryIntResponse"></message> + <message name="applyConfigEntryString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:string"></part> + </message> + <message name="applyConfigEntryStringResponse"></message> + <message name="applyConfigEntryStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part xmlns:ns10="http://jaxb.dev.java.net/array" name="arg3" type="ns10:stringArray"></part> + </message> + <message name="applyConfigEntryStringArrayResponse"></message> + <message name="applyConfigEntryBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + <part name="arg3" type="xsd:boolean"></part> + </message> + <message name="applyConfigEntryBooleanResponse"></message> + <message name="getConfigOptionValueStringArray"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringArrayResponse"> + <part xmlns:ns11="http://jaxb.dev.java.net/array" name="return" type="ns11:stringArray"></part> + </message> + <message name="ConfigOptionTypeException"> + <part element="tns:ConfigOptionTypeException" name="fault"></part> + </message> + <message name="getConfigOptionValueString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDouble"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueDoubleResponse"> + <part name="return" type="xsd:double"></part> + </message> + <message name="getConfigOptionValueBoolean"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueBooleanResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="getConfigOptionValueInt"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="getConfigOptionValueIntResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicConcepts"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicConceptsResponse"> + <part xmlns:ns12="http://jaxb.dev.java.net/array" name="return" type="ns12:stringArray"></part> + </message> + <message name="getSubsumptionHierarchy"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getSubsumptionHierarchyResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="retrieval"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="retrievalResponse"> + <part xmlns:ns13="http://jaxb.dev.java.net/array" name="return" type="ns13:stringArray"></part> + </message> + <message name="ParseException"> + <part element="tns:ParseException" name="fault"></part> + </message> + <message name="getConceptLength"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="getConceptLengthResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="getAtomicRoles"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getAtomicRolesResponse"> + <part xmlns:ns14="http://jaxb.dev.java.net/array" name="return" type="ns14:stringArray"></part> + </message> + <message name="getInstances"> + <part name="arg0" type="xsd:int"></part> + </message> + <message name="getInstancesResponse"> + <part xmlns:ns15="http://jaxb.dev.java.net/array" name="return" type="ns15:stringArray"></part> + </message> + <message name="getIndividualsForARole"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:string"></part> + </message> + <message name="getIndividualsForARoleResponse"> + <part xmlns:ns16="http://jaxb.dev.java.net/array" name="return" type="ns16:stringArray"></part> + </message> + <message name="getAsJSON"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getAsJSONResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="SparqlQueryException"> + <part element="tns:SparqlQueryException" name="fault"></part> + </message> + <message name="getAsXMLString"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getAsXMLStringResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="sparqlQueryThreaded"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="sparqlQueryThreadedResponse"> + <part name="return" type="xsd:int"></part> + </message> + <message name="sparqlQuery"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + <part name="arg2" type="xsd:string"></part> + </message> + <message name="sparqlQueryResponse"> + <part name="return" type="xsd:string"></part> + </message> + <message name="isSparqlQueryRunning"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="isSparqlQueryRunningResponse"> + <part name="return" type="xsd:boolean"></part> + </message> + <message name="stopSparqlThread"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="stopSparqlThreadResponse"></message> + <message name="getConceptDepth"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getConceptDepthResponse"> + <part xmlns:ns17="http://jaxb.dev.java.net/array" name="return" type="ns17:intArray"></part> + </message> + <message name="getConceptArity"> + <part name="arg0" type="xsd:int"></part> + <part name="arg1" type="xsd:int"></part> + </message> + <message name="getConceptArityResponse"> + <part xmlns:ns18="http://jaxb.dev.java.net/array" name="return" type="ns18:intArray"></part> + </message> + <message name="SparqlRetrieval"> + <part name="arg0" type="xsd:string"></part> + </message> + <message name="SparqlRetrievalResponse"> + <part name="return" type="xsd:string"></part> + </message> + <portType name="DLLearnerWebService"> + <operation name="init" parameterOrder="arg0 arg1"> + <input message="tns:init"></input> + <output message="tns:initResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="debug" parameterOrder="arg0"> + <input message="tns:debug"></input> + <output message="tns:debugResponse"></output> + </operation> + <operation name="stop" parameterOrder="arg0"> + <input message="tns:stop"></input> + <output message="tns:stopResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getBuild" parameterOrder=""> + <input message="tns:getBuild"></input> + <output message="tns:getBuildResponse"></output> + </operation> + <operation name="generateID" parameterOrder=""> + <input message="tns:generateID"></input> + <output message="tns:generateIDResponse"></output> + </operation> + <operation name="getComponents" parameterOrder=""> + <input message="tns:getComponents"></input> + <output message="tns:getComponentsResponse"></output> + </operation> + <operation name="getKnowledgeSources" parameterOrder=""> + <input message="tns:getKnowledgeSources"></input> + <output message="tns:getKnowledgeSourcesResponse"></output> + </operation> + <operation name="getReasoners" parameterOrder=""> + <input message="tns:getReasoners"></input> + <output message="tns:getReasonersResponse"></output> + </operation> + <operation name="getLearningProblems" parameterOrder=""> + <input message="tns:getLearningProblems"></input> + <output message="tns:getLearningProblemsResponse"></output> + </operation> + <operation name="getLearningAlgorithms" parameterOrder=""> + <input message="tns:getLearningAlgorithms"></input> + <output message="tns:getLearningAlgorithmsResponse"></output> + </operation> + <operation name="getConfigOptions" parameterOrder="arg0 arg1"> + <input message="tns:getConfigOptions"></input> + <output message="tns:getConfigOptionsResponse"></output> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="addKnowledgeSource" parameterOrder="arg0 arg1 arg2"> + <input message="tns:addKnowledgeSource"></input> + <output message="tns:addKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="removeKnowledgeSource" parameterOrder="arg0 arg1"> + <input message="tns:removeKnowledgeSource"></input> + <output message="tns:removeKnowledgeSourceResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setReasoner" parameterOrder="arg0 arg1"> + <input message="tns:setReasoner"></input> + <output message="tns:setReasonerResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningProblem" parameterOrder="arg0 arg1"> + <input message="tns:setLearningProblem"></input> + <output message="tns:setLearningProblemResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="setLearningAlgorithm" parameterOrder="arg0 arg1"> + <input message="tns:setLearningAlgorithm"></input> + <output message="tns:setLearningAlgorithmResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:LearningProblemUnsupportedException" name="LearningProblemUnsupportedException"></fault> + </operation> + <operation name="initAll" parameterOrder="arg0"> + <input message="tns:initAll"></input> + <output message="tns:initAllResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> + </operation> + <operation name="learn" parameterOrder="arg0 arg1"> + <input message="tns:learn"></input> + <output message="tns:learnResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="learnThreaded" parameterOrder="arg0"> + <input message="tns:learnThreaded"></input> + <output message="tns:learnThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcept" parameterOrder="arg0"> + <input message="tns:getCurrentlyBestConcept"></input> + <output message="tns:getCurrentlyBestConceptResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getCurrentlyBestConcepts" parameterOrder="arg0 arg1"> + <input message="tns:getCurrentlyBestConcepts"></input> + <output message="tns:getCurrentlyBestConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isAlgorithmRunning" parameterOrder="arg0"> + <input message="tns:isAlgorithmRunning"></input> + <output message="tns:isAlgorithmRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setPositiveExamples" parameterOrder="arg0 arg1"> + <input message="tns:setPositiveExamples"></input> + <output message="tns:setPositiveExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="setNegativeExamples" parameterOrder="arg0 arg1"> + <input message="tns:setNegativeExamples"></input> + <output message="tns:setNegativeExamplesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="applyConfigEntryInt" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryInt"></input> + <output message="tns:applyConfigEntryIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryString" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryString"></input> + <output message="tns:applyConfigEntryStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryStringArray" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryStringArray"></input> + <output message="tns:applyConfigEntryStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="applyConfigEntryBoolean" parameterOrder="arg0 arg1 arg2 arg3"> + <input message="tns:applyConfigEntryBoolean"></input> + <output message="tns:applyConfigEntryBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + </operation> + <operation name="getConfigOptionValueStringArray" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueStringArray"></input> + <output message="tns:getConfigOptionValueStringArrayResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueString" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueString"></input> + <output message="tns:getConfigOptionValueStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueDouble" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueDouble"></input> + <output message="tns:getConfigOptionValueDoubleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueBoolean" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueBoolean"></input> + <output message="tns:getConfigOptionValueBooleanResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getConfigOptionValueInt" parameterOrder="arg0 arg1 arg2"> + <input message="tns:getConfigOptionValueInt"></input> + <output message="tns:getConfigOptionValueIntResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> + <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> + </operation> + <operation name="getAtomicConcepts" parameterOrder="arg0"> + <input message="tns:getAtomicConcepts"></input> + <output message="tns:getAtomicConceptsResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getSubsumptionHierarchy" parameterOrder="arg0"> + <input message="tns:getSubsumptionHierarchy"></input> + <output message="tns:getSubsumptionHierarchyResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="retrieval" parameterOrder="arg0 arg1"> + <input message="tns:retrieval"></input> + <output message="tns:retrievalResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getConceptLength" parameterOrder="arg0"> + <input message="tns:getConceptLength"></input> + <output message="tns:getConceptLengthResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + <operation name="getAtomicRoles" parameterOrder="arg0"> + <input message="tns:getAtomicRoles"></input> + <output message="tns:getAtomicRolesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getInstances" parameterOrder="arg0"> + <input message="tns:getInstances"></input> + <output message="tns:getInstancesResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getIndividualsForARole" parameterOrder="arg0 arg1"> + <input message="tns:getIndividualsForARole"></input> + <output message="tns:getIndividualsForARoleResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getAsJSON" parameterOrder="arg0 arg1"> + <input message="tns:getAsJSON"></input> + <output message="tns:getAsJSONResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + <fault message="tns:SparqlQueryException" name="SparqlQueryException"></fault> + </operation> + <operation name="getAsXMLString" parameterOrder="arg0 arg1"> + <input message="tns:getAsXMLString"></input> + <output message="tns:getAsXMLStringResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="sparqlQueryThreaded" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQueryThreaded"></input> + <output message="tns:sparqlQueryThreadedResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="sparqlQuery" parameterOrder="arg0 arg1 arg2"> + <input message="tns:sparqlQuery"></input> + <output message="tns:sparqlQueryResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="isSparqlQueryRunning" parameterOrder="arg0 arg1"> + <input message="tns:isSparqlQueryRunning"></input> + <output message="tns:isSparqlQueryRunningResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="stopSparqlThread" parameterOrder="arg0 arg1"> + <input message="tns:stopSparqlThread"></input> + <output message="tns:stopSparqlThreadResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getConceptDepth" parameterOrder="arg0 arg1"> + <input message="tns:getConceptDepth"></input> + <output message="tns:getConceptDepthResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="getConceptArity" parameterOrder="arg0 arg1"> + <input message="tns:getConceptArity"></input> + <output message="tns:getConceptArityResponse"></output> + <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> + </operation> + <operation name="SparqlRetrieval" parameterOrder="arg0"> + <input message="tns:SparqlRetrieval"></input> + <output message="tns:SparqlRetrievalResponse"></output> + <fault message="tns:ParseException" name="ParseException"></fault> + </operation> + </portType> + <binding name="DLLearnerWebServicePortBinding" type="tns:DLLearnerWebService"> + <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding> + <operation name="init"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ComponentInitException"> + <soap:fault name="ComponentInitException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="debug"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="stop"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getBuild"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="generateID"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getComponents"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getKnowledgeSources"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getReasoners"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningProblems"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getLearningAlgorithms"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + </operation> + <operation name="getConfigOptions"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="addKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="removeKnowledgeSource"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setReasoner"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningProblem"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setLearningAlgorithm"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="LearningProblemUnsupportedException"> + <soap:fault name="LearningProblemUnsupportedException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="initAll"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="ComponentInitException"> + <soap:fault name="ComponentInitException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learn"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="learnThreaded"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcept"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getCurrentlyBestConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="isAlgorithmRunning"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setPositiveExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="setNegativeExamples"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="applyConfigEntryBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueStringArray"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueString"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueDouble"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueBoolean"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConfigOptionValueInt"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="UnknownComponentException"> + <soap:fault name="UnknownComponentException" use="literal"></soap:fault> + </fault> + <fault name="ConfigOptionTypeException"> + <soap:fault name="ConfigOptionTypeException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicConcepts"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getSubsumptionHierarchy"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="retrieval"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getConceptLength"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ParseException"> + <soap:fault name="ParseException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getAtomicRoles"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getInstances"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </input> + <output> + <soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> + </output> + <fault name="ClientNotKnownException"> + <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> + </fault> + </operation> + <operation name="getIndividualsForARole"> + <soap:operation soapAction=""></soap:operation> + <input> + <soap:body use="literal" ... [truncated message content] |
From: <Jen...@us...> - 2008-06-26 10:44:41
|
Revision: 983 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=983&view=rev Author: JensLehmann Date: 2008-06-26 03:44:36 -0700 (Thu, 26 Jun 2008) Log Message: ----------- - ComponentInitException thrown when loading inconsistent ontologies into OWL API reasoner - OWL API bug test file Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/test/OWLAPIBugDemo.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloser.java trunk/src/php-examples/LearningSimple.php Added Paths: ----------- trunk/src/dl-learner/org/dllearner/test/OWLAPIConsistency.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-06-26 06:52:48 UTC (rev 982) +++ trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java 2008-06-26 10:44:36 UTC (rev 983) @@ -36,6 +36,7 @@ import org.apache.log4j.Level; import org.apache.log4j.Logger; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.config.ConfigEntry; @@ -162,7 +163,7 @@ } @Override - public void init() { + public void init() throws ComponentInitException { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); // it is a bit cumbersome to obtain all classes, because there @@ -294,10 +295,19 @@ // compute class hierarchy and types of individuals // (done here to speed up later reasoner calls) + boolean inconsistentOntology = false; try { reasoner.loadOntologies(allImports); - reasoner.classify(); - reasoner.realise(); + for(OWLOntology ont : owlAPIOntologies) { + if(!reasoner.isConsistent(ont)) { + inconsistentOntology = true; + throw new ComponentInitException("Inconsistent ontologies."); + } + } + if(!inconsistentOntology) { + reasoner.classify(); + reasoner.realise(); + } } catch (OWLReasonerException e) { e.printStackTrace(); } Modified: trunk/src/dl-learner/org/dllearner/test/OWLAPIBugDemo.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/OWLAPIBugDemo.java 2008-06-26 06:52:48 UTC (rev 982) +++ trunk/src/dl-learner/org/dllearner/test/OWLAPIBugDemo.java 2008-06-26 10:44:36 UTC (rev 983) @@ -17,7 +17,9 @@ OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); URI ontologyURI = URI.create("http://www.examples.com/test"); - File f = new File("test.owl"); +// File f = new File("test.owl"); + + File f = new File("src/dl-learner/org/dllearner/tools/ore/inconsistent.owl"); URI physicalURI = f.toURI(); SimpleURIMapper mapper = new SimpleURIMapper(ontologyURI, physicalURI); manager.addURIMapper(mapper); Added: trunk/src/dl-learner/org/dllearner/test/OWLAPIConsistency.java =================================================================== --- trunk/src/dl-learner/org/dllearner/test/OWLAPIConsistency.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/test/OWLAPIConsistency.java 2008-06-26 10:44:36 UTC (rev 983) @@ -0,0 +1,45 @@ +package org.dllearner.test; + +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.inference.OWLReasoner; +import org.semanticweb.owl.inference.OWLReasonerException; +import org.semanticweb.owl.model.*; + +import java.io.File; +import java.net.URI; +import java.util.Set; + +public class OWLAPIConsistency { + public static void main(String[] args) { + + try { + File f = new File("src/dl-learner/org/dllearner/tools/ore/inconsistent.owl"); + URI physicalURI = f.toURI(); + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + + OWLOntology ont = manager.loadOntologyFromPhysicalURI(physicalURI); + System.out.println("Loaded " + ont.getURI()); + + OWLReasoner reasoner = new org.mindswap.pellet.owlapi.Reasoner(manager); + + Set<OWLOntology> importsClosure = manager.getImportsClosure(ont); + reasoner.loadOntologies(importsClosure); +// reasoner.classify(); + + boolean consistent = reasoner.isConsistent(ont); + System.out.println("Consistent: " + consistent); + System.out.println("\n"); + + } + catch(UnsupportedOperationException exception) { + System.out.println("Unsupported reasoner operation."); + } + catch(OWLReasonerException ex) { + System.out.println("Reasoner error: " + ex.getMessage()); + } + catch (OWLOntologyCreationException e) { + System.out.println("Could not load the pizza ontology: " + e.getMessage()); + } + } +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-06-26 06:52:48 UTC (rev 982) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2008-06-26 10:44:36 UTC (rev 983) @@ -94,9 +94,14 @@ } - rs = cm.reasoningService(reasoner); +// rs = cm.reasoningService(reasoner); reasoner2 = cm.reasoner(OWLAPIReasoner.class, ks); - reasoner2.init(); + try { + reasoner2.init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } modi = new OntologyModifierOWLAPI(reasoner2); } @@ -475,12 +480,12 @@ final ORE test = new ORE(); - File owlFile = new File("src/dl-learner/org/dllearner/tools/ore/inkohaerent.owl"); + File owlFile = new File("src/dl-learner/org/dllearner/tools/ore/inconsistent.owl"); test.setKnowledgeSource(owlFile); test.detectReasoner(); - System.out.println(test.reasoner2.getInconsistentClasses()); +// System.out.println(test.reasoner2.getInconsistentClasses()); // System.err.println("Concepts :" + rs.getAtomicConcepts()); Modified: trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-06-26 06:52:48 UTC (rev 982) +++ trunk/src/dl-learner/org/dllearner/tools/protege/DLLearnerModel.java 2008-06-26 10:44:36 UTC (rev 983) @@ -286,7 +286,12 @@ public void setReasoner() { this.reasoner =cm.reasoner(OWLAPIReasoner.class,source); - reasoner.init(); + try { + reasoner.init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } rs = cm.reasoningService(reasoner); } Modified: trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloser.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloser.java 2008-06-26 06:52:48 UTC (rev 982) +++ trunk/src/dl-learner/org/dllearner/utilities/owl/OntologyCloser.java 2008-06-26 10:44:36 UTC (rev 983) @@ -8,6 +8,7 @@ import java.util.SortedSet; import java.util.TreeSet; +import org.dllearner.core.ComponentInitException; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.ReasoningService; import org.dllearner.core.owl.ClassAssertionAxiom; @@ -47,7 +48,12 @@ Set<KnowledgeSource> ks = new HashSet<KnowledgeSource>(); ks.add(this.kbFile); OWLAPIReasoner owlapi = new OWLAPIReasoner(ks); - owlapi.init(); + try { + owlapi.init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } this.indToRestr = new HashMap<Individual, Set<ObjectExactCardinalityRestriction>>(); this.classes = new HashSet<Description>(); this.rs = new ReasoningService(owlapi); @@ -64,7 +70,12 @@ sc.printAndSet("updating reasoner"); OWLAPIReasoner owlapi = new OWLAPIReasoner(ks); sc.printAndSet("init"); - owlapi.init(); + try { + owlapi.init(); + } catch (ComponentInitException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } sc.printAndSet(); this.rs = new ReasoningService(owlapi); Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2008-06-26 06:52:48 UTC (rev 982) +++ trunk/src/php-examples/LearningSimple.php 2008-06-26 10:44:36 UTC (rev 983) @@ -62,7 +62,7 @@ // learn concept echo 'start learning ... '; -$concept = $client->learn($id); +$concept = $client->learn($id, "manchester"); echo 'OK <br />'; echo 'solution: ' . $concept; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2008-06-30 14:12:52
|
Revision: 994 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=994&view=rev Author: jenslehmann Date: 2008-06-30 07:12:50 -0700 (Mon, 30 Jun 2008) Log Message: ----------- added converter of evaluated descriptions to a JSON format to simplify exchanging solutions Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-examples/LearningSimple.php Modified: trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-06-30 11:26:39 UTC (rev 993) +++ trunk/src/dl-learner/org/dllearner/algorithms/refinement/ROLearner.java 2008-06-30 14:12:50 UTC (rev 994) @@ -1071,9 +1071,9 @@ @Override public Score getSolutionScore() { if(posOnly) - return posOnlyLearningProblem.computeScore(getCurrentlyBestEvaluatedDescription().getDescription()); + return posOnlyLearningProblem.computeScore(getCurrentlyBestDescription()); else - return learningProblem.computeScore(getCurrentlyBestEvaluatedDescription().getDescription()); + return learningProblem.computeScore(getCurrentlyBestDescription()); } Modified: trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-06-30 11:26:39 UTC (rev 993) +++ trunk/src/dl-learner/org/dllearner/core/EvaluatedDescription.java 2008-06-30 14:12:50 UTC (rev 994) @@ -25,6 +25,9 @@ import org.dllearner.core.owl.Individual; import org.dllearner.kb.sparql.SparqlQueryDescriptionConvertVisitor; import org.dllearner.learningproblems.ScoreTwoValued; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; /** * This represents a class description, which has been @@ -138,4 +141,35 @@ public String getSparqlQuery(int limit) { return SparqlQueryDescriptionConvertVisitor.getSparqlQuery(description, limit); } + + /** + * This convenience method can be used to store and exchange evaluated + * descriptions by transforming them to a JSON string. + * @return A JSON representation of an evaluated description. + */ + public String asJSON() { + JSONObject object = new JSONObject(); + try { + object.put("descriptionManchesterSyntax", description.toManchesterSyntaxString(null, null)); + object.put("accuracy", score.getAccuracy()); + object.put("coveredPositives", getJSONArray(score.getCoveredPositives())); + object.put("coveredNegatives", getJSONArray(score.getCoveredNegatives())); + object.put("notCoveredPositives", getJSONArray(score.getNotCoveredPositives())); + object.put("notCoveredNegatives", getJSONArray(score.getNotCoveredNegatives())); + return object.toString(3); + } catch (JSONException e) { + e.printStackTrace(); + return null; + } + } + + // we need to use this method instead of the standard JSON array constructor, + // otherwise we'll get unexpected results (JSONArray does not take Individuals + // as arguments and does not use toString) + private static JSONArray getJSONArray(Set<Individual> individuals) { + JSONArray j = new JSONArray(); + for(Individual i : individuals) + j.put(i.getName()); + return j; + } } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-06-30 11:26:39 UTC (rev 993) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2008-06-30 14:12:50 UTC (rev 994) @@ -45,6 +45,7 @@ import org.dllearner.core.Component; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; +import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; import org.dllearner.core.LearningProblem; @@ -317,6 +318,20 @@ return solution.toString(); } + @WebMethod + public String learnDescriptionsEvaluated(int id, int limit) throws ClientNotKnownException { + ClientState state = getState(id); + state.getLearningAlgorithm().start(); + List<EvaluatedDescription> descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(limit); + String json = "{"; + int count = 1; + for(EvaluatedDescription description : descriptions) { + json += "\"solution" + count + "\" : " + description.asJSON(); + count++; + } + return json; + } + /** * Starts the learning algorithm and returns immediately. The learning * algorithm is executed in its own thread and can be queried and Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2008-06-30 11:26:39 UTC (rev 993) +++ trunk/src/php-examples/LearningSimple.php 2008-06-30 14:12:50 UTC (rev 994) @@ -62,8 +62,11 @@ // learn concept echo 'start learning ... '; -$concept = $client->learn($id, "manchester"); +// get only concept +// $concept = $client->learn($id, "manchester"); +// get concept and additional information in JSON syntax +$concept = $client->learnDescriptionsEvaluated($id, 5); echo 'OK <br />'; -echo 'solution: ' . $concept; +echo 'solution: <pre>' . $concept . '</pre>'; ?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |