Author: ogrisel
Date: Fri Jan 20 17:26:03 2012
New Revision: 1234017

URL: http://svn.apache.org/viewvc?rev=1234017&view=rev
Log:
STANBOL-197: some package reorg

Added:
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/BatchProcessor.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSet.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSetException.java
Removed:
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/engine/topic/BatchProcessor.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/SolrTrainingSet.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TrainingSet.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TrainingSetException.java
Modified:
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TopicClassifier.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TopicEngineTest.java
    
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TrainingSetTest.java

Modified: 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java?rev=1234017&r1=1234016&r2=1234017&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/engine/topic/TopicClassificationEngine.java
 Fri Jan 20 17:26:03 2012
@@ -70,16 +70,17 @@ import org.apache.stanbol.enhancer.servi
 import org.apache.stanbol.enhancer.servicesapi.helper.EnhancementEngineHelper;
 import org.apache.stanbol.enhancer.servicesapi.rdf.TechnicalClasses;
 import org.apache.stanbol.enhancer.topic.Batch;
+import org.apache.stanbol.enhancer.topic.BatchProcessor;
 import org.apache.stanbol.enhancer.topic.ClassificationReport;
 import org.apache.stanbol.enhancer.topic.ClassifierException;
 import org.apache.stanbol.enhancer.topic.ConfiguredSolrCoreTracker;
 import org.apache.stanbol.enhancer.topic.EmbeddedSolrHelper;
 import org.apache.stanbol.enhancer.topic.TopicClassifier;
 import org.apache.stanbol.enhancer.topic.TopicSuggestion;
-import org.apache.stanbol.enhancer.topic.TrainingSet;
-import org.apache.stanbol.enhancer.topic.TrainingSetException;
 import org.apache.stanbol.enhancer.topic.UTCTimeStamper;
 import org.apache.stanbol.enhancer.topic.training.Example;
+import org.apache.stanbol.enhancer.topic.training.TrainingSet;
+import org.apache.stanbol.enhancer.topic.training.TrainingSetException;
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.component.ComponentContext;

Added: 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/BatchProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/BatchProcessor.java?rev=1234017&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/BatchProcessor.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/BatchProcessor.java
 Fri Jan 20 17:26:03 2012
@@ -0,0 +1,11 @@
+package org.apache.stanbol.enhancer.topic;
+
+import java.util.List;
+
+import org.apache.stanbol.enhancer.topic.training.TrainingSetException;
+
+public interface BatchProcessor<T> {
+
+    int process(List<T> batch) throws ClassifierException, 
TrainingSetException;
+
+}

Modified: 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TopicClassifier.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TopicClassifier.java?rev=1234017&r1=1234016&r2=1234017&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TopicClassifier.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/TopicClassifier.java
 Fri Jan 20 17:26:03 2012
@@ -21,6 +21,8 @@ import java.util.List;
 import java.util.Set;
 
 import org.apache.stanbol.enhancer.servicesapi.EngineException;
