Package org.apache.stanbol.entityhub.servicesapi.query

Examples of org.apache.stanbol.entityhub.servicesapi.query.TextConstraint


                message.append("Parsed TextConstraint doese not define a valid (none empty) value for the 'text' property !\n");
                message.append("Parsed Constraint: \n");
                message.append(jConstraint.toString(4));
                throw new IllegalArgumentException(message.toString());
            }
            constraint = new TextConstraint(textConstraints,
                patternType,caseSensitive,
                languages == null?null:languages.toArray(new String[languages.size()]));
        } else {
            StringBuilder message = new StringBuilder();
            message.append("Parsed TextConstraint doese not define the required field 'text'!\n");
View Full Code Here


                        }
                    }
                }
                break;
            case text:
                TextConstraint textConstraint = (TextConstraint) constraint;
                Collection<String> languages = textConstraint.getLanguages();
                if (languages != null && !languages.isEmpty()) {
                    if(languages.size() == 1){
                        jConstraint.put("language", languages.iterator().next());
                    } else {
                        jConstraint.put("language", new JSONArray(languages));
                    }
                }
                jConstraint.put("patternType", textConstraint.getPatternType().name());
                if (textConstraint.getTexts() != null && !textConstraint.getTexts().isEmpty()) {
                    if(textConstraint.getTexts().size() == 1){ //write a string
                        jConstraint.put("text", textConstraint.getTexts().get(0));
                    } else { //write an array
                        jConstraint.put("text", textConstraint.getTexts());
                    }
                }
                if(textConstraint.isCaseSensitive()){
                    jConstraint.put("caseSensitive", true);
                } //else default is false
                break;
            case range:
                RangeConstraint rangeConstraint = (RangeConstraint) constraint;
View Full Code Here

//                DataTypeEnum.Float.getUri(),DataTypeEnum.Double.getUri(),DataTypeEnum.Decimal.getUri())));
//        query.addSelectedField("urn:field1c");
//        query.setConstraint("urn:field1d", new ValueConstraint(9, Arrays.asList(
//                DataTypeEnum.Float.getUri(),DataTypeEnum.Double.getUri(),DataTypeEnum.Decimal.getUri())));
//        query.setConstraint("urn:field2", new TextConstraint("test value"));
        query.setConstraint("urn:field3", new TextConstraint(Arrays.asList(
            "text value","anothertest","some more values"),true));
//        query.setConstraint("urn:field2a", new TextConstraint(":-]")); //tests escaping of REGEX
//        query.setConstraint("urn:field3", new TextConstraint("language text","en"));
//        query.setConstraint("urn:field4", new TextConstraint("multi language text","en","de",null));
//        query.setConstraint("urn:field5", new TextConstraint("wildcar*",PatternType.wildcard,false,"en","de"));
 
View Full Code Here

TOP

Related Classes of org.apache.stanbol.entityhub.servicesapi.query.TextConstraint

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.