use of org.apache.jena.hadoop.rdf.types.CharacteristicWritable in project jena by apache.
the class CharacteristicTests method checkCharacteristicSet.
/**
* Checks a characteristic set
*
* @param set
* Set
* @param expectedItems
* Expected number of characteristics
* @param expectedCounts
* Expected counts for characteristics
*/
protected final void checkCharacteristicSet(CharacteristicSetWritable set, int expectedItems, long[] expectedCounts) {
Assert.assertEquals(expectedItems, set.size());
Assert.assertEquals(expectedItems, expectedCounts.length);
Iterator<CharacteristicWritable> iter = set.getCharacteristics();
int i = 0;
while (iter.hasNext()) {
CharacteristicWritable cw = iter.next();
Assert.assertEquals(expectedCounts[i], cw.getCount().get());
i++;
}
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicWritable in project jena by apache.
the class CharacteristicTests method characteristic_set_writable_03.
/**
* Tests characteristic sets
*
* @throws IOException
*/
@Test
public void characteristic_set_writable_03() throws IOException {
CharacteristicSetWritable set1 = new CharacteristicSetWritable();
CharacteristicSetWritable set2 = new CharacteristicSetWritable();
// Add some characteristics
CharacteristicWritable cw1 = new CharacteristicWritable(NodeFactory.createURI("http://example.org"));
CharacteristicWritable cw2 = new CharacteristicWritable(NodeFactory.createURI("http://example.org/other"));
set1.add(cw1);
set2.add(cw2);
this.checkCharacteristicSet(set1, 1, new long[] { 1 });
this.checkCharacteristicSet(set2, 1, new long[] { 1 });
this.checkRoundTrip(set1);
this.checkRoundTrip(set2);
Assert.assertNotEquals(set1, set2);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicWritable in project jena by apache.
the class CharacteristicTests method characteristic_set_writable_02.
/**
* Tests characteristic sets
*
* @throws IOException
*/
@Test
public void characteristic_set_writable_02() throws IOException {
CharacteristicSetWritable set = new CharacteristicSetWritable();
// Add some characteristics
CharacteristicWritable cw1 = new CharacteristicWritable(NodeFactory.createURI("http://example.org"));
CharacteristicWritable cw2 = new CharacteristicWritable(NodeFactory.createURI("http://example.org"), 2);
set.add(cw1);
set.add(cw2);
this.checkCharacteristicSet(set, 1, new long[] { 3 });
this.checkRoundTrip(set);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicWritable in project jena by apache.
the class CharacteristicTests method characteristic_writable_03.
/**
* Tests characteristic properties
*
* @throws IOException
*/
@Test
public void characteristic_writable_03() throws IOException {
CharacteristicWritable cw1 = new CharacteristicWritable(NodeFactory.createURI("http://example.org"));
CharacteristicWritable cw2 = new CharacteristicWritable(NodeFactory.createURI("http://example.org/other"));
this.checkRoundTrip(cw1);
this.checkRoundTrip(cw2);
// Should not be equal as different nodes
Assert.assertNotEquals(cw1, cw2);
}
use of org.apache.jena.hadoop.rdf.types.CharacteristicWritable in project jena by apache.
the class CharacteristicTests method characteristic_writable_01.
/**
* Tests characteristic round tripping
*
* @throws IOException
*/
@Test
public void characteristic_writable_01() throws IOException {
Node n = NodeFactory.createURI("http://example.org");
CharacteristicWritable expected = new CharacteristicWritable(n);
Assert.assertEquals(1, expected.getCount().get());
this.checkRoundTrip(expected);
}
Aggregations