Package org.apache.stanbol.entityhub.servicesapi.mapping

Examples of org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping

Note that a Filter with the pattern '*' no constraint and only an null value as mapping would create a 1:1 copy of the source. TODO: Is it OK to keep an actual implementation in the Service API package? @author Rupert Westenthaler

        // 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, nsPrefixService);
                if (mapping != null) {
                    log.debug("   - add FieldMapping {}", mapping);
                    fieldMappings.addMapping(mapping);
                }
View Full Code Here


        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, nsPrefixService);
                if (fieldMapping != null) {
                    configuredMappings.addMapping(fieldMapping);
                }
            }
            //check if there are valid mappings
View Full Code Here

        //    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,nsPrefixService);
            if(mapping != null){
                log.info("   + mapping: "+mapping);
                fieldMapper.addMapping(mapping);
            }
        }
View Full Code Here

        this.siteMetadata.put(RdfResourceEnum.isChached.getUri(), (Object)Boolean.TRUE);
        fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
        if(config.getFieldMappings() != null){
            log.debug(" > Initialise configured field mappings");
            for(String configuredMapping : config.getFieldMappings()){
                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(configuredMapping,nsPrefixService);
                if(mapping != null){
                    log.debug("   - add FieldMapping {}",mapping);
                    fieldMapper.addMapping(mapping);
                }
            }
View Full Code Here

        }
        this.config = config;
        log.info(" ... init FieldMappings");
        fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
        for(String mappingString : config.getFieldMappingConfig()){
            FieldMapping mapping = FieldMappingUtils.parseFieldMapping(mappingString,nsPrefixService);
            if(mapping != null){
                log.info("   + mapping: "+mapping);
                fieldMapper.addMapping(mapping);
            }
        }
View Full Code Here

        if(dereferencedFields != null && !dereferencedFields.isEmpty()){
            List<FieldMapping> mappings = new ArrayList<FieldMapping>(dereferencedFields.size());
            log.debug(" > parse configured field mappings");
            for(String configuredMapping : dereferencedFields){
              log.trace(" - parse configure mapping '{}'",configuredMapping);
                FieldMapping mapping = FieldMappingUtils.parseFieldMapping(configuredMapping,nsPrefixService);
                if(mapping != null){
                    log.debug("   - add FieldMapping {}",mapping);
                    mappings.add(mapping);
                } else if(configuredMapping != null && !configuredMapping.isEmpty()){
                    log.warn("   - unable to parse FieldMapping '{}'", configuredMapping);
View Full Code Here

            //languages. NOTE that the field might be null. In that case we
            //need just filter literals by language
            //TODO: maybe cache fieldMappers for sets of languages
            fieldMapper = this.fieldMapper != null ? this.fieldMapper.clone() :
                new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
            fieldMapper.addMapping(new FieldMapping(new TextConstraint(
                (String)null, langs.toArray(new String[graph.size()]))));
        } else { //just use the fieldMapper as parsed in the config
            fieldMapper = this.fieldMapper;
        }
        //execute the field mappings
View Full Code Here

        // 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, nsPrefixService);
                if (mapping != null) {
                    log.debug("   - add FieldMapping {}", mapping);
                    fieldMappings.addMapping(mapping);
                }
View Full Code Here

        this.baseMapper = CacheUtils.loadBaseMappings(yard,nsPrefixService);
        FieldMapper configuredMappings = null;
        if(additionalMappings != null && additionalMappings.length > 0){
            configuredMappings = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
            for (String mappingString : additionalMappings) {
                FieldMapping fieldMapping = FieldMappingUtils.parseFieldMapping(mappingString, nsPrefixService);
                if (fieldMapping != null) {
                    configuredMappings.addMapping(fieldMapping);
                }
            }
            //check if there are valid mappings
View Full Code Here

        if(ignore && filter != null){
            log.warn("Filters are not supported for '!<fieldPatter>' type field mappings! Filter {} ignored",filter);
            filter = null;
        }
        try {
            return new FieldMapping(fieldPattern, filter, mappedTo.toArray(new String[mappedTo.size()]));
        }catch (RuntimeException e) {
            log.warn(String.format("Unable to parse FieldMapping from Line '%s'",
                mapping),e);
            return null;
        }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.mapping.FieldMapping

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.