From: <lor...@us...> - 2012-02-05 18:25:58
|
Revision: 3564 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=3564&view=rev Author: lorenz_b Date: 2012-02-05 18:25:51 +0000 (Sun, 05 Feb 2012) Log Message: ----------- Added to CLI options to set query chunk size and max execution time in seconds. Modified Paths: -------------- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java trunk/interfaces/src/main/java/org/dllearner/cli/GlobalEnrichment.java Modified: trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2012-02-02 13:17:12 UTC (rev 3563) +++ trunk/interfaces/src/main/java/org/dllearner/cli/Enrichment.java 2012-02-05 18:25:51 UTC (rev 3564) @@ -208,6 +208,7 @@ // some learners) private int nrOfAxiomsToLearn = 10; private double threshold = 0.7; + private int chunksize = 1000; private boolean useInference; private SPARQLReasoner reasoner; @@ -231,13 +232,15 @@ private Set<OWLAxiom> learnedOWLAxioms; private Set<EvaluatedAxiom> learnedEvaluatedAxioms; - public Enrichment(SparqlEndpoint se, Entity resource, double threshold, int nrOfAxiomsToLearn, boolean useInference, boolean verbose) { + public Enrichment(SparqlEndpoint se, Entity resource, double threshold, int nrOfAxiomsToLearn, boolean useInference, boolean verbose, int chunksize, int maxExecutionTimeInSeconds) { this.se = se; this.resource = resource; this.verbose = verbose; this.threshold = threshold; this.nrOfAxiomsToLearn = nrOfAxiomsToLearn; this.useInference = useInference; + this.chunksize = chunksize; + this.maxExecutionTimeInSeconds = maxExecutionTimeInSeconds; try { cacheDir = "cache" + File.separator + URLEncoder.encode(se.getURL().toString(), "UTF-8"); @@ -487,6 +490,7 @@ } ConfigHelper.configure(learner, "maxExecutionTimeInSeconds", maxExecutionTimeInSeconds); + ((AbstractAxiomLearningAlgorithm)learner).setLimit(chunksize); learner.init(); if(reasoner != null){ ((AbstractAxiomLearningAlgorithm)learner).setReasoner(reasoner); @@ -801,6 +805,11 @@ .withRequiredArg().ofType(File.class); parser.acceptsAll(asList("a", "annotations"), "Specifies whether to save scores as annotations.").withOptionalArg().ofType(Boolean.class).defaultsTo(true); + parser.acceptsAll(asList("chunksize"), + "Specifies the chunk size for the query result as the approach is incrementally.").withRequiredArg().ofType(Integer.class).defaultsTo(1000); + parser.acceptsAll(asList("maxExecutionTimeInSeconds"), + "Specifies the max execution time for each algorithm run and each entity.").withRequiredArg().ofType(Integer.class).defaultsTo(10); + // parse options and display a message for the user in case of problems OptionSet options = null; try { @@ -886,6 +895,9 @@ maxNrOfResults = Integer.MAX_VALUE; } + int chunksize = (Integer) options.valueOf("chunksize"); + int runtime = (Integer) options.valueOf("runtime"); + // TODO: some handling for inaccessible files or overwriting existing files File f = (File) options.valueOf("o"); @@ -895,7 +907,7 @@ System.setOut(printStream); } - Enrichment e = new Enrichment(se, resource, threshold, maxNrOfResults, useInference, false); + Enrichment e = new Enrichment(se, resource, threshold, maxNrOfResults, useInference, false, chunksize, runtime); e.start(); SparqlEndpointKS ks = new SparqlEndpointKS(se); Modified: trunk/interfaces/src/main/java/org/dllearner/cli/GlobalEnrichment.java =================================================================== --- trunk/interfaces/src/main/java/org/dllearner/cli/GlobalEnrichment.java 2012-02-02 13:17:12 UTC (rev 3563) +++ trunk/interfaces/src/main/java/org/dllearner/cli/GlobalEnrichment.java 2012-02-05 18:25:51 UTC (rev 3564) @@ -78,6 +78,8 @@ // parameters private static double threshold = 0.8; private static int nrOfAxiomsToLearn = 10; + private static int queryChunkSize = 1000; + private static int maxExecutionTimeInSeconds = 10; private static boolean useInference = true; // directory for generated schemata @@ -187,7 +189,7 @@ File log = new File(baseDir + File.separator + "failed" + File.separator + name + ".log"); System.out.println("Enriching " + name + " using " + se.getURL()); - Enrichment e = new Enrichment(se, null, threshold, nrOfAxiomsToLearn, useInference, false); + Enrichment e = new Enrichment(se, null, threshold, nrOfAxiomsToLearn, useInference, false, queryChunkSize, maxExecutionTimeInSeconds); e.maxEntitiesPerType = 3; // hack for faster testing of endpoints This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |