From: <lor...@us...> - 2012-04-30 10:19:27
|
Revision: 3671 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3671&view=rev Author: lorenz_b Date: 2012-04-30 10:19:21 +0000 (Mon, 30 Apr 2012) Log Message: ----------- Added variable to get if no query was successfully executed before timeout, i.e. the whole algorithm got a timeout. Modified Paths: -------------- trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java Modified: trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java =================================================================== --- trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java 2012-04-30 10:17:46 UTC (rev 3670) +++ trunk/components-core/src/main/java/org/dllearner/core/AbstractAxiomLearningAlgorithm.java 2012-04-30 10:19:21 UTC (rev 3671) @@ -89,6 +89,8 @@ protected long startTime; protected int limit = 1000; + private boolean timeout = true; + public AbstractAxiomLearningAlgorithm() { existingAxioms = new TreeSet<Axiom>(new AxiomComparator()); } @@ -154,6 +156,7 @@ if(reasoner == null){ reasoner = new SPARQLReasoner((SparqlEndpointKS) ks); } + timeout = true; } @Override @@ -165,6 +168,10 @@ return getCurrentlyBestAxioms(nrOfAxioms, 0.0); } + public boolean isTimeout() { + return timeout; + } + public List<Axiom> getCurrentlyBestAxioms(int nrOfAxioms, double accuracyThreshold) { List<Axiom> bestAxioms = new ArrayList<Axiom>(); @@ -229,7 +236,9 @@ queryExecution.setDefaultGraphURIs(endpoint.getDefaultGraphURIs()); queryExecution.setNamedGraphURIs(endpoint.getNamedGraphURIs()); try { - return queryExecution.execConstruct(); + Model model = queryExecution.execConstruct(); + timeout = false; + return model; } catch (QueryExceptionHTTP e) { if(e.getCause() instanceof SocketTimeoutException){ logger.warn("Got timeout", e); @@ -254,7 +263,9 @@ queryExecution.setDefaultGraphURIs(endpoint.getDefaultGraphURIs()); queryExecution.setNamedGraphURIs(endpoint.getNamedGraphURIs()); try { - return queryExecution.execSelect(); + ResultSet rs = queryExecution.execSelect(); + timeout = false; + return rs; } catch (QueryExceptionHTTP e) { if(e.getCause() instanceof SocketTimeoutException){ logger.warn("Got timeout", e); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |