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

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

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

Yard.getValueFactory介绍

[英]Getter for the ValueFactory instance used by this Yard to create Representation, Reference and Text instances.
[中]此码用于创建表示、引用和文本实例的ValueFactory实例的Getter。

代码示例

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

@Override
protected ValueFactory getValueFactory() {
  return yard.getValueFactory();
}
@Override

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

@Override
public ValueFactory getValueFactory() {
  return yard.getValueFactory();
}

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

@Override
public ValueFactory getValueFactory() {
  return yard.getValueFactory();
}

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

protected Representation create(String id, boolean store) throws YardException {
  Representation r;
  if (store) {
    r = getYard().create(id);
  } else if (id != null && !id.isEmpty()) {
    r = getYard().getValueFactory().createRepresentation(id);
  } else {
    throw new IllegalArgumentException("If store is FALSE the id MUST NOT be NULL nor EMPTY!");
  }
  representationIds.add(r.getId());
  return r;
}

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

@Test
public void testGetValueFactory() {
  assertNotNull("The ValueFactory MUST NOT be NULL", getYard().getValueFactory());
}

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

/**
 * Applies the mappings defined by the {@link #baseMapper} and the {@link #additionalMapper}
 * to the parsed Representation.
 *
 * @param yard The yard (local reference to avoid syncronization)
 * @param representation The representation to map
 * @return the mapped representation
 */
private Representation applyCacheMappings(Yard yard, Representation representation) {
  long start = System.currentTimeMillis();
  Representation mapped = null;
  ValueFactory valueFactory = getValueFactory();
  if (baseMapper != null) {
    mapped = yard.getValueFactory().createRepresentation(representation.getId());
    baseMapper.applyMappings(representation, mapped,valueFactory);
  }
  if (additionalMapper != null) {
    if (mapped == null) {
      mapped = yard.getValueFactory().createRepresentation(representation.getId());
    }
    additionalMapper.applyMappings(representation, mapped,valueFactory);
  }
  log.info("  -- applied mappings in " + (System.currentTimeMillis() - start) + "ms");
  return mapped != null ? mapped : representation;
}

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

/**
 * Applies the mappings defined by the {@link #baseMapper} and the {@link #additionalMapper}
 * to the parsed Representation.
 *
 * @param yard The yard (local reference to avoid syncronization)
 * @param representation The representation to map
 * @return the mapped representation
 */
private Representation applyCacheMappings(Yard yard, Representation representation) {
  long start = System.currentTimeMillis();
  Representation mapped = null;
  ValueFactory valueFactory = getValueFactory();
  if (baseMapper != null) {
    mapped = yard.getValueFactory().createRepresentation(representation.getId());
    baseMapper.applyMappings(representation, mapped,valueFactory);
  }
  if (additionalMapper != null) {
    if (mapped == null) {
      mapped = yard.getValueFactory().createRepresentation(representation.getId());
    }
    additionalMapper.applyMappings(representation, mapped,valueFactory);
  }
  log.info("  -- applied mappings in " + (System.currentTimeMillis() - start) + "ms");
  return mapped != null ? mapped : representation;
}

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

@Override
public void initialise() {
  //override the ldpath instance used for the initialisation with
  //the one using the IndexingDestination
  //this is OK, because parsing ldpath programs anyway does only need
  //the "value factory" role of the RDFBackend and does not actually
  //access any data.
  Yard yard = indexingConfig.getIndexingDestination().getYard();
  YardBackend backend = new YardBackend(yard);
  this.ldPath = new EntityhubLDPath(backend,yard.getValueFactory());
}

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

@Override
public void initialise() {
  //override the ldpath instance used for the initialisation with
  //the one using the IndexingDestination
  //this is OK, because parsing ldpath programs anyway does only need
  //the "value factory" role of the RDFBackend and does not actually
  //access any data.
  Yard yard = indexingConfig.getIndexingDestination().getYard();
  YardBackend backend = new YardBackend(yard);
  this.ldPath = new EntityhubLDPath(backend,yard.getValueFactory());
}

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

/**
 * Stores the baseMappings to the {@link Yard}. This may cause unexpected
 * behaviour for subsequest calls of the stored configuration does not
 * correspond with the actual data stored within the cache.<p>
 * Typically this is only used at the start or end of the creation of a
 * full Cache ({@link CacheStrategy#all}) of an referenced site (entity source).<p>
 * Note also that if the {@link #baseMapper} is <code>null</code> this
 * method removes any existing configuration from the yard.
 * @throws YardException an any error while storing the config to the yard.
 * @throws IllegalArgumentException if <code>null</code> is parsed as {@link Yard}.
 */
public static void storeBaseMappingsConfiguration(Yard yard,FieldMapper baseMapper) throws YardException,IllegalArgumentException {
  if(yard == null){
    throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
  }
  if(baseMapper == null){
    yard.remove(Cache.BASE_CONFIGURATION_URI);
  } else {
    Representation config = yard.getValueFactory().createRepresentation(Cache.BASE_CONFIGURATION_URI);
    writeFieldConfig(config,baseMapper);
    yard.store(config);
  }
}
/**

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

/**
 * Stores the current configuration used for caching documents back to the
 * {@link Yard}. This configuration is present in the  {@link #additionalMapper}).
 * If this field is <code>null</code> than any existing configuration is
 * removed form the index.
 * @throws YardException on any error while changing the configuration in the
 * yard.
 * @throws IllegalArgumentException if <code>null</code> is parsed as {@link Yard}.
 */
