Package org.apache.stanbol.entityhub.indexing.core

Examples of org.apache.stanbol.entityhub.indexing.core.EntityIterator


    public void testEntityDataProvider(){
        log.info(" --- testEntityDataProvider ---");
        String testName = "provider";
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+File.separatorChar+testName,
            CONFIG_ROOT+'/'+testName){};
        EntityIterator entityIdIterator = config.getEntityIdIterator();
        assertNotNull("Unable to perform test whithout EntityIterator",entityIdIterator);
        if(entityIdIterator.needsInitialisation()){
            entityIdIterator.initialise();
        }
        EntityDataProvider dataProvider = config.getEntityDataProvider();
        assertNotNull(dataProvider);
        assertTrue(dataProvider.needsInitialisation());//there are test data to load
        dataProvider.initialise();
        assertEquals(dataProvider.getClass(), RdfIndexingSource.class);
        long count = 0;
        while(entityIdIterator.hasNext()){
            EntityScore entityScore = entityIdIterator.next();
            assertNotNull(entityScore);
            assertNotNull(entityScore.id);
            validateRepresentation(dataProvider.getEntityData(entityScore.id),
                entityScore.id);
            count++;
View Full Code Here


    public void testQuadsImport(){
        log.info(" --- testQuadsImport ---");
        String testName = "quads";
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+File.separatorChar+testName,
            CONFIG_ROOT+'/'+testName){};
        EntityIterator entityIdIterator = config.getEntityIdIterator();
        assertNotNull("Unable to perform test whithout EntityIterator",entityIdIterator);
        if(entityIdIterator.needsInitialisation()){
            entityIdIterator.initialise();
        }
        EntityDataProvider dataProvider = config.getEntityDataProvider();
        assertNotNull(dataProvider);
        assertTrue(dataProvider.needsInitialisation());//there are test data to load
        dataProvider.initialise();
        assertEquals(dataProvider.getClass(), RdfIndexingSource.class);
        long count = 0;
        while(entityIdIterator.hasNext()){
            EntityScore entityScore = entityIdIterator.next();
            assertNotNull(entityScore);
            assertNotNull(entityScore.id);
            validateRepresentation(dataProvider.getEntityData(entityScore.id),
                entityScore.id);
            count++;
View Full Code Here

        }
        //init the post processing components
        //use an EntityDataProvider based on the indexed data
        EntityDataProvider dataProvider = new YardEntityDataProvider(indexingDestination.getYard());
        //use an LineBasedEntityIterator to iterate over the indexed entity ids
        EntityIterator entityIterator;
        try {
            entityIterator = new LineBasedEntityIterator(getEntityIdFileInputStream(),"UTF-8",null);
        catch (IOException e) {
            throw new IllegalStateException("Unable to open file containing the " +
                "IDs of the indexed Entities!",e);
        }
        Map<String,Object> config = new HashMap<String,Object>();
        config.put(LineBasedEntityIterator.PARAM_ID_POS, 1);
        config.put(LineBasedEntityIterator.PARAM_SCORE_POS, Integer.MAX_VALUE);
        entityIterator.setConfiguration(config);
        //init the post-processors (this time not in an own thread as this
        //does not really make sense for processors
        for(EntityProcessor processor : entityPostProcessors){
            if(processor.needsInitialisation()){
                processor.initialise();
View Full Code Here

            NUMBER_OF_ENTITIES_EXPECTED <= count);
    }
    @Test
    public void testEntityDataProvider(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"provider",CONFIG_ROOT+"provider"){};
        EntityIterator entityIdIterator = config.getEntityIdIterator();
        assertNotNull("Unable to perform test whithout EntityIterator",entityIdIterator);
        if(entityIdIterator.needsInitialisation()){
            entityIdIterator.initialise();
        }
        EntityDataProvider dataProvider = config.getEntityDataProvider();
        assertNotNull(dataProvider);
        assertTrue(dataProvider.needsInitialisation());//there are test data to load
        dataProvider.initialise();
        assertEquals(dataProvider.getClass(), RdfIndexingSource.class);
        long count = 0;
        while(entityIdIterator.hasNext()){
            EntityScore entityScore = entityIdIterator.next();
            assertNotNull(entityScore);
            assertNotNull(entityScore.id);
            validateRepresentation(dataProvider.getEntityData(entityScore.id),
                entityScore.id);
            count++;
View Full Code Here

     * Tests support for Quads (STANBOL-764)
     */
    @Test
    public void testQuadsImport(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"quads",CONFIG_ROOT+"quads"){};
        EntityIterator entityIdIterator = config.getEntityIdIterator();
        assertNotNull("Unable to perform test whithout EntityIterator",entityIdIterator);
        if(entityIdIterator.needsInitialisation()){
            entityIdIterator.initialise();
        }
        EntityDataProvider dataProvider = config.getEntityDataProvider();
        assertNotNull(dataProvider);
        assertTrue(dataProvider.needsInitialisation());//there are test data to load
        dataProvider.initialise();
        assertEquals(dataProvider.getClass(), RdfIndexingSource.class);
        long count = 0;
        while(entityIdIterator.hasNext()){
            EntityScore entityScore = entityIdIterator.next();
            assertNotNull(entityScore);
            assertNotNull(entityScore.id);
            validateRepresentation(dataProvider.getEntityData(entityScore.id),
                entityScore.id);
            count++;
View Full Code Here

        }
        //init the post processing components
        //use an EntityDataProvider based on the indexed data
        EntityDataProvider dataProvider = new YardEntityDataProvider(indexingDestination.getYard());
        //use an LineBasedEntityIterator to iterate over the indexed entity ids
        EntityIterator entityIterator;
        try {
            entityIterator = new LineBasedEntityIterator(getEntityIdFileInputStream(),"UTF-8",null);
        catch (IOException e) {
            throw new IllegalStateException("Unable to open file containing the " +
                "IDs of the indexed Entities!",e);
        }
        Map<String,Object> config = new HashMap<String,Object>();
        config.put(LineBasedEntityIterator.PARAM_ID_POS, 1);
        config.put(LineBasedEntityIterator.PARAM_SCORE_POS, Integer.MAX_VALUE);
        entityIterator.setConfiguration(config);
        //init the post-processors (this time not in an own thread as this
        //does not really make sense for processors
        for(EntityProcessor processor : entityPostProcessors){
            if(processor.needsInitialisation()){
                processor.initialise();
View Full Code Here

        System.setProperty("user.dir", userDir);
    }
    @Test
    public void testEntityIdIteratorConfig(){
        IndexingConfig config = new IndexingConfig();
        EntityIterator iterator = config.getEntityIdIterator();
        ScoreNormaliser normaliser = config.getNormaliser();
        if(iterator.needsInitialisation()){
            iterator.initialise();
        }
        float lastScore = Float.MAX_VALUE;
        float lastNormalisedScore = 1f;
        while(iterator.hasNext()){
            EntityScore entity = iterator.next();
            assertNotNull(entity);
            assertNotNull(entity.id);
            assertNotNull(entity.score);
            //log.info("Entity: {}",entity);
            assertTrue(entity.id.startsWith("http://dbpedia.org/resource/"));
View Full Code Here

            NUMBER_OF_ENTITIES_EXPECTED <= count);
    }
    @Test
    public void testEntityDataProvider(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"provider",CONFIG_ROOT+"provider"){};
        EntityIterator entityIdIterator = config.getEntityIdIterator();
        assertNotNull("Unable to perform test whithout EntityIterator",entityIdIterator);
        if(entityIdIterator.needsInitialisation()){
            entityIdIterator.initialise();
        }
        EntityDataProvider dataProvider = config.getEntityDataProvider();
        assertNotNull(dataProvider);
        assertTrue(dataProvider.needsInitialisation());//there are test data to load
        dataProvider.initialise();
        assertEquals(dataProvider.getClass(), RdfIndexingSource.class);
        long count = 0;
        while(entityIdIterator.hasNext()){
            EntityScore entityScore = entityIdIterator.next();
            assertNotNull(entityScore);
            assertNotNull(entityScore.id);
            validateRepresentation(dataProvider.getEntityData(entityScore.id),
                entityScore.id);
            count++;
View Full Code Here

            NUMBER_OF_ENTITIES_EXPECTED <= count);
    }
    @Test
    public void testEntityDataProvider(){
        IndexingConfig config = new IndexingConfig(CONFIG_ROOT+"provider");
        EntityIterator entityIdIterator = config.getEntityIdIterator();
        assertNotNull("Unable to perform test whithout EntityIterator",entityIdIterator);
        if(entityIdIterator.needsInitialisation()){
            entityIdIterator.initialise();
        }
        EntityDataProvider dataProvider = config.getEntityDataProvider();
        assertNotNull(dataProvider);
        assertTrue(dataProvider.needsInitialisation());//there are test data to load
        dataProvider.initialise();
        assertEquals(dataProvider.getClass(), RdfIndexingSource.class);
        long count = 0;
        while(entityIdIterator.hasNext()){
            EntityScore entityScore = entityIdIterator.next();
            assertNotNull(entityScore);
            assertNotNull(entityScore.id);
            validateRepresentation(dataProvider.getEntityData(entityScore.id),
                entityScore.id);
            count++;
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.indexing.core.EntityIterator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.