Search in sources :

Example 1 with LexiconRelation

use of com.bigdata.rdf.lexicon.LexiconRelation in project wikidata-query-rdf by wikimedia.

the class WikibaseGeoUnitTest method testInteger.

@Test
@SuppressWarnings("rawtypes")
public void testInteger() {
    LexiconRelation rel = store().getLexiconRelation();
    Literal l = pointLiteral("Point(40.4426 -80.0068)");
    LiteralExtensionIV iv = (LiteralExtensionIV) rel.getInlineIV(l);
    assertEquals(GeoSparql.WKT_LITERAL, iv.getExtensionIV().getValue().toString());
    assertEquals(new XSDIntegerIV(new BigInteger("1008819921758573694187894119050371595694851885687493623808")), iv.getDelegate());
}
Also used : GeoUtils.pointLiteral(org.wikidata.query.rdf.blazegraph.geo.GeoUtils.pointLiteral) Literal(org.openrdf.model.Literal) XSDIntegerIV(com.bigdata.rdf.internal.impl.literal.XSDIntegerIV) BigInteger(java.math.BigInteger) LiteralExtensionIV(com.bigdata.rdf.internal.impl.literal.LiteralExtensionIV) LexiconRelation(com.bigdata.rdf.lexicon.LexiconRelation) Test(org.junit.Test)

Example 2 with LexiconRelation

use of com.bigdata.rdf.lexicon.LexiconRelation in project wikidata-query-rdf by wikimedia.

the class IsSomeValueFunctionFactory method create.

@Override
public IValueExpression<? extends IV> create(BOpContextBase context, GlobalAnnotations globals, Map<String, Object> map, ValueExpressionNode... args) {
    FunctionRegistry.checkArgs(args, ValueExpressionNode.class);
    IValueExpression<? extends IV> ve = AST2BOpUtility.toVE(context, globals, args[0]);
    if (mode == SomeValueMode.Blank) {
        return new IsBNodeBOp(ve);
    } else {
        String namespace = globals.lex;
        long timestamp = globals.timestamp;
        LexiconRelation lex = (LexiconRelation) context.getResource(namespace, timestamp);
        IV vocabPrefix = lex.getContainer().getVocabulary().get(lex.getValueFactory().createURI(skolemURIPrefix));
        if (vocabPrefix == null) {
            throw new IllegalStateException("[" + skolemURIPrefix + "] must be part of the vocabulary");
        }
        return new InlineVocabEqBOp(new BOp[] { ve }, vocabPrefix);
    }
}
Also used : IsBNodeBOp(com.bigdata.rdf.internal.constraints.IsBNodeBOp) IV(com.bigdata.rdf.internal.IV) LexiconRelation(com.bigdata.rdf.lexicon.LexiconRelation)

Aggregations

LexiconRelation (com.bigdata.rdf.lexicon.LexiconRelation)2 IV (com.bigdata.rdf.internal.IV)1 IsBNodeBOp (com.bigdata.rdf.internal.constraints.IsBNodeBOp)1 LiteralExtensionIV (com.bigdata.rdf.internal.impl.literal.LiteralExtensionIV)1 XSDIntegerIV (com.bigdata.rdf.internal.impl.literal.XSDIntegerIV)1 BigInteger (java.math.BigInteger)1 Test (org.junit.Test)1 Literal (org.openrdf.model.Literal)1 GeoUtils.pointLiteral (org.wikidata.query.rdf.blazegraph.geo.GeoUtils.pointLiteral)1