+import org.apache.stanbol.enhancer.topic.training.TrainingSet;
+import org.apache.stanbol.enhancer.topic.training.TrainingSetException;
 
 /**
  * Service interface for suggesting hierarchical topics from a specific scheme 
(a.k.a. taxonomy, thesaurus or

Added: 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java?rev=1234017&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/SolrTrainingSet.java
 Fri Jan 20 17:26:03 2012
@@ -0,0 +1,273 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.stanbol.enhancer.topic.training;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Dictionary;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.ConfigurationPolicy;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.util.ClientUtils;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.stanbol.enhancer.topic.Batch;
+import org.apache.stanbol.enhancer.topic.ConfiguredSolrCoreTracker;
+import org.apache.stanbol.enhancer.topic.UTCTimeStamper;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.component.ComponentContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of the {@code TrainingSet} interface that uses a Solr Core 
as backend to store and retrieve
+ * the text examples used to train a classifier.
+ */
+@Component(metatype = true, immediate = true, configurationFactory = true, 
policy = ConfigurationPolicy.REQUIRE)
+@Service
+@Properties(value = {@Property(name = SolrTrainingSet.TRAINING_SET_ID),
+                     @Property(name = SolrTrainingSet.SOLR_CORE),
+                     @Property(name = SolrTrainingSet.EXAMPLE_ID_FIELD),
+                     @Property(name = SolrTrainingSet.EXAMPLE_TEXT_FIELD),
+                     @Property(name = SolrTrainingSet.TOPICS_URI_FIELD),
+                     @Property(name = 
SolrTrainingSet.MODIFICATION_DATE_FIELD)})
+public class SolrTrainingSet extends ConfiguredSolrCoreTracker implements 
TrainingSet {
+
+    public static final String TRAINING_SET_ID = 
"org.apache.stanbol.enhancer.topic.trainingset.id";
+
+    public static final String SOLR_CORE = 
"org.apache.stanbol.enhancer.engine.topic.solrCore";
+
+    public static final String TOPICS_URI_FIELD = 
"org.apache.stanbol.enhancer.engine.topic.topicsUriField";
+
+    public static final String EXAMPLE_ID_FIELD = 
"org.apache.stanbol.enhancer.engine.topic.exampleIdField";
+
+    public static final String EXAMPLE_TEXT_FIELD = 
"org.apache.stanbol.enhancer.engine.topic.exampleTextField";
+
+    public static final String MODIFICATION_DATE_FIELD = 
"org.apache.stanbol.enhancer.engine.topic.modificiationDateField";
+
+    @SuppressWarnings("unused")
+    private static final Logger log = 
LoggerFactory.getLogger(SolrTrainingSet.class);
+
+    protected String trainingSetId;
+
+    protected String exampleIdField;
+
+    protected String exampleTextField;
+
+    protected String topicUrisField;
+
+    protected String modificationDateField;
+
+    // TODO: make me configurable using an OSGi property
+    protected int batchSize = 100;
+
+    @Activate
+    protected void activate(ComponentContext context) throws 
ConfigurationException, InvalidSyntaxException {
+        @SuppressWarnings("unchecked")
+        Dictionary<String,Object> config = context.getProperties();
+        this.context = context;
+        configure(config);
+    }
+
+    @Deactivate
+    public void deactivate(ComponentContext context) {
+        if (indexTracker != null) {
+            indexTracker.close();
+        }
+    }
+
+    @Override
+    public void configure(Dictionary<String,Object> config) throws 
ConfigurationException {
+        trainingSetId = getRequiredStringParam(config, TRAINING_SET_ID);
+        exampleIdField = getRequiredStringParam(config, EXAMPLE_ID_FIELD);
+        exampleTextField = getRequiredStringParam(config, EXAMPLE_TEXT_FIELD);
+        topicUrisField = getRequiredStringParam(config, TOPICS_URI_FIELD);
+        modificationDateField = getRequiredStringParam(config, 
MODIFICATION_DATE_FIELD);
+        configureSolrCore(config, SOLR_CORE);
+    }
+
+    public static ConfiguredSolrCoreTracker 
fromParameters(Dictionary<String,Object> config) throws ConfigurationException {
+        ConfiguredSolrCoreTracker engine = new SolrTrainingSet();
+        engine.configure(config);
+        return engine;
+    }
+
+    @Override
+    public boolean isUpdatable() {
+        return true;
+    }
+
+    @Override
+    public String registerExample(String exampleId, String text, List<String> 
topics) throws TrainingSetException {
+        if (text == null) {
+            // special case: example removal
+            if (exampleId == null) {
+                throw new IllegalArgumentException("exampleId and text should 
not be null simultaneously");
+            }
+            SolrServer solrServer = getActiveSolrServer();
+            try {
+                solrServer.deleteByQuery(exampleIdField + ":" + exampleId);
+                solrServer.commit();
+                return exampleId;
+            } catch (Exception e) {
+                String msg = String.format("Error deleting example with id 
'%s' on Solr Core '%s'",
+                    exampleId, solrCoreId);
+                throw new TrainingSetException(msg, e);
+            }
+        }
+
+        if (exampleId == null || exampleId.isEmpty()) {
+            exampleId = UUID.randomUUID().toString();
+        }
+        SolrInputDocument doc = new SolrInputDocument();
+        doc.addField(exampleIdField, exampleId);
+        doc.addField(exampleTextField, text);
+        if (topics != null) {
+            doc.addField(topicUrisField, topics);
+        }
+        doc.addField(modificationDateField, UTCTimeStamper.nowUtcDate());
+        SolrServer server = getActiveSolrServer();
+        try {
+            server.add(doc);
+            server.commit();
+        } catch (Exception e) {
+            String msg = String.format("Could not register example '%s' with 
topics: ['%s']", exampleId,
+                StringUtils.join(topics, "', '"));
+            throw new TrainingSetException(msg, e);
+        }
+        return exampleId;
+    }
+
+    @Override
+    public boolean hasChangedSince(List<String> topics, Date referenceDate) 
throws TrainingSetException {
+        String utcIsoDate = UTCTimeStamper.utcIsoString(referenceDate);
+        StringBuffer sb = new StringBuffer();
+        sb.append(modificationDateField);
+        sb.append(":[");
+        sb.append(utcIsoDate);
+        sb.append(" TO *]");
+        if (topics != null && topics.size() > 0) {
+            sb.append(" AND (");
+            List<String> parts = new ArrayList<String>();
+            for (String topic : topics) {
+                // use a nested query to avoid string escaping issues with 
special solr chars
+                parts.add(topicUrisField + ":" + 
ClientUtils.escapeQueryChars(topic));
+            }
+            sb.append(StringUtils.join(parts, " OR "));
+            sb.append(")");
+        }
+        SolrQuery query = new SolrQuery(sb.toString());
+        query.setRows(1);
+        query.setFields(exampleIdField);
+        try {
+            return solrServer.query(query).getResults().size() > 0;
+        } catch (SolrServerException e) {
+            String msg = String.format(
+                "Error while fetching topics for examples modified after '%s' 
on Solr Core '%s'.",
+                utcIsoDate, solrCoreId);
+            throw new TrainingSetException(msg, e);
+        }
+    }
+
+    @Override
+    public Batch<Example> getPositiveExamples(List<String> topics, Object 
offset) throws TrainingSetException {
+        return getExamples(topics, offset, true);
+    }
+
+    @Override
+    public Batch<Example> getNegativeExamples(List<String> topics, Object 
offset) throws TrainingSetException {
+        return getExamples(topics, offset, false);
+    }
+
+    protected Batch<Example> getExamples(List<String> topics, Object offset, 
boolean positive) throws TrainingSetException {
+        List<Example> items = new ArrayList<Example>();
+        SolrServer solrServer = getActiveSolrServer();
+        SolrQuery query = new SolrQuery();
+        List<String> parts = new ArrayList<String>();
+        String q = "";
+        if (topics.isEmpty()) {
+            q += "*:*";
+        } else if (positive) {
+            for (String topic : topics) {
+                parts.add(topicUrisField + ":" + 
ClientUtils.escapeQueryChars(topic));
+            }
+            if (offset != null) {
+                q += "(";
+            }
+            q += StringUtils.join(parts, " OR ");
+            if (offset != null) {
+                q += ")";
+            }
+        } else {
+            for (String topic : topics) {
+                parts.add("-" + topicUrisField + ":" + 
ClientUtils.escapeQueryChars(topic));
+            }
+            q += StringUtils.join(parts, " AND ");
+        }
+        if (offset != null) {
+            q += " AND " + exampleIdField + ":[" + offset.toString() + " TO 
*]";
+        }
+        query.setQuery(q);
+        query.addSortField(exampleIdField, SolrQuery.ORDER.asc);
+        query.set("rows", batchSize + 1);
+        String nextExampleId = null;
+        try {
+            int count = 0;
+            QueryResponse response = solrServer.query(query);
+            for (SolrDocument result : response.getResults()) {
+                if (count == batchSize) {
+                    nextExampleId = 
result.getFirstValue(exampleIdField).toString();
+                } else {
+                    count++;
+                    String exampleId = 
result.getFirstValue(exampleIdField).toString();
+                    Collection<Object> labelValues = 
result.getFieldValues(topicUrisField);
+                    Collection<Object> textValues = 
result.getFieldValues(exampleTextField);
+                    if (textValues == null) {
+                        continue;
+                    }
+                    items.add(new Example(exampleId, labelValues, textValues));
+                }
+            }
+        } catch (SolrServerException e) {
+            String msg = String.format(
+                "Error while fetching positive examples for topics ['%s'] on 
Solr Core '%s'.",
+                StringUtils.join(topics, "', '"), solrCoreId);
+            throw new TrainingSetException(msg, e);
+        }
+        return new Batch<Example>(items, nextExampleId != null, nextExampleId);
+    }
+
+    @Override
+    public void setBatchSize(int batchSize) {
+        this.batchSize = batchSize;
+    }
+
+}

