gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-14 07:54:49 28 4
gpt4 key购买 nike

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

Yard.update介绍

[英]Updates the store with the new state of the parsed representations. This can improve performance, because it does not require multiple commits.
null values are ignored and added as null in the returned Iterable. Otherwise same as #update(Representation).
[中]使用解析的表示的新状态更新存储。这可以提高性能,因为它不需要多次提交。
null值被忽略,并作为null添加到返回的Iterable中。否则与#更新(表示)相同。

代码示例

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

@Override
  public Iterable<Representation> update(Iterable<Representation> representations) throws YardException, IllegalArgumentException {
    return yard.update(representations);
  }
}

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

@Override
  public Iterable<Representation> update(Iterable<Representation> representations) throws YardException, IllegalArgumentException {
    return yard.update(representations);
  }
}

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

@Override
public Representation update(Representation representation) throws YardException, IllegalArgumentException {
  return yard.update(applyCacheMappings(yard, representation));
}

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

@Override
public Representation update(Representation representation) throws YardException, IllegalArgumentException {
  return yard.update(applyCacheMappings(yard, representation));
}

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

@Test(expected = IllegalArgumentException.class)
public void testUpdateRepresentationsWithNull() throws YardException {
  getYard().update((Iterable<Representation>) null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testUpdateRepresentationWithNull() throws YardException {
  getYard().update((Representation) null);
}

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

@Test(expected = IllegalArgumentException.class)
public void testUpdateRepresentationWithNonPresent() throws YardException {
  String id = "urn:yard.test.testUpdateRepresentationWithNonPresent:representation.id";
  Representation test = create(id, false);
  getYard().update(test); // throws an Exception because test is not part of the yard
}

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

/**
 * When updating multiple null values need to be ignored.
 * 
 * @throws YardException
 */
@Test
public void testUpdateRepresentationsWithNullElement() throws YardException {
  // NOTE: this does not test if the updated view of the representation is
  // stored, but only that the update method works correctly
  Yard yard = getYard();
  String id1 = "urn:yard.test.testUpdateRepresentationsWithNullElement:representation.id";
  String field = "urn:the.field:used.for.this.Test";
  Representation test1 = create(id1, true);
  // change the representations to be sure to force an update even if the
  // implementation checks for changes before updating a representation
  test1.add(field, "test value 1");
  Iterable<Representation> updated = yard.update(Arrays.asList(test1, null));
  assertNotNull(updated);
  Iterator<Representation> updatedIt = updated.iterator();
  assertTrue(updatedIt.hasNext());
  assertEquals(test1, updatedIt.next());
  assertFalse(updatedIt.hasNext());
}

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

/**
 * When updating multiple non present representations need to be ignored.
 * 
 * @throws YardException
 */
@Test
public void testUpdateRepresentationsWithNonPresent() throws YardException {
  // NOTE: this does not test if the updated view of the representation is
  // stored, but only that the update method works correctly
  Yard yard = getYard();
  String id1 = "urn:yard.test.testUpdateRepresentationsWithNonPresent:representation.id1";
  String id2 = "urn:yard.test.testUpdateRepresentationsWithNonPresent:representation.id2";
  String field = "urn:the.field:used.for.this.Test";
  Representation test1 = create(id1, true);
  // change the representations to be sure to force an update even if the
  // implementation checks for changes before updating a representation
  test1.add(field, "test value 1");
  // create a 2nd Representation by using the ValueFactory (will not add it
  // to the yard!)
  Representation test2 = create(id2, false);
  // now test1 is present and test2 is not.
  Iterable<Representation> updated = yard.update(Arrays.asList(test1, test2));
  // We expect that only test1 is updated and test2 is ignored
  assertNotNull(updated);
  Iterator<Representation> updatedIt = updated.iterator();
  assertTrue(updatedIt.hasNext());
  assertEquals(test1, updatedIt.next());
  assertFalse(updatedIt.hasNext());
}

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

@Test
public void testUpdateRepresentations() throws YardException {
  // NOTE: this does not test if the updated view of the representation is
  // stored, but only that the update method works correctly
  Yard yard = getYard();
  String id1 = "urn:yard.test.testUpdateRepresentations:representation.id1";
  String id2 = "urn:yard.test.testUpdateRepresentations:representation.id2";
  String field = "urn:the.field:used.for.this.Test";
  Representation test1 = create(id1, true);
  Representation test2 = create(id2, true);
  // change the representations to be sure to force an update even if the
  // implementation checks for changes before updating a representation
  test1.add(field, "test value 1");
  test2.add(field, "test value 2");
  Iterable<Representation> updatedIterable = yard.update(Arrays.asList(test1, test2));
  assertNotNull(updatedIterable);
  Collection<Representation> updated = asCollection(updatedIterable.iterator());
  // test that both the parsed Representations where stored (updated & created)
  assertTrue(updated.remove(test1));
  assertTrue(updated.remove(test2));
  assertTrue(updated.isEmpty());
}

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

stored = yard.update(test);
values = asCollection(stored.get(field));

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com