use of com.bigdata.rdf.internal.impl.uri.URIExtensionIV in project wikidata-query-rdf by wikimedia.
the class T213375_UnitTest method test_value_inlining.
@SuppressWarnings("rawtypes")
@Test
public void test_value_inlining() {
// Prepare value URI
String value = "http://www.wikidata.org/value/";
String id = "0123456789abcdef0123456789abcdef01234567";
String uri = value + id;
// Pass URI to the journal for inlining
IV<?, ?> iv = this.store.addTerm(new URIImpl(uri));
// Test IV type
assertEquals(URIExtensionIV.class, iv.getClass());
// Test prefix is inlined as vocabulary IV
IV extensionIV = ((URIExtensionIV) iv).getExtensionIV();
assertEquals(VocabURIByteIV.class, extensionIV.getClass());
// Test prefix encoded correctly in lexicon
assertEquals(value, extensionIV.asValue(this.store.getLexiconRelation()).stringValue());
// Test local name is xsd:integer
assertEquals(XSDIntegerIV.class, ((URIExtensionIV) iv).getLocalNameIV().getClass());
// Test local name is encoded as hex BigInteger
assertEquals(new BigInteger(id, 16), ((URIExtensionIV) iv).getLocalNameIV().integerValue());
// Test string representation of the IV matches to reference URI
assertEquals(uri, iv.asValue(this.store.getLexiconRelation()).stringValue());
}
use of com.bigdata.rdf.internal.impl.uri.URIExtensionIV in project wikidata-query-rdf by wikimedia.
the class T213375_UnitTest method test_reference_inlining.
@SuppressWarnings("rawtypes")
@Test
public void test_reference_inlining() {
// Prepare reference URI
String reference = "http://www.wikidata.org/reference/";
String id = "0123456789abcdef0123456789abcdef01234567";
String uri = reference + id;
// Pass URI to the journal for inlining
IV<?, ?> iv = this.store.addTerm(new URIImpl(uri));
// Test IV type
assertEquals(URIExtensionIV.class, iv.getClass());
// Test prefix is inlined as vocabulary IV
IV extensionIV = ((URIExtensionIV) iv).getExtensionIV();
assertEquals(VocabURIByteIV.class, extensionIV.getClass());
// Test prefix encoded correctly in lexicon
assertEquals(reference, extensionIV.asValue(this.store.getLexiconRelation()).stringValue());
// Test local name is xsd:integer
assertEquals(XSDIntegerIV.class, ((URIExtensionIV) iv).getLocalNameIV().getClass());
// Test local name is encoded as hex BigInteger
assertEquals(new BigInteger(id, 16), ((URIExtensionIV) iv).getLocalNameIV().integerValue());
// Test string representation of the IV matches to reference URI
assertEquals(uri, iv.asValue(this.store.getLexiconRelation()).stringValue());
}
Aggregations