Added: 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSet.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSet.java?rev=1234017&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSet.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSet.java
 Fri Jan 20 17:26:03 2012
@@ -0,0 +1,100 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.stanbol.enhancer.topic.training;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.stanbol.enhancer.topic.Batch;
+
+/**
+ * Source of categorized text documents that can be used to build a the 
statistical model of a
+ * TopicClassifier.
+ */
+public interface TrainingSet {
+
+    /**
+     * @return true if the training set can be updated using the {@code 
registerExample} API. If false that
+     *         means that the component is a view on a remote datasource that 
has its own API for updates
+     *         (e.g. the document repository of a CMS).
+     */
+    boolean isUpdatable() throws TrainingSetException;
+
+    /**
+     * Register some text content to be used as an example of document that 
should be positively classified as
+     * topics by the model.
+     * 
+     * @param id
+     *            Unique identifier of the example to create or override. If 
null, a new example with a
+     *            generated id will be created.
+     * @param text
+     *            Text content of the example. If null the example with the 
matching id will be deleted.
+     * 
+     * @param topics
+     *            The list of all the topics the example should be classified 
as.
+     * @return the id of the registered example (can be automatically 
generated)
+     */
+    String registerExample(String exampleId, String text, List<String> topics) 
throws TrainingSetException;
+
+    /**
+     * Fetch examples representative of the set of topics passed as argument 
so as to be able to build a
+     * statistical model.
+     * 
+     * @param topics
+     *            list of admissible topics to search examples for: each 
example in the batch will be
+     *            classified in at list one of the requested topics. This list 
would typically comprise a
+     *            topic along with it's direct narrower descendants (and maybe 
level 2 descendants too).
+     * @param offset
+     *            marker value to fetch the next batch. Pass null to fetch the 
first batch.
+     * @return a batch of example suitable for training a classifier model for 
the requested topics.
+     */
+    Batch<Example> getPositiveExamples(List<String> topics, Object offset) 
throws TrainingSetException;
+
+    /**
+     * Fetch examples representative of any document not specifically 
classified in one of the passed topics.
+     * This can be useful to train a statistical model for a classifier of 
those topics to negatively weight
+     * generic features (term occurrences) and limit the number of false 
positives in the classification. It
+     * is up to the classifier model to decide to use such negative examples 
or not at training time.
+     * 
+     * @param topics
+     *            list of non-admissible topics to search example for: each 
example in the batch must no be
+     *            classified in any of the passed topics.
+     * @param offset
+     *            marker value to fetch the next batch. Pass null to fetch the 
first batch.
+     * @return a batch of examples suitable for training (negative-refinement) 
a classifier model for the
+     *         requested topics.
+     */
+    Batch<Example> getNegativeExamples(List<String> topics, Object offset) 
throws TrainingSetException;
+
+    /**
+     * Number of examples to fetch at once.
+     */
+    void setBatchSize(int batchSize);
+
+    /**
+     * Method to tell the classifier if topic model should be updated if there 
exists examples classified in
+     * one of those topics that has changed.
+     * 
+     * @param topics
+     *            topics to check
+     * @param referenceDate
+     *            look for changes after that date
+     * @return true if one of the passed topics has changed since the last date
+     */
+    boolean hasChangedSince(List<String> topics, Date referenceDate) throws 
TrainingSetException;
+
+}

