Search in sources :

Example 11 with URI

use of org.openrdf.model.URI in project incubator-rya by apache.

the class CbSailTest method testSimpleQuery.

public void testSimpleQuery() throws Exception {
    RepositoryConnection conn = repository.getConnection();
    URI cpu = vf.createURI(litdupsNS, "cpu");
    URI loadPerc = vf.createURI(litdupsNS, "loadPerc");
    URI uri1 = vf.createURI(litdupsNS, "uri1");
    conn.add(cpu, loadPerc, uri1);
    conn.commit();
    conn.close();
    resultEndpoint.expectedMessageCount(1);
    // query through camel
    String query = "select * where {" + "<" + cpu.toString() + "> ?p ?o1." + "}";
    template.sendBodyAndHeader(null, CbSailComponent.SPARQL_QUERY_PROP, query);
    assertMockEndpointsSatisfied();
}
Also used : RepositoryConnection(org.openrdf.repository.RepositoryConnection) URI(org.openrdf.model.URI)

Example 12 with URI

use of org.openrdf.model.URI in project incubator-rya by apache.

the class TemporalFilterIT method statement.

private static Statement statement(final ZonedDateTime time) {
    final Resource subject = vf.createURI("urn:time");
    final URI predicate = vf.createURI("http://www.w3.org/2006/time/atTime");
    final Value object = vf.createLiteral(time.toString());
    return new StatementImpl(subject, predicate, object);
}
Also used : StatementImpl(org.openrdf.model.impl.StatementImpl) Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) URI(org.openrdf.model.URI)

Example 13 with URI

use of org.openrdf.model.URI in project incubator-rya by apache.

the class RyaDaoQueryWrapper method queryAll.

/**
 * Handles all results of a query. Closes the query iterator when done.
 * @param statement the {@link Statement} to query for. (not {@code null})
 * @param rdfStatementHandler the {@link RDFHandler} to use for handling
 * each statement returned. (not {@code null})
 * @throws QueryEvaluationException
 */
public void queryAll(final Statement statement, final RDFHandler rdfStatementHandler) throws QueryEvaluationException {
    final Resource subject = statement.getSubject();
    final URI predicate = statement.getPredicate();
    final Value object = statement.getObject();
    final Resource context = statement.getContext();
    queryAll(subject, predicate, object, rdfStatementHandler, context);
}
Also used : Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) URI(org.openrdf.model.URI)

Example 14 with URI

use of org.openrdf.model.URI in project incubator-rya by apache.

the class DateTimeWithinPeriod method convertPeriodToMillis.

private long convertPeriodToMillis(Literal literal, URI unit) {
    String stringVal = literal.getLabel();
    URI dataType = literal.getDatatype();
    checkArgument(dataType.equals(XMLSchema.INTEGER) || dataType.equals(XMLSchema.INT), String.format("Invalid data type for period duration. Data Type must be of type %s or %s .", XMLSchema.INTEGER, XMLSchema.INT));
    checkArgument(XMLDatatypeUtil.isValidInteger(stringVal) || XMLDatatypeUtil.isValidInt(stringVal), "Invalid duration value.");
    return convertToMillis(Integer.parseInt(stringVal), unit);
}
Also used : URI(org.openrdf.model.URI)

Example 15 with URI

use of org.openrdf.model.URI in project incubator-rya by apache.

the class DateTimeWithinPeriod method convertToInstant.

private Instant convertToInstant(Literal literal) {
    String stringVal = literal.getLabel();
    URI dataType = literal.getDatatype();
    checkArgument(dataType.equals(XMLSchema.DATETIME) || dataType.equals(XMLSchema.DATE), String.format("Invalid data type for date time. Data Type must be of type %s or %s .", XMLSchema.DATETIME, XMLSchema.DATE));
    checkArgument(XMLDatatypeUtil.isValidDateTime(stringVal) || XMLDatatypeUtil.isValidDate(stringVal), "Invalid date time value.");
    return literal.calendarValue().toGregorianCalendar().toInstant();
}
Also used : URI(org.openrdf.model.URI)

Aggregations

URI (org.openrdf.model.URI)368 Test (org.junit.Test)138 Value (org.openrdf.model.Value)122 Resource (org.openrdf.model.Resource)110 Statement (org.openrdf.model.Statement)96 ValueFactory (org.openrdf.model.ValueFactory)83 ValueFactoryImpl (org.openrdf.model.impl.ValueFactoryImpl)67 URIImpl (org.openrdf.model.impl.URIImpl)58 HashSet (java.util.HashSet)36 RyaURI (org.apache.rya.api.domain.RyaURI)34 RdfToRyaConversions.convertStatement (org.apache.rya.api.resolver.RdfToRyaConversions.convertStatement)34 Literal (org.openrdf.model.Literal)34 ContextStatementImpl (org.openrdf.model.impl.ContextStatementImpl)34 StatementImpl (org.openrdf.model.impl.StatementImpl)32 LiteralImpl (org.openrdf.model.impl.LiteralImpl)29 Var (org.openrdf.query.algebra.Var)28 ArrayList (java.util.ArrayList)25 SailConnection (org.openrdf.sail.SailConnection)25 LinearRing (com.vividsolutions.jts.geom.LinearRing)24 Polygon (com.vividsolutions.jts.geom.Polygon)24