Search in sources :

Example 16 with StatementImpl

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

the class GeoIndexerSfTest method genericStatementWkt.

private static Statement genericStatementWkt(final Geometry geo) {
    final ValueFactory vf = new ValueFactoryImpl();
    final Resource subject = vf.createURI("uri:" + NAMES.get(geo));
    final URI predicate = GeoConstants.GEO_AS_WKT;
    final Value object = vf.createLiteral(geo.toString(), GeoConstants.XMLSCHEMA_OGC_WKT);
    return new StatementImpl(subject, predicate, object);
}
Also used : StatementImpl(org.openrdf.model.impl.StatementImpl) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) ValueFactory(org.openrdf.model.ValueFactory) URI(org.openrdf.model.URI)

Example 17 with StatementImpl

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

the class MongoGeoTemporalIndexerIT method statement.

private static RyaStatement statement(final TemporalInstant instant) {
    final ValueFactory vf = new ValueFactoryImpl();
    final Resource subject = vf.createURI("uri:test");
    final URI predicate = vf.createURI("Property:atTime");
    final Value object = vf.createLiteral(instant.toString());
    return RdfToRyaConversions.convertStatement(new StatementImpl(subject, predicate, object));
}
Also used : StatementImpl(org.openrdf.model.impl.StatementImpl) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) ValueFactory(org.openrdf.model.ValueFactory) URI(org.openrdf.model.URI)

Example 18 with StatementImpl

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

the class MongoIndexerDeleteIT method statement.

private static RyaStatement statement(final Geometry geo) {
    final ValueFactory vf = new ValueFactoryImpl();
    final Resource subject = vf.createURI("urn:geo");
    final URI predicate = GeoConstants.GEO_AS_WKT;
    final WKTWriter w = new WKTWriter();
    final Value object = vf.createLiteral(w.write(geo), GeoConstants.XMLSCHEMA_OGC_WKT);
    return RdfToRyaConversions.convertStatement(new StatementImpl(subject, predicate, object));
}
Also used : WKTWriter(com.vividsolutions.jts.io.WKTWriter) StatementImpl(org.openrdf.model.impl.StatementImpl) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) Resource(org.openrdf.model.Resource) Value(org.openrdf.model.Value) ValueFactory(org.openrdf.model.ValueFactory) URI(org.openrdf.model.URI)

Example 19 with StatementImpl

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

the class StatementSerializerTest method testSimpleStatementObjectUri.

@Test
public void testSimpleStatementObjectUri() throws Exception {
    ValueFactory vf = new ValueFactoryImpl();
    Statement s;
    s = new StatementImpl(vf.createURI("foo:subject"), vf.createURI("foo:predicate"), vf.createURI("foo:object"));
    Assert.assertEquals(s, StatementSerializer.readStatement(StatementSerializer.writeStatement(s)));
    s = new ContextStatementImpl(vf.createURI("foo:subject"), vf.createURI("foo:predicate"), vf.createURI("foo:object"), vf.createURI("foo:context"));
    Assert.assertEquals(s, StatementSerializer.readStatement(StatementSerializer.writeStatement(s)));
}
Also used : ContextStatementImpl(org.openrdf.model.impl.ContextStatementImpl) Statement(org.openrdf.model.Statement) ContextStatementImpl(org.openrdf.model.impl.ContextStatementImpl) StatementImpl(org.openrdf.model.impl.StatementImpl) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) ValueFactory(org.openrdf.model.ValueFactory) Test(org.junit.Test)

Example 20 with StatementImpl

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

the class StatementSerializerTest method testObjectLiteralWithDataTypeGarbage.

@Test
public void testObjectLiteralWithDataTypeGarbage() throws Exception {
    // test with some garbage in the literal that may throw off the parser
    ValueFactory vf = new ValueFactoryImpl();
    Statement s;
    String str;
    str = "Alice ^^<Palace>\"";
    s = new StatementImpl(vf.createURI("foo:subject"), vf.createURI("foo:predicate"), vf.createLiteral(str));
    Assert.assertEquals(s, StatementSerializer.readStatement(StatementSerializer.writeStatement(s)));
    s = new StatementImpl(vf.createURI("foo:subject"), vf.createURI("foo:predicate"), vf.createLiteral(str, "en"));
    Assert.assertEquals(s, StatementSerializer.readStatement(StatementSerializer.writeStatement(s)));
    s = new StatementImpl(vf.createURI("foo:subject"), vf.createURI("foo:predicate"), vf.createLiteral(str, vf.createURI("xsd:string")));
    Assert.assertEquals(s, StatementSerializer.readStatement(StatementSerializer.writeStatement(s)));
}
Also used : Statement(org.openrdf.model.Statement) ContextStatementImpl(org.openrdf.model.impl.ContextStatementImpl) StatementImpl(org.openrdf.model.impl.StatementImpl) ValueFactoryImpl(org.openrdf.model.impl.ValueFactoryImpl) ValueFactory(org.openrdf.model.ValueFactory) Test(org.junit.Test)

Aggregations

StatementImpl (org.openrdf.model.impl.StatementImpl)66 Statement (org.openrdf.model.Statement)40 Test (org.junit.Test)34 URI (org.openrdf.model.URI)32 ValueFactory (org.openrdf.model.ValueFactory)27 ValueFactoryImpl (org.openrdf.model.impl.ValueFactoryImpl)26 Resource (org.openrdf.model.Resource)19 Value (org.openrdf.model.Value)19 URIImpl (org.openrdf.model.impl.URIImpl)19 HashSet (java.util.HashSet)16 LiteralImpl (org.openrdf.model.impl.LiteralImpl)16 NumericLiteralImpl (org.openrdf.model.impl.NumericLiteralImpl)15 ContextStatementImpl (org.openrdf.model.impl.ContextStatementImpl)14 BindingSet (org.openrdf.query.BindingSet)14 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)14 RdfToRyaConversions.convertStatement (org.apache.rya.api.resolver.RdfToRyaConversions.convertStatement)10 PcjTableNameFactory (org.apache.rya.indexing.pcj.storage.accumulo.PcjTableNameFactory)10 QueryBindingSet (org.openrdf.query.algebra.evaluation.QueryBindingSet)10 TupleQuery (org.openrdf.query.TupleQuery)7 RepositoryConnection (org.openrdf.repository.RepositoryConnection)7