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

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

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

Yard.findRepresentation介绍

[英]Searches for all the Representation fulfilling the constraints of the query and returns the (whole) representation as stored in the Yard. Note that any as selected fields of the parsed query are ignored. Use #find(FieldQuery) to retrieve representations that only contain values for fields marked as selected by the parsed query.
[中]搜索满足查询约束的所有表示,并返回存储在院子中的(整个)表示。请注意,已解析查询的所有“作为选定字段”都将被忽略。使用#find(FieldQuery)检索仅包含已解析查询标记为所选字段的值的表示。

代码示例

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

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

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

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

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

@Override
public Collection<Entity> getMappingsByTarget(String targetId) throws YardException{
  if(targetId == null){
    log.warn("NULL parsed as Reference -> call to getMappingsBySymbol ignored (return null)");
    return null;
  }
  FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
  fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(targetId));
  QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery);
  Collection<Entity> mappings = new HashSet<Entity>();
  for(Representation rep : resultList){
    mappings.add(loadEntity(rep));
  }
  return mappings;
}

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

@Override
public Collection<Entity> getMappingsByTarget(String targetId) throws YardException{
  if(targetId == null){
    log.warn("NULL parsed as Reference -> call to getMappingsBySymbol ignored (return null)");
    return null;
  }
  FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
  fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(targetId));
  QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery);
  Collection<Entity> mappings = new HashSet<Entity>();
  for(Representation rep : resultList){
    mappings.add(loadEntity(rep));
  }
  return mappings;
}

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

resultIt = entityhub.getYard().findRepresentation(query).iterator();
} catch (EntityhubException e) {
  String message = String.format("Exception while performing the " +

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

QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery);
if(!resultList.isEmpty()){
  Iterator<Representation> resultIterator = resultList.iterator();

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

QueryResultList<Representation> resultList = entityhubYard.findRepresentation(fieldQuery);
if(!resultList.isEmpty()){
  Iterator<Representation> resultIterator = resultList.iterator();

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

/**
 * Same as {@link #testFindText()} but using 
 * {@link Yard#findRepresentation(FieldQuery)} to execute the queries
 */
@Test
public void testFindRepresentationText(){
  //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()));
  validateQueryResults(query, getYard().findRepresentation(query), 
      Arrays.asList( data.r1.getId(), data.r1en.getId(), data.r1de.getId()), 
      Arrays.asList(data.textField, data.refField, data.intField));
  
  //same for value2
  query = getYard().getQueryFactory().createFieldQuery();
  query.setConstraint(data.textField, new TextConstraint(data.textValue2.getText()));
  validateQueryResults(query, getYard().findRepresentation(query), 
      Arrays.asList( data.r2.getId(), data.r2en.getId(), data.r2de.getId()), 
      Arrays.asList(data.textField, data.refField, data.intField));
}
/**

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

@Override
public QueryResultList<Entity> findEntities(FieldQuery query) throws ManagedSiteException {
  QueryResultList<Representation> results;
  try {
    results = getYard().findRepresentation(query);
  } catch (YardException e) {
    throw new ManagedSiteException(e.getMessage(), e);
  }
  return new QueryResultListImpl<Entity>(results.getQuery(),
      new AdaptingIterator<Representation,Entity>(
          results.iterator(), 
          new AdaptingIterator.Adapter<Representation,Entity>() {
            private final String siteId = config.getId();
            @Override
            public Entity adapt(Representation value, Class<Entity> type) {
              Entity entity = new EntityImpl(siteId,value,null);
              SiteUtils.initEntityMetadata(entity, siteMetadata, null);
              return entity;
            }
          }, Entity.class),Entity.class);
}

相关文章