package org.epnoi.learner;

import org.epnoi.learner.modules.Learner;
import org.epnoi.learner.relations.extractor.parallel.ParallelRelationsExtractor;
import org.epnoi.model.Relation;
import org.epnoi.model.Term;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestPropertySource;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Created by rgonzalez on 3/12/15.
 */

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = LearnerConfig.class)
@ActiveProfiles("develop")
@TestPropertySource(properties = {"learner.task.terms.extract = false", "learner.task.terms.store = false", "learner.task.relations.parallel = true"})


public class LearnerTest {
    @Autowired
    Learner learner;


    @Autowired
    LearningParameters learnerProperties;

    @Autowired
    @Value("${learner.demo.harvester.uri}")
    String domainUri;



    @Test
    public void startContext() {
        System.out.println("Starting an ontology learning task for " + domainUri);
        System.out.println("Using the following parameters "+learnerProperties);


        learner.learn(domainUri);
        /*
        System.out.println("Terminology test===========================================================");
        for (Term term : learner.retrieveTerminology(domainUri).getMostProbable(5)) {
            System.out.println("term> " + term);
        }
        */

        System.out.println("Relations test===========================================================");
        System.out.println("There were "+learner.retrieveRelations(domainUri).getRelations().size()+" relations in the domain");
        for (Relation relation: learner.retrieveRelations(domainUri).getMostProbable(5)){
            System.out.println("relation> " + relation);
        }


       // parallelRelationsExtractor.extract(domainUri);

        assert (true);

    }

}

@@ -21,16 +21,61 @@
 arner;%0A%0A
+import es.cbadenes.lab.test.IntegrationTest;%0A
 import o
@@ -271,24 +271,75 @@
 junit.Test;%0A
+import org.junit.experimental.categories.Category;%0A
 import org.j
@@ -776,16 +776,48 @@
 15.%0A */%0A
+@Category(IntegrationTest.class)
 %0A@RunWit

set test as integration test to avoid execution during compilation