本文整理了Java中org.apache.stanbol.entityhub.servicesapi.yard.Yard.isRepresentation()
方法的一些代码示例,展示了Yard.isRepresentation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Yard.isRepresentation()
方法的具体详情如下:
包路径:org.apache.stanbol.entityhub.servicesapi.yard.Yard
类名称:Yard
方法名:isRepresentation
[英]checks if a representation with the given id is present in the Yard
[中]
代码示例来源:origin: apache/stanbol
@Override
public boolean isRepresentation(String id) throws YardException, IllegalArgumentException {
return yard.isRepresentation(id);
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core
@Override
public boolean isRepresentation(String id) throws YardException, IllegalArgumentException {
return yard.isRepresentation(id);
}
代码示例来源:origin: org.apache.stanbol/org.apache.stanbol.entityhub.core
@Override
public final boolean isRepresentation(String entityId) throws EntityhubException, IllegalArgumentException {
if(entityId == null || entityId.isEmpty()){
throw new IllegalArgumentException("The parsed id MUST NOT be NULL nor empty!");
}
return entityhubYard.isRepresentation(entityId);
}
@Override
代码示例来源:origin: apache/stanbol
@Override
public final boolean isRepresentation(String entityId) throws EntityhubException, IllegalArgumentException {
if(entityId == null || entityId.isEmpty()){
throw new IllegalArgumentException("The parsed id MUST NOT be NULL nor empty!");
}
return entityhubYard.isRepresentation(entityId);
}
@Override
代码示例来源:origin: apache/stanbol
@Test(expected = IllegalArgumentException.class)
public void testIsRepresentationWithNull() throws YardException {
getYard().isRepresentation(null);
}
代码示例来源:origin: apache/stanbol
@Test(expected = IllegalArgumentException.class)
public void testIsRepresentationWithEmptyString() throws YardException {
getYard().isRepresentation("");
}
代码示例来源: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
/**
* 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
@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
assertTrue(yard.isRepresentation(test1.getId())); // test if stored
assertTrue(yard.isRepresentation(test2.getId()));
assertFalse(yard.isRepresentation(test1.getId())); // test if removed
assertFalse(yard.isRepresentation(test2.getId()));
assertTrue(yard.isRepresentation(test1.getId())); // test if stored
assertFalse(yard.isRepresentation(test1.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
test.add(field, testValue);
assertTrue(yard.isRepresentation(test.getId())); // test if stored
assertFalse(yard.isRepresentation(test.getId()));// test if removed
内容来源于网络,如有侵权,请联系作者删除!