protected static void storeAdditionalMappingsConfiguration(Yard yard,FieldMapper additionalMapper) throws YardException,IllegalArgumentException {
  if(yard == null){
    throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
  }
  if(additionalMapper == null){
    yard.remove(Cache.ADDITIONAL_CONFIGURATION_URI);
  } else {
    Representation config = yard.getValueFactory().createRepresentation(Cache.ADDITIONAL_CONFIGURATION_URI);
    writeFieldConfig(config,additionalMapper);
    yard.store(config);
  }
}
/**

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

/**
 * Stores the baseMappings to the {@link Yard}. This may cause unexpected
 * behaviour for subsequest calls of the stored configuration does not
 * correspond with the actual data stored within the cache.<p>
 * Typically this is only used at the start or end of the creation of a
 * full Cache ({@link CacheStrategy#all}) of an referenced site (entity source).<p>
 * Note also that if the {@link #baseMapper} is <code>null</code> this
 * method removes any existing configuration from the yard.
 * @throws YardException an any error while storing the config to the yard.
 * @throws IllegalArgumentException if <code>null</code> is parsed as {@link Yard}.
 */
public static void storeBaseMappingsConfiguration(Yard yard,FieldMapper baseMapper) throws YardException,IllegalArgumentException {
  if(yard == null){
    throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
  }
  if(baseMapper == null){
    yard.remove(Cache.BASE_CONFIGURATION_URI);
  } else {
    Representation config = yard.getValueFactory().createRepresentation(Cache.BASE_CONFIGURATION_URI);
    writeFieldConfig(config,baseMapper);
    yard.store(config);
  }
}
/**

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

/**
 * Stores the current configuration used for caching documents back to the
 * {@link Yard}. This configuration is present in the  {@link #additionalMapper}).
 * If this field is <code>null</code> than any existing configuration is
 * removed form the index.
 * @throws YardException on any error while changing the configuration in the
 * yard.
 * @throws IllegalArgumentException if <code>null</code> is parsed as {@link Yard}.
 */
protected static void storeAdditionalMappingsConfiguration(Yard yard,FieldMapper additionalMapper) throws YardException,IllegalArgumentException {
  if(yard == null){
    throw new IllegalArgumentException("The parsed Yard MUST NOT be NULL!");
  }
  if(additionalMapper == null){
    yard.remove(Cache.ADDITIONAL_CONFIGURATION_URI);
  } else {
    Representation config = yard.getValueFactory().createRepresentation(Cache.ADDITIONAL_CONFIGURATION_URI);
    writeFieldConfig(config,additionalMapper);
    yard.store(config);
  }
}
/**

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

try {
  Yard yard = getYard();
  final ValueFactory vf = yard.getValueFactory();
  yard.store(new Iterable<Representation>() {                
    @Override

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

/**
 * Stores the parsed representation to the Yard and also applies the
 * configured {@link #getFieldMapper() FieldMappings}.
 * @param The representation to store
 */
@Override
public void store(Representation representation) throws ManagedSiteException {
  try {
    Yard yard = getYard();
    fieldMapper.applyMappings(representation, representation, yard.getValueFactory());
    yard.store(representation);
  }  catch (YardException e) {
    throw new ManagedSiteException(e.getMessage(), e);
  }
  
}
/**

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

return null;
ValueFactory valueFactory = entityhubYard.getValueFactory();

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

return null;
ValueFactory valueFactory = entityhubYard.getValueFactory();

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

/**
 * Tests that multiple Representations are removed.
 * 
 * @throws YardException
 */
@Test
public void testRemoveRepresentations() throws YardException {
  // NOTE: This test needs not to use the create(..) method, because we
  // remove the created representation form the store anyway as part of the
  // test
  String id = "urn:yard.test.testRemoveRepresentationsWithNullValue:representation.id1";
  String id2 = "urn:yard.test.testRemoveRepresentationsWithNullValue:representation.id2";
  String field = "urn:the.field:used.for.this.Test";
  String testValue = "This is a test";
  Yard yard = getYard();
  // use both ways to add the two Representations (should make no differences,
  // but one never can know ...
  Representation test1 = yard.create(id); // create and add
  Representation test2 = yard.getValueFactory().createRepresentation(id2); // create
  test2.add(field, testValue); // add value
  yard.store(test2);// store
  assertTrue(yard.isRepresentation(test1.getId())); // test if stored
  assertTrue(yard.isRepresentation(test2.getId()));
  yard.remove(Arrays.asList(test1.getId(), test2.getId())); // remove
  assertFalse(yard.isRepresentation(test1.getId())); // test if removed
  assertFalse(yard.isRepresentation(test2.getId()));
}
/**

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

String testValue = "This is a test";
Yard yard = getYard();
Representation test = yard.getValueFactory().createRepresentation(id);
test.add(field, testValue);

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

Representation test2 = yard.getValueFactory().createRepresentation(id2); // create

相关文章