Added: 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSetException.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSetException.java?rev=1234017&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSetException.java
 (added)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/main/java/org/apache/stanbol/enhancer/topic/training/TrainingSetException.java
 Fri Jan 20 17:26:03 2012
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.stanbol.enhancer.topic.training;
+
+import java.io.IOException;
+
+/**
+ * Unexpected Error while performing read or write access to a topic 
classifier training set.
+ */
+public class TrainingSetException extends IOException {
+
+    private static final long serialVersionUID = 1L;
+
+    public TrainingSetException(String message) {
+        super(message);
+    }
+
+    public TrainingSetException(String message, Throwable cause) {
+        super(message, cause);
+    }
+
+}

Modified: 
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TopicEngineTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TopicEngineTest.java?rev=1234017&r1=1234016&r2=1234017&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TopicEngineTest.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TopicEngineTest.java
 Fri Jan 20 17:26:03 2012
@@ -45,9 +45,9 @@ import org.apache.stanbol.commons.solr.u
 import org.apache.stanbol.enhancer.topic.ClassificationReport;
 import org.apache.stanbol.enhancer.topic.ClassifierException;
 import org.apache.stanbol.enhancer.topic.EmbeddedSolrHelper;
-import org.apache.stanbol.enhancer.topic.SolrTrainingSet;
 import org.apache.stanbol.enhancer.topic.TopicSuggestion;
-import org.apache.stanbol.enhancer.topic.TrainingSetException;
+import org.apache.stanbol.enhancer.topic.training.SolrTrainingSet;
+import org.apache.stanbol.enhancer.topic.training.TrainingSetException;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;

Modified: 
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TrainingSetTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TrainingSetTest.java?rev=1234017&r1=1234016&r2=1234017&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TrainingSetTest.java
 (original)
+++ 
incubator/stanbol/trunk/enhancer/engines/topic/src/test/java/org/apache/stanbol/enhancer/engine/topic/TrainingSetTest.java
 Fri Jan 20 17:26:03 2012
@@ -38,10 +38,10 @@ import org.apache.commons.io.FileUtils;
 import org.apache.solr.client.solrj.embedded.EmbeddedSolrServer;
 import org.apache.stanbol.enhancer.topic.Batch;
 import org.apache.stanbol.enhancer.topic.EmbeddedSolrHelper;
-import org.apache.stanbol.enhancer.topic.SolrTrainingSet;
-import org.apache.stanbol.enhancer.topic.TrainingSetException;
 import org.apache.stanbol.enhancer.topic.UTCTimeStamper;
 import org.apache.stanbol.enhancer.topic.training.Example;
+import org.apache.stanbol.enhancer.topic.training.SolrTrainingSet;
+import org.apache.stanbol.enhancer.topic.training.TrainingSetException;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;


Reply via email to