Search in sources :

Example 61 with LiteralImpl

use of org.openrdf.model.impl.LiteralImpl in project wikidata-query-rdf by wikimedia.

the class WikibaseDateUnitTest method dateMinusPeriod.

@Test
public void dateMinusPeriod() throws QueryEvaluationException {
    TupleQueryResult results = query("SELECT ?now WHERE { BIND( ( \"2016-01-01T00:00:00\"^^xsd:dateTime - \"P7D\"^^xsd:duration ) AS ?now ) . }");
    BindingSet result = results.next();
    assertThat(result, binds("now", new LiteralImpl("2015-12-25T00:00:00Z", XMLSchema.DATETIME)));
}
Also used : BindingSet(org.openrdf.query.BindingSet) LiteralImpl(org.openrdf.model.impl.LiteralImpl) TupleQueryResult(org.openrdf.query.TupleQueryResult) Test(org.junit.Test)

Example 62 with LiteralImpl

use of org.openrdf.model.impl.LiteralImpl in project wikidata-query-rdf by wikimedia.

the class WikibaseDateUnitTest method dateExtension.

@Test
public void dateExtension() {
    BigdataStatement statement = roundTrip(Ontology.Time.VALUE, Ontology.Time.VALUE, new LiteralImpl("-0101-01-01T00:00:00", XMLSchema.DATE));
    assertThat(statement.getObject().getIV(), instanceOf(LiteralExtensionIV.class));
}
Also used : LiteralImpl(org.openrdf.model.impl.LiteralImpl) BigdataStatement(com.bigdata.rdf.model.BigdataStatement) LiteralExtensionIV(com.bigdata.rdf.internal.impl.literal.LiteralExtensionIV) Test(org.junit.Test)

Example 63 with LiteralImpl

use of org.openrdf.model.impl.LiteralImpl in project wikidata-query-rdf by wikimedia.

the class WikibaseDateUnitTest method dateFunctionQueryYear.

@Test
public void dateFunctionQueryYear() throws QueryEvaluationException {
    TupleQueryResult results = query("SELECT * WHERE {BIND ( year(\"-13798000000-01-01T00:00:00\"^^xsd:dateTime) AS ?date)}");
    BindingSet result = results.next();
    assertThat(result, binds("date", new LiteralImpl("-13798000000", XMLSchema.INTEGER)));
}
Also used : BindingSet(org.openrdf.query.BindingSet) LiteralImpl(org.openrdf.model.impl.LiteralImpl) TupleQueryResult(org.openrdf.query.TupleQueryResult) Test(org.junit.Test)

Example 64 with LiteralImpl

use of org.openrdf.model.impl.LiteralImpl in project wikidata-query-rdf by wikimedia.

the class WikibaseDateUnitTest method dateCompare.

// TODO: @Test - does not work yet
public void dateCompare() throws QueryEvaluationException {
    TupleQueryResult results = query("SELECT ((\"1990-01-01\"^^xsd:date < now()) as ?answer) WHERE {  }");
    BindingSet result = results.next();
    assertThat(result, binds("answer", new LiteralImpl("true", XMLSchema.BOOLEAN)));
}
Also used : BindingSet(org.openrdf.query.BindingSet) LiteralImpl(org.openrdf.model.impl.LiteralImpl) TupleQueryResult(org.openrdf.query.TupleQueryResult)

Example 65 with LiteralImpl

use of org.openrdf.model.impl.LiteralImpl in project wikidata-query-rdf by wikimedia.

the class RdfRepositoryIntegrationTest method senseWithStatement.

private void senseWithStatement(List<Statement> statements, String formId, String repr, String statementUri, String propertyId, String value) {
    statement(statements, formId, SKOS.DEFINITION, new LiteralImpl(repr));
    statements.addAll(expandedStatement(statementUri, formId, propertyId, new LiteralImpl(value), Ontology.NORMAL_RANK));
}
Also used : IntegerLiteralImpl(org.openrdf.model.impl.IntegerLiteralImpl) LiteralImpl(org.openrdf.model.impl.LiteralImpl)

Aggregations

LiteralImpl (org.openrdf.model.impl.LiteralImpl)155 Test (org.junit.Test)124 URIImpl (org.openrdf.model.impl.URIImpl)62 BindingSet (org.openrdf.query.BindingSet)58 Statement (org.openrdf.model.Statement)40 ArrayList (java.util.ArrayList)34 TupleQueryResult (org.openrdf.query.TupleQueryResult)34 QueryBindingSet (org.openrdf.query.algebra.evaluation.QueryBindingSet)33 URI (org.openrdf.model.URI)29 IntegerLiteralImpl (org.openrdf.model.impl.IntegerLiteralImpl)23 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)22 HashSet (java.util.HashSet)21 RyaStatement (org.apache.rya.api.domain.RyaStatement)19 RyaType (org.apache.rya.api.domain.RyaType)19 RyaURI (org.apache.rya.api.domain.RyaURI)19 ParsedQuery (org.openrdf.query.parser.ParsedQuery)19 SPARQLParser (org.openrdf.query.parser.sparql.SPARQLParser)19 StatementMetadata (org.apache.rya.api.domain.StatementMetadata)17 StatementImpl (org.openrdf.model.impl.StatementImpl)16 NumericLiteralImpl (org.openrdf.model.impl.NumericLiteralImpl)15