Package org.apache.stanbol.entityhub.core.mapping

Examples of org.apache.stanbol.entityhub.core.mapping.DefaultFieldMapperImpl


     * @throws if the parsed {@link Representation} does not contain a value for {@value CacheConstants.FIELD_MAPPING_CONFIG_FIELD}.
     */
    private static FieldMapper readFieldConfig(Yard yard,Representation config, NamespacePrefixService nsPrefixService) {
        Object mappingValue = config.getFirst(Cache.FIELD_MAPPING_CONFIG_FIELD);
        if(mappingValue != null){
            DefaultFieldMapperImpl fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
            for(String mappingStirng : mappingValue.toString().split("\n")){
                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(mappingStirng, nsPrefixService);
                if(mapping != null){
                    log.info("  > add Mapping: "+mappingStirng);
                    fieldMapper.addMapping(mapping);
                }
            }
            return fieldMapper;
        } else {
            return null;
View Full Code Here


        //at last get the FieldMappingConfig and create the FieldMappings instance
        // -> we need to do that after the init of the Entityhub-yard, because than we
        //    can use the valueFactory of the configured Yard to create instances
        //    of converted values!
        log.info(" ... init FieldMappings");
        fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
        for(String mappingString : config.getFieldMappingConfig()){
            FieldMapping mapping = FieldMappingUtils.parseFieldMapping(mappingString);
            if(mapping != null){
                log.info("   + mapping: "+mapping);
                fieldMapper.addMapping(mapping);
View Full Code Here

        //(2) Init the additional mappings based on the configuration
        Object mappings = context.getProperties().get(Cache.ADDITIONAL_MAPPINGS);
        FieldMapper configuredMappings = null;
        if (mappings instanceof String[] && ((String[]) mappings).length > 0) {
            configuredMappings = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
            for (String mappingString : (String[]) mappings) {
                FieldMapping fieldMapping = FieldMappingUtils.parseFieldMapping(mappingString);
                if (fieldMapping != null) {
                    configuredMappings.addMapping(fieldMapping);
                }
View Full Code Here

     * @throws if the parsed {@link Representation} does not contain a value for {@value CacheConstants.FIELD_MAPPING_CONFIG_FIELD}.
     */
    private static FieldMapper readFieldConfig(Yard yard,Representation config) {
        Object mappingValue = config.getFirst(Cache.FIELD_MAPPING_CONFIG_FIELD);
        if(mappingValue != null){
            DefaultFieldMapperImpl fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
            for(String mappingStirng : mappingValue.toString().split("\n")){
                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(mappingStirng);
                if(mapping != null){
                    log.info("  > add Mapping: "+mappingStirng);
                    fieldMapper.addMapping(mapping);
                }
            }
            return fieldMapper;
        } else {
            return null;
View Full Code Here

            //(2) entity dereferencer == entity searcher
            siteConfiguration.getEntityDereferencerType()!= null &&
            siteConfiguration.getEntityDereferencerType().equals(siteConfiguration.getEntitySearcherType());

        //init the fieldMapper based on the configuration
        fieldMappings = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
        if(siteConfiguration.getFieldMappings() != null){
            log.debug(" > Initialise configured field mappings");
            for(String configuredMapping : siteConfiguration.getFieldMappings()){
                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(configuredMapping);
                if(mapping != null){
View Full Code Here

     * @throws YardException would be really bad if after successfully indexing
     * about 8 millions of documents we get an error from the yard at the
     * last possible opportunity :(
     */
    private void writeCacheBaseConfiguration() throws YardException {
        FieldMapper baseMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
        log.info("Write BaseMappings for geonames.org Cache");
        log.info(" > Mappings");
        for(String mapping : GeoNamesIndexer.fieldMappings){
            log.info("    - "+mapping);
            baseMapper.addMapping(FieldMappingUtils.parseFieldMapping(mapping));
        }
        CacheUtils.storeBaseMappingsConfiguration(yard, baseMapper);
        log.info(" < completed");
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.core.mapping.DefaultFieldMapperImpl

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.