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

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

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

Yard.remove介绍

[英]Removes all the Representation of the parsed ids. null values are ignored.
[中]删除已解析ID的所有表示形式。null值被忽略。

代码示例

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

@Override
public void remove(Iterable<String> ids) throws IllegalArgumentException, YardException {
  yard.remove(ids);
}
@Override

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

@Override
public void remove(Iterable<String> ids) throws IllegalArgumentException, YardException {
  yard.remove(ids);
}
@Override

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

@Override
public void remove(String id) throws IllegalArgumentException, YardException {
  yard.remove(id);
}

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

@Override
public void remove(String id) throws IllegalArgumentException, YardException {
  yard.remove(id);
}

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

@Test(expected = IllegalArgumentException.class)
public void testRemoveRepresentationWithNull() throws YardException {
  getYard().remove((String) null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testRemoveRepresentationsWithNull() throws YardException {
  getYard().remove((Iterable<String>) null);
}

代码示例来源: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: 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

/**
 * Deleted both the representation and the metadata of an Entity
 * @param yard the yard to delete the entity from
 * @param entity the entity to delete
 * @throws YardException an any Exception while deleting the Entity
 */
private void deleteEntity(Entity entity) throws YardException {
  if(entity != null){
    entityhubYard.remove(Arrays.asList(
      entity.getRepresentation().getId(),
      entity.getMetadata().getId()));
  }
}
private void deleteEntities(Collection<String> ids) throws YardException {

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

@Override
public void delete(String id) throws ManagedSiteException {
  try {
    getYard().remove(id);
  }  catch (YardException e) {
    throw new ManagedSiteException(e.getMessage(), e);
  }
}

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

/**
 * Deleted both the representation and the metadata of an Entity
 * @param yard the yard to delete the entity from
 * @param entity the entity to delete
 * @throws YardException an any Exception while deleting the Entity
 */
private void deleteEntity(Entity entity) throws YardException {
  if(entity != null){
    entityhubYard.remove(Arrays.asList(
      entity.getRepresentation().getId(),
      entity.getMetadata().getId()));
  }
}
private void deleteEntities(Collection<String> ids) throws YardException {

代码示例来源: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: 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

/**
 * 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 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

/**
 * Tests if <code>null</code> values within the Iterable are ignored and do not cause an Exception
 * 
 * @throws YardException
 */
@Test
public void testRemoveRepresentationsWithNullValue() 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.id";
  Yard yard = getYard();
  Representation test = yard.create(id); // create and add
  assertTrue(yard.isRepresentation(test.getId()));
  yard.remove(Arrays.asList(test.getId(), null));
  assertFalse(yard.isRepresentation(test.getId()));
}

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

/**
 * Tests that {@link Representation} IDs that are not stored by the yard are ignored by the multiple
 * remove method
 * 
 * @throws YardException
 */
@Test
public void testRemoveRepresentationsWithNonStoredValue() 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.stored";
  String id2 = "urn:yard.test.testRemoveRepresentationsWithNullValue:representation.notStored";
  Yard yard = getYard();
  Representation test = yard.create(id); // create and add
  assertTrue(yard.isRepresentation(test.getId()));
  yard.remove(Arrays.asList(test.getId(), id2));
  assertFalse(yard.isRepresentation(test.getId()));
  assertFalse(yard.isRepresentation(id2));
}

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

@Test
public void testIsRepresentation() throws YardException {
  String id = "urn:yard.test.testIsRepresentation:representation.id";
  Yard yard = getYard();
  // Representations created via the yard need to be created (as empty
  // representation within the yard
  Representation test = create();
  assertTrue(yard.isRepresentation(test.getId()));
  // Representations created via the ValueFactory MUST NOT be added to the
  // Yard
  Representation test2 = create(id, false);
  assertFalse(yard.isRepresentation(test2.getId()));
  // now store test2 and test again
  yard.store(test2);
  assertTrue(yard.isRepresentation(test2.getId()));
  // now remove test and test again
  yard.remove(test.getId());
  assertFalse(yard.isRepresentation(test.getId()));
  yard.remove(test2.getId());
  assertFalse(yard.isRepresentation(test2.getId()));
}

代码示例来源: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

yard.remove(test.getId()); // test (1) - the remove

相关文章