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();
}
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);
}
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);
}
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);
}
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();
}
Aggregations