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

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

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

Yard.findReferences介绍

[英]Finds all representations base on the parse query. Selected fields of the query may be ignored, because only the ids of the found representations are returned
[中]根据解析查询查找所有表示。查询的选定字段可能会被忽略,因为只返回找到的表示的ID

代码示例

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

@Override
public final QueryResultList<String> findEntityReferences(FieldQuery query) throws YardException{
  return entityhubYard.findReferences(query);
}
@Override

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

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

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

@Override
public final QueryResultList<String> findEntityReferences(FieldQuery query) throws YardException{
  return entityhubYard.findReferences(query);
}
@Override

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

@Override
  protected QueryResultList<String> query(FieldQuery query) throws EntityhubException {
    return yard.findReferences(query);
  }
}

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

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

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

private void deleteEntities(Collection<String> ids) throws YardException {
  FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
  Collection<String> toDelete = new HashSet<String>(ids);
  for(String id : ids){
    if(id != null && !id.isEmpty()){
      fieldQuery.setConstraint(RdfResourceEnum.aboutRepresentation.getUri(), new ReferenceConstraint(id));
      for(Iterator<String> it = entityhubYard.findReferences(fieldQuery).iterator();it.hasNext();){
        toDelete.add(it.next());
      }
    }
  }
  if(!toDelete.isEmpty()){
    entityhubYard.remove(toDelete);
  }
  
}

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

@Override
public final QueryResultList<Entity> findEntities(FieldQuery query) throws YardException{
  QueryResultList<String> references = entityhubYard.findReferences(query);
  List<Entity> entities = new ArrayList<Entity>(references.size());
  for(String reference : references){
    Entity entity = lookupLocalEntity(reference);
    if(entity != null){
      entities.add(entity);
    } else {
      log.warn("Unable to create Entity for Reference {} in the Yard " +
          "usd by the entity hub [id={}] -> ignore reference",
          reference,config.getEntityhubYardId());
    }
  }
  return new QueryResultListImpl<Entity>(references.getQuery(), entities, Entity.class);
}

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

private void deleteEntities(Collection<String> ids) throws YardException {
  FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
  Collection<String> toDelete = new HashSet<String>(ids);
  for(String id : ids){
    if(id != null && !id.isEmpty()){
      fieldQuery.setConstraint(RdfResourceEnum.aboutRepresentation.getUri(), new ReferenceConstraint(id));
      for(Iterator<String> it = entityhubYard.findReferences(fieldQuery).iterator();it.hasNext();){
        toDelete.add(it.next());
      }
    }
  }
  if(!toDelete.isEmpty()){
    entityhubYard.remove(toDelete);
  }
  
}

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

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

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

@Override
public final QueryResultList<Entity> findEntities(FieldQuery query) throws YardException{
  QueryResultList<String> references = entityhubYard.findReferences(query);
  List<Entity> entities = new ArrayList<Entity>(references.size());
  for(String reference : references){
    Entity entity = lookupLocalEntity(reference);
    if(entity != null){
      entities.add(entity);
    } else {
      log.warn("Unable to create Entity for Reference {} in the Yard " +
          "usd by the entity hub [id={}] -> ignore reference",
          reference,config.getEntityhubYardId());
    }
  }
  return new QueryResultListImpl<Entity>(references.getQuery(), entities, Entity.class);
}

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

private void deleteMappingsbyTarget(String id) throws YardException {
  if(id != null && !id.isEmpty()){
    FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
    fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(id));
    deleteEntities(ModelUtils.asCollection(
      entityhubYard.findReferences(fieldQuery).iterator()));
  }
}

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

private void deleteMappingsbyTarget(String id) throws YardException {
  if(id != null && !id.isEmpty()){
    FieldQuery fieldQuery = getQueryFactory().createFieldQuery();
    fieldQuery.setConstraint(RdfResourceEnum.mappingTarget.getUri(), new ReferenceConstraint(id));
    deleteEntities(ModelUtils.asCollection(
      entityhubYard.findReferences(fieldQuery).iterator()));
  }
}

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

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

相关文章