Search in sources :

Example 11 with IV

use of com.bigdata.rdf.internal.IV 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());
}
Also used : URIExtensionIV(com.bigdata.rdf.internal.impl.uri.URIExtensionIV) BigInteger(java.math.BigInteger) URIImpl(org.openrdf.model.impl.URIImpl) IV(com.bigdata.rdf.internal.IV) XSDIntegerIV(com.bigdata.rdf.internal.impl.literal.XSDIntegerIV) VocabURIByteIV(com.bigdata.rdf.internal.impl.uri.VocabURIByteIV) URIExtensionIV(com.bigdata.rdf.internal.impl.uri.URIExtensionIV) Test(org.junit.Test)

Aggregations

IV (com.bigdata.rdf.internal.IV)11 URIImpl (org.openrdf.model.impl.URIImpl)3 XSDIntegerIV (com.bigdata.rdf.internal.impl.literal.XSDIntegerIV)2 URIExtensionIV (com.bigdata.rdf.internal.impl.uri.URIExtensionIV)2 VocabURIByteIV (com.bigdata.rdf.internal.impl.uri.VocabURIByteIV)2 BigdataLiteral (com.bigdata.rdf.model.BigdataLiteral)2 StatementPatternNode (com.bigdata.rdf.sparql.ast.StatementPatternNode)2 BigInteger (java.math.BigInteger)2 Test (org.junit.Test)2 GeoUtils.pointFromIV (org.wikidata.query.rdf.blazegraph.geo.GeoUtils.pointFromIV)2 WikibasePoint (org.wikidata.query.rdf.common.WikibasePoint)2 IVariable (com.bigdata.bop.IVariable)1 IVariableOrConstant (com.bigdata.bop.IVariableOrConstant)1 IsBNodeBOp (com.bigdata.rdf.internal.constraints.IsBNodeBOp)1 CoordinateDD (com.bigdata.rdf.internal.gis.CoordinateDD)1 AbstractLiteralIV (com.bigdata.rdf.internal.impl.literal.AbstractLiteralIV)1 LiteralExtensionIV (com.bigdata.rdf.internal.impl.literal.LiteralExtensionIV)1 LexiconRelation (com.bigdata.rdf.lexicon.LexiconRelation)1 BigdataURI (com.bigdata.rdf.model.BigdataURI)1 BigdataValue (com.bigdata.rdf.model.BigdataValue)1