public void test_blankNode() { final String id1 = "_12"; final String id2 = "_abc"; final String id3 = "abc"; final byte[] k1 = fixture.blankNode2Key(id1); final byte[] k2 = fixture.blankNode2Key(id2); final byte[] k3 = fixture.blankNode2Key(id3); if (log.isInfoEnabled()) { log.info("k1(bnodeId:" + id1 + ") = " + BytesUtil.toString(k1)); log.info("k2(bnodeId:" + id2 + ") = " + BytesUtil.toString(k2)); log.info("k3(bnodeId:" + id3 + ") = " + BytesUtil.toString(k3)); } assertTrue(BytesUtil.compareBytes(k1, k2) < 0); assertTrue(BytesUtil.compareBytes(k2, k3) < 0); }
/** * Test verifies the ordering among URIs, Literals, and BNodes. This ordering is important when * batching terms of these different types into the term index since you want to insert the type * types according to this order for the best performance. */ public void test_termTypeOrder() { /* * one key of each type. the specific values for the types do not matter * since we are only interested in the relative order between those * types in this test. */ final byte[] k1 = fixture.uri2key("http://www.cognitiveweb.org"); final byte[] k2 = fixture.plainLiteral2key("hello world!"); final byte[] k3 = fixture.blankNode2Key("a12"); assertTrue(BytesUtil.compareBytes(k1, k2) < 0); assertTrue(BytesUtil.compareBytes(k2, k3) < 0); }