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

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

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

Yard.getRepresentation介绍

[英]Getter for the representation based on the id. Calls with id = null should return null.
[中]基于id的表示的Getter。使用id = null的调用应返回null。

代码示例

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

@Override
protected Representation getRepresentation(String id) throws EntityhubException {
  return yard.getRepresentation(id);
}
@Override

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

@Override
public Representation getRepresentation(String id) throws YardException, IllegalArgumentException {
  return yard.getRepresentation(id);
}

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

@Override
public Representation getRepresentation(String id) throws YardException, IllegalArgumentException {
  return yard.getRepresentation(id);
}

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

@Override
public Representation getEntityData(String id) {
  try {
    return yard.getRepresentation(id);
  } catch (YardException e) {
    log.error("Unable to get Representation '"+id+"' from Yard",e);
    return null;
  } catch (IllegalArgumentException e) {
    log.error("Unable to get Representation '"+id+"' from Yard",e);
    return null;
  }
}

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

@Override
public Representation getEntityData(String id) {
  try {
    return yard.getRepresentation(id);
  } catch (YardException e) {
    log.error("Unable to get Representation '"+id+"' from Yard",e);
    return null;
  } catch (IllegalArgumentException e) {
    log.error("Unable to get Representation '"+id+"' from Yard",e);
    return null;
  }
}

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

/**
 * Loads an Entity (Representation and Metadata) for the parsed id. In case
 * the parsed id represents metadata, than the id of the returned Entity will
 * be different from the parsed id.
 * @param id the id of the data or the metadata of the Entity to load
 * @return the Entity or <code>null</code> if not found
 * @throws YardException On any error with the parsed Yard.
 */
private Entity loadEntity(String id) throws YardException {
  return id == null || id.isEmpty() ? null :
    loadEntity(entityhubYard.getRepresentation(id));
}
/**

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

/**
 * Loads an Entity (Representation and Metadata) for the parsed id. In case
 * the parsed id represents metadata, than the id of the returned Entity will
 * be different from the parsed id.
 * @param id the id of the data or the metadata of the Entity to load
 * @return the Entity or <code>null</code> if not found
 * @throws YardException On any error with the parsed Yard.
 */
private Entity loadEntity(String id) throws YardException {
  return id == null || id.isEmpty() ? null :
    loadEntity(entityhubYard.getRepresentation(id));
}
/**

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

/**
 * Lookups (or initialises) the metadata for the entity with the parsed id 
 * @param entityId The id of the entity
 * @param init if the metadata should be initialised of not existing
 * @return the metadata for that Entity or <code>null</code> if not existing
 * and <code>init == false</code>
 * @throws YardException
 */
private Representation lookupMetadata(String entityId, boolean init) throws YardException {
  Representation metadata;
  //TODO: check the asumption that the Metadata always use the
  //      extension ".meta"
  String metaID = entityId+".meta";
  metadata = entityhubYard.getRepresentation(metaID);
  if(metadata == null){
    metadata = entityhubYard.create(metaID);
  }
  return metadata;
}
/**

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

/**
 * Lookups (or initialises) the metadata for the entity with the parsed id 
 * @param entityId The id of the entity
 * @param init if the metadata should be initialised of not existing
 * @return the metadata for that Entity or <code>null</code> if not existing
 * and <code>init == false</code>
 * @throws YardException
 */
