Tabnine Logo
TextConstraint
Code IndexAdd Tabnine to your IDE (free)

How to use
TextConstraint
in
org.apache.stanbol.entityhub.servicesapi.query

Best Java code snippets using org.apache.stanbol.entityhub.servicesapi.query.TextConstraint (Showing top 20 results out of 315)

origin: apache/stanbol

  return null;
} else {
  return new TextConstraint((String)null,langs);
origin: apache/stanbol

                 String intend) {
boolean filterAdded = false;
boolean isTextValueConstraint = constraint.getTexts() != null && !constraint.getTexts().isEmpty();
  if (constraint.getPatternType() == PatternType.regex) {
    queryString.append(" \n").append(intend).append("  FILTER(");
    filterAdded = true;
    addRegexFilter(queryString, var, constraint.getTexts(), constraint.isCaseSensitive());
  } else {
      queryString.append(". \n  ").append(intend);
      queryString.append(String.format("?%s bif:contains '%s'", var,
        createFullTextQueryString(constraint.getTexts())));
    } else if (SparqlEndpointTypeEnum.LARQ == endpointType) {
      queryString.append(". \n  ").append(intend);
      queryString.append(String.format(
        "?%s <http://jena.hpl.hp.com/ARQ/property#textMatch> '%s'", var,
        createFullTextQueryString(constraint.getTexts())));
    } else {
      queryString.append(" \n").append(intend).append("  FILTER(");
      filterAdded = true;
      if (constraint.getPatternType() == PatternType.none) {
            constraint.getTexts().size());
        for (String textConstraint : constraint.getTexts()) {
          if (textConstraint != null && !textConstraint.isEmpty()) {
            regexQueryTexts.add(PatternUtils.word2Regex(textConstraint));
        addRegexFilter(queryString, var, regexQueryTexts, constraint.isCaseSensitive());
origin: apache/stanbol

if(textConstraint.getTexts() != null){
  log.warn("Filtering based on values is not implemented");
Set<String> langs = textConstraint.getLanguages();
boolean acceptDefaultLanguage = textConstraint.getLanguages().contains(null);
for(Iterator<Object> it = values.iterator();it.hasNext();){
  Object value = it.next();
origin: apache/stanbol

  throw new IllegalArgumentException(message.toString());
constraint = new TextConstraint(textConstraints,
  patternType,caseSensitive,
  languages == null?null:languages.toArray(new String[languages.size()]));
  constraint.setProximityRanking(jConstraint.optBoolean("proximityRanking", false));
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

private static void serializeConstraint(StringBuilder builder,TextConstraint constraint){
  builder.append("| @=");
  boolean first = true;
  for(String lang : constraint.getLanguages()){
    if(first){
      first = false;
    } else {
      builder.append(';');
    }
    builder.append(lang);
  }
}
private static void serializeConstraint(StringBuilder builder,ValueConstraint constraint){
origin: apache/stanbol

TextConstraint tc = new TextConstraint(search, languages);
tc.setProximityRanking(true); //STANBOL-1104
query.setConstraint(field.getUnicodeString(),tc);
return query;
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

if(textConstraint.getTexts() != null){
  log.warn("Filtering based on values is not implemented");
Set<String> langs = textConstraint.getLanguages();
boolean acceptDefaultLanguage = textConstraint.getLanguages().contains(null);
for(Iterator<Object> it = values.iterator();it.hasNext();){
  Object value = it.next();
origin: apache/stanbol

private static void serializeConstraint(StringBuilder builder,TextConstraint constraint){
  builder.append("| @=");
  boolean first = true;
  for(String lang : constraint.getLanguages()){
    if(first){
      first = false;
    } else {
      builder.append(';');
    }
    builder.append(lang);
  }
}
private static void serializeConstraint(StringBuilder builder,ValueConstraint constraint){
origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

  return null;
} else {
  return new TextConstraint((String)null,langs);
origin: org.apache.stanbol/org.apache.stanbol.entityhub.query.sparql

                 String intend) {
boolean filterAdded = false;
boolean isTextValueConstraint = constraint.getTexts() != null && !constraint.getTexts().isEmpty();
  if (constraint.getPatternType() == PatternType.regex) {
    queryString.append(" \n").append(intend).append("  FILTER(");
    filterAdded = true;
    addRegexFilter(queryString, var, constraint.getTexts(), constraint.isCaseSensitive());
  } else {
      queryString.append(". \n  ").append(intend);
      queryString.append(String.format("?%s bif:contains '%s'", var,
        createFullTextQueryString(constraint.getTexts())));
    } else if (SparqlEndpointTypeEnum.LARQ == endpointType) {
      queryString.append(". \n  ").append(intend);
      queryString.append(String.format(
        "?%s <http://jena.hpl.hp.com/ARQ/property#textMatch> '%s'", var,
        createFullTextQueryString(constraint.getTexts())));
    } else {
      queryString.append(" \n").append(intend).append("  FILTER(");
      filterAdded = true;
      if (constraint.getPatternType() == PatternType.none) {
            constraint.getTexts().size());
        for (String textConstraint : constraint.getTexts()) {
          if (textConstraint != null && !textConstraint.isEmpty()) {
            regexQueryTexts.add(PatternUtils.word2Regex(textConstraint));
        addRegexFilter(queryString, var, regexQueryTexts, constraint.isCaseSensitive());
origin: apache/stanbol

/**
 * @param rQuery
 * @param query
 */
private void addNameConstraint(ReconcileQuery rQuery, FieldQuery query) {
  //maybe an other column was also mapped to the NAME_FIELD property
  Collection<ReconcileValue> additionalValues = rQuery.removeProperty(NAME_FIELD);
  List<String> values;
  if(additionalValues == null){
    values = Collections.singletonList(rQuery.getQuery());
  } else {
    values = new ArrayList<String>(additionalValues.size()+1);
    values.add(rQuery.getQuery());
    for(ReconcileValue value : additionalValues){
      if(value != null && value.getValue() instanceof String){
        values.add((String)value.getValue());
      }
    }
  }
  query.setConstraint(NAME_FIELD, new TextConstraint(values));
}
/**
origin: org.apache.stanbol/org.apache.stanbol.entityhub.yard.solr

if(textConstraint.isProximityRanking() != null){
  constraintValue.setProperty(QueryConst.PHRASE_QUERY_STATE, textConstraint.isProximityRanking());
} else {
for(String text : textConstraint.getTexts()){
  constraintValue.getValues().add(indexValueFactory.createIndexValue(
    valueFactory.createText(text)));
  new IndexField(indexConstraint.getPath(), 
    IndexDataTypeEnum.TXT.getIndexType(),
    textConstraint.getLanguages()));
switch (textConstraint.getPatternType()) {
  case none:
    indexConstraint.setFieldConstraint(IndexConstraintTypeEnum.EQ, constraintValue);
  default:
    indexConstraint.setInvalid(String.format(
      "PatterType %s not supported for Solr Index Queries!", textConstraint.getPatternType()));
origin: apache/stanbol

  query.setConstraint(field, new TextConstraint(name, PatternType.wildcard, false));
} else {
  query.setConstraint(field, new TextConstraint(name, PatternType.wildcard, false, language));
origin: apache/stanbol

if(textConstraint.isProximityRanking() != null){
  constraintValue.setProperty(QueryConst.PHRASE_QUERY_STATE, textConstraint.isProximityRanking());
} else {
for(String text : textConstraint.getTexts()){
  constraintValue.getValues().add(indexValueFactory.createIndexValue(
    valueFactory.createText(text)));
  new IndexField(indexConstraint.getPath(), 
    IndexDataTypeEnum.TXT.getIndexType(),
    textConstraint.getLanguages()));
switch (textConstraint.getPatternType()) {
  case none:
    indexConstraint.setFieldConstraint(IndexConstraintTypeEnum.EQ, constraintValue);
  default:
    indexConstraint.setInvalid(String.format(
      "PatterType %s not supported for Solr Index Queries!", textConstraint.getPatternType()));
origin: apache/stanbol

query.setConstraint(field, new TextConstraint(search, languages));
return query;
origin: apache/stanbol

case text:
  TextConstraint textConstraint = (TextConstraint) constraint;
  Collection<String> languages = textConstraint.getLanguages();
  if (languages != null && !languages.isEmpty()) {
    if(languages.size() == 1){
  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);
  if(textConstraint.isProximityRanking() != null){
    jConstraint.put("proximityRanking", textConstraint.isProximityRanking());
origin: apache/stanbol

protected QueryResultList<Entity> query(Site dbpediaSite, String savedEntityLabel, String language,
    String extractionContext) throws SiteException {
  FieldQuery query = dbpediaSite.getQueryFactory().createFieldQuery();
  if (savedEntityLabel != null && !savedEntityLabel.isEmpty()) {
    Constraint labelConstraint;
    if (language != null) {
      labelConstraint = new TextConstraint(savedEntityLabel, false, language, null);
    } else {
      labelConstraint = new TextConstraint(savedEntityLabel, false);
    }
    // TODO: what happens if a recommendation was not based on rdfs:label?
    query.setConstraint(RDFS_LABEL.getUnicodeString(), labelConstraint);
  } else {
    log.warn("parsed label {} was empty or NULL. Will use Similarity constraint only!",
      savedEntityLabel);
  }
  query.setConstraint(SpecialFieldEnum.fullText.getUri(), new SimilarityConstraint(extractionContext));
  query.setLimit(25);
  return dbpediaSite.findEntities(query);
}
origin: apache/stanbol

  fieldMapper = new DefaultFieldMapperImpl(ValueConverterFactory.getDefaultInstance());
fieldMapper.addMapping(new FieldMapping(new TextConstraint(
  (String)null, langs.toArray(new String[langs.size()]))));
origin: apache/stanbol

query.setConstraint("urn:field3", new TextConstraint("\"quote",PatternType.none, true, "en", null));
origin: apache/stanbol

    query.setConstraint(property.getName(), new TextConstraint(texts));
    if (ids.size() != propertyEntry.getValue().size()) {
      log.info("Only some of the parsed values of the field {} are"
TextConstraint textConstraint = new TextConstraint(fullText);
query.setConstraint(SpecialFieldEnum.fullText.getUri(), textConstraint);
org.apache.stanbol.entityhub.servicesapi.queryTextConstraint

Most used methods

  • <init>
    Creates a TextConstraint for multiple texts and languages. Parsed texts are connected using OR and m
  • getLanguages
    The set of languages for this query.
  • getTexts
    Getter for the text constraints. Multiple constraints need to be connected with OR. For AND simple p
  • getPatternType
    The pattern type to be used for this query.
  • isCaseSensitive
    If the query is case sensitive
  • isProximityRanking
    Getter for the Term Proximity state. If enabled the proximity of the parsed terms should be used to
  • setProximityRanking
    Setter for the proximity ranking state. If enabled the proximity of the parsed terms should be used

Popular in Java

  • Running tasks concurrently on multiple threads
  • putExtra (Intent)
  • addToBackStack (FragmentTransaction)
  • findViewById (Activity)
  • Color (java.awt)
    The Color class is used to encapsulate colors in the default sRGB color space or colors in arbitrary
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • SortedSet (java.util)
    SortedSet is a Set which iterates over its elements in a sorted order. The order is determined eithe
  • JPanel (javax.swing)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now