org.apache.stanbol.entityhub.servicesapi.yard.Yard.find()方法的使用及代码示例

x33g5p2x  于2022-02-05 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(121)

本文整理了Java中org.apache.stanbol.entityhub.servicesapi.yard.Yard.find()方法的一些代码示例,展示了Yard.find()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yard.find()方法的具体详情如下:
包路径:org.apache.stanbol.entityhub.servicesapi.yard.Yard
类名称:Yard
方法名:find

Yard.find介绍

[英]Getter for a view onto the Representations selected by the Query. Note that the returned Representations will only include fields that are selected by the parsed query. And such fields will only contain values that are not filtered by the query.
[中]获取查询所选表示的视图。请注意,返回的表示形式将只包括已解析查询选择的字段。这样的字段将只包含查询未过滤的值。

代码示例

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public final QueryResultList<Representation> find(FieldQuery query) throws YardException{
  return entityhubYard.find(query);
}
@Override

代码示例来源:origin: apache/stanbol

@Override
public final QueryResultList<Representation> find(FieldQuery query) throws YardException{
  return entityhubYard.find(query);
}
@Override

代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core

@Override
public QueryResultList<Representation> find(FieldQuery query) throws YardException, IllegalArgumentException {
  return yard.find(query);
}

代码示例来源:origin: apache/stanbol

@Override
public QueryResultList<Representation> find(FieldQuery query) throws YardException, IllegalArgumentException {
  return yard.find(query);
}

代码示例来源:origin: apache/stanbol

@Override
public QueryResultList<Representation> find(FieldQuery query) throws ManagedSiteException {
  try {
    return getYard().find(query);
  } catch (YardException e) {
    throw new ManagedSiteException(e.getMessage(), e);
  }
}

代码示例来源:origin: apache/stanbol

@Test
public void testFindTextWildcards(){
  //init the test data
  FieldQueryTestData data = getFieldQueryTestData();
  //prefix search with *
  FieldQuery query = getYard().getQueryFactory().createFieldQuery();
  String wildcard = data.textValue1.getText();
  wildcard = wildcard.substring(0, wildcard.length()-1) + "*";
  query.setConstraint(data.textField, new TextConstraint(wildcard,PatternType.wildcard,false, "en"));
  query.addSelectedField(data.refField);
  query.addSelectedField(data.textField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r1en.getId(), data.r2en.getId()), 
      Arrays.asList(data.refField, data.textField));
  
  //wildcard with ?
  query = getYard().getQueryFactory().createFieldQuery();
  //selects r1en and r2en
  wildcard = data.textValue1.getText();
  wildcard = wildcard.substring(0, wildcard.length()-1) + "?";
  query.setConstraint(data.textField, new TextConstraint(wildcard,PatternType.wildcard,false, "de"));
  query.addSelectedField(data.refField);
  query.addSelectedField(data.textField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r1de.getId(), data.r2de.getId()), 
      Arrays.asList(data.refField, data.textField));
}

代码示例来源:origin: apache/stanbol

query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1en.getId(),data.r2en.getId()), 
    Arrays.asList(data.textField, data.refField));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1en.getId(),data.r1de.getId(), 
        data.r2en.getId(), data.r2de.getId()),

代码示例来源:origin: apache/stanbol

/**
 * Tests simple {@link RangeConstraint}
 */
@Test
public void testFindRange(){
  //init the test data
  FieldQueryTestData data = getFieldQueryTestData();
  //query for all languages and value1
  FieldQuery query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.intField, new RangeConstraint(data.intValue2,data.intValue5,true));
  query.addSelectedField(data.intField);
  query.addSelectedField(data.refField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r2.getId(), data.r2en.getId(), data.r2de.getId(), data.r5.getId()), 
      Arrays.asList(data.intField, data.refField));
  
  //same for value2
  query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.intField, new RangeConstraint(data.intValue2,data.intValue10,false));
  query.addSelectedField(data.intField);
  query.addSelectedField(data.textField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r5.getId()), 
      Arrays.asList(data.intField, data.textField));
}
/**

代码示例来源:origin: apache/stanbol

/**
 * Tests simple {@link ValueConstraint}s
 */
@Test
public void testFindValues(){
  //init the test data
  FieldQueryTestData data = getFieldQueryTestData();
  //query for all languages and value1
  FieldQuery query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.intField, new ValueConstraint(data.intValue1));
  query.addSelectedField(data.intField);
  query.addSelectedField(data.textField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r1.getId(), data.r1en.getId(), data.r1de.getId()), 
      Arrays.asList(data.intField, data.textField));
  
  //same for value2
  query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.intField, new ValueConstraint(data.intValue2));
  query.addSelectedField(data.intField);
  query.addSelectedField(data.textField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r2.getId(), data.r2en.getId(), data.r2de.getId()), 
      Arrays.asList(data.intField, data.textField));
  
}
/**

代码示例来源:origin: apache/stanbol

/**
 * Test a simple {@link TextConstraint} for any language
 */
@Test
public void testFindText(){
  //init the test data
  FieldQueryTestData data = getFieldQueryTestData();
  //query for all languages and value1
  FieldQuery query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.textField, new TextConstraint(data.textValue1.getText()));
  query.addSelectedField(data.textField);
  query.addSelectedField(data.refField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList( data.r1.getId(), data.r1en.getId(), data.r1de.getId()), 
      Arrays.asList(data.textField, data.refField));
  
  //same for value2
  query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
  query.addSelectedField(data.textField);
  query.addSelectedField(data.refField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()), 
      Arrays.asList(data.textField, data.refField));
}
/**

代码示例来源:origin: apache/stanbol

query.addSelectedField(data.intField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r5.getId()), 
    Arrays.asList(data.intField, data.refField));
query.addSelectedField(data.refField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1en.getId()), 
    Arrays.asList(data.refField, data.textField));
query.addSelectedField(data.refField);
query.addSelectedField(data.textField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r2de.getId()), 
    Arrays.asList(data.refField, data.textField));

代码示例来源:origin: apache/stanbol

/**
 * Test a {@link ReferenceConstraint}
 */
@Test
public void testFindReference(){
  //init the test data
  FieldQueryTestData data = getFieldQueryTestData();
  //query for all languages and value1
  FieldQuery query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.refField, new ReferenceConstraint(data.refValue1.getReference()));
  query.addSelectedField(data.intField);
  query.addSelectedField(data.refField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r1.getId(), data.r1en.getId(), data.r1de.getId(), data.r5.getId()), 
      Arrays.asList(data.intField, data.refField));
  
  //same for value2
  query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.refField, new ReferenceConstraint(data.refValue2.getReference()));
  query.addSelectedField(data.intField);
  query.addSelectedField(data.refField);
  validateQueryResults(query, getYard().find(query), 
      Arrays.asList(data.r2.getId(), data.r2en.getId(), data.r2de.getId(), data.r10.getId()), 
      Arrays.asList(data.intField, data.refField));
}

代码示例来源:origin: apache/stanbol

query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1en.getId()), 
    Arrays.asList(data.textField, data.refField));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r2de.getId()), 
    Arrays.asList(data.textField, data.refField));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1.getId()), 
    Arrays.asList(data.textField, data.refField));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1.getId(),data.r1en.getId()), 
    Arrays.asList(data.textField, data.refField));
query.addSelectedField(data.textField);
query.addSelectedField(data.refField);
validateQueryResults(query, getYard().find(query), 
    Arrays.asList(data.r1en.getId(),data.r1de.getId()), 
    Arrays.asList(data.textField, data.refField));

相关文章