public void test_plainLiteral() { final String lit1 = "abc"; final String lit2 = "abcd"; final String lit3 = "abcde"; final byte[] k1 = fixture.plainLiteral2key(lit1); final byte[] k2 = fixture.plainLiteral2key(lit2); final byte[] k3 = fixture.plainLiteral2key(lit3); if (log.isInfoEnabled()) { log.info("k1(" + lit1 + ") = " + BytesUtil.toString(k1)); log.info("k2(" + lit2 + ") = " + BytesUtil.toString(k2)); log.info("k3(" + lit3 + ") = " + 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); }
public void test_plain_vs_languageCode_literal() { final String en = "en"; // String de = "de"; final String lit1 = "abc"; // String lit2 = "abc"; // String lit3 = "abce"; // final Literal a = new LiteralImpl("foo"); // final Literal b = new LiteralImpl("foo", "en"); final byte[] k1 = fixture.plainLiteral2key(lit1); final byte[] k2 = fixture.languageCodeLiteral2key(en, lit1); // not encoded onto the same key. assertFalse(BytesUtil.bytesEqual(k1, k2)); // the plain literals are ordered before the language code literals. assertTrue(BytesUtil.compareBytes(k1, k2) < 0); }