private Representation lookupMetadata(String entityId, boolean init) throws YardException {
  Representation metadata;
  //TODO: check the asumption that the Metadata always use the
  //      extension ".meta"
  String metaID = entityId+".meta";
  metadata = entityhubYard.getRepresentation(metaID);
  if(metadata == null){
    metadata = entityhubYard.create(metaID);
  }
  return metadata;
}
/**

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

@Override
public void removeAll() throws YardException {
  //ensure that the baseConfig (if present) is not deleted by this
  //operation
  Representation baseConfig = yard.getRepresentation(Cache.BASE_CONFIGURATION_URI);
  yard.removeAll();
  if(baseConfig != null){
    yard.store(baseConfig);
  }
}

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

@Override
public void removeAll() throws YardException {
  //ensure that the baseConfig (if present) is not deleted by this
  //operation
  Representation baseConfig = yard.getRepresentation(Cache.BASE_CONFIGURATION_URI);
  yard.removeAll();
  if(baseConfig != null){
    yard.store(baseConfig);
  }
}

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

@Test(expected = IllegalArgumentException.class)
public void testGetRepresentationWithNull() throws YardException {
  getYard().getRepresentation(null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testGetRepresentationWithEmptyString() throws YardException {
  getYard().getRepresentation("");
}

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

/**
 * Loads the additional field mappings used by this cache from the yard.
 * This method sets the {@link #baseMapper} field during initialisation.
 * @param yard The yard
 * @param nsPrefixService if present '{prefix}:{localname}' configurations are
 * @return The parsed mappings or <code>null</code> if no found
 * @throws YardException on any Error while reading the {@link Representation}
 * holding the configuration from the {@link Yard}.
 * @throws IllegalArgumentException if <code>null</code> is parsed as {@link Yard}.
 */
protected static FieldMapper loadAdditionalMappings(Yard yard, NamespacePrefixService nsPrefixService) throws YardException {
  if(yard == null){
    throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
  }
  Representation addConfig = yard.getRepresentation(Cache.ADDITIONAL_CONFIGURATION_URI);
  if(addConfig != null){
    FieldMapper mapper = readFieldConfig(yard,addConfig, nsPrefixService);
    if(mapper == null){
      log.warn("Invalid Additinal Configuration: Unable to parse FieldMappings from Field "+Cache.FIELD_MAPPING_CONFIG_FIELD+"-> return NULL (no additional Configuration)");
      if(log.isWarnEnabled()){
        log.warn(ModelUtils.getRepresentationInfo(addConfig));
      }
    }
    return mapper;
  } else {
    return null;
  }
}
/**

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

/**
 * Loads the additional field mappings used by this cache from the yard.
 * This method sets the {@link #baseMapper} field during initialisation.
 * @param yard The yard
 * @param nsPrefixService if present '{prefix}:{localname}' configurations are
 * @return The parsed mappings or <code>null</code> if no found
 * @throws YardException on any Error while reading the {@link Representation}
 * holding the configuration from the {@link Yard}.
 * @throws IllegalArgumentException if <code>null</code> is parsed as {@link Yard}.
 */
protected static FieldMapper loadAdditionalMappings(Yard yard, NamespacePrefixService nsPrefixService) throws YardException {
  if(yard == null){
    throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
  }
  Representation addConfig = yard.getRepresentation(Cache.ADDITIONAL_CONFIGURATION_URI);
  if(addConfig != null){
    FieldMapper mapper = readFieldConfig(yard,addConfig, nsPrefixService);
    if(mapper == null){
      log.warn("Invalid Additinal Configuration: Unable to parse FieldMappings from Field "+Cache.FIELD_MAPPING_CONFIG_FIELD+"-> return NULL (no additional Configuration)");
      if(log.isWarnEnabled()){
        log.warn(ModelUtils.getRepresentationInfo(addConfig));
      }
    }
    return mapper;
  } else {
    return null;
  }
}
/**

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

@Test
public void testGetNonExistantRepresentation() throws YardException {
  String id = "urn:yard.test.testGetNonExistantRepresentation:representation.id";
  assertNull(getYard().getRepresentation(id));
}

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

throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
Representation baseConfig = yard.getRepresentation(Cache.BASE_CONFIGURATION_URI);
if(baseConfig != null){
  FieldMapper mapper = readFieldConfig(yard,baseConfig, nsPrefixService);

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

String entityId = ModelUtils.getAboutRepresentation(rep);
if(entityId != null){
  data = entityhubYard.getRepresentation(entityId);
  metadata = rep;
} else {

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

@Override
public Entity getEntity(String id) throws ManagedSiteException {
  Representation rep;
  try {
    rep = getYard().getRepresentation(id);
  } catch (YardException e) {
    throw new ManagedSiteException(e.getMessage(), e);
  }
  if(rep != null){
    Entity entity = new EntityImpl(config.getId(), rep, null);
    SiteUtils.initEntityMetadata(entity, siteMetadata, null);
    return entity;
  } else {
    return null;
  }
}

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

test = yard.getRepresentation(id);

相关文章