use of org.openrdf.model.impl.ValueFactoryImpl in project incubator-rya by apache.
the class MongoIndexerDeleteIT method populateRya.
private void populateRya(final SailRepositoryConnection conn) throws Exception {
final ValueFactory VF = new ValueFactoryImpl();
// geo 2x2 points
final GeometryFactory GF = new GeometryFactory();
for (int x = 0; x <= 1; x++) {
for (int y = 0; y <= 1; y++) {
final Geometry geo = GF.createPoint(new Coordinate(x + .5, y + .5));
final RyaStatement stmnt = statement(geo);
final Statement statement = RyaToRdfConversions.convertStatement(stmnt);
conn.add(statement);
}
}
// freetext
final URI person = VF.createURI("http://example.org/ontology/Person");
String uuid;
uuid = "urn:people";
conn.add(VF.createURI(uuid), RDF.TYPE, person);
conn.add(VF.createURI(uuid), RDFS.LABEL, VF.createLiteral("Alice Palace Hose", VF.createURI("http://www.w3.org/2001/XMLSchema#string")));
conn.add(VF.createURI(uuid), RDFS.LABEL, VF.createLiteral("Bob Snob Hose", "en"));
// temporal
final TemporalInstant instant = new TemporalInstantRfc3339(1, 2, 3, 4, 5, 6);
conn.add(VF.createURI("foo:time"), VF.createURI("Property:atTime"), VF.createLiteral(instant.toString()));
}
use of org.openrdf.model.impl.ValueFactoryImpl 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)));
}
use of org.openrdf.model.impl.ValueFactoryImpl 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)));
}
use of org.openrdf.model.impl.ValueFactoryImpl in project incubator-rya by apache.
the class RyaTypeDocumentConverterTest method fromDocument.
@Test
public void fromDocument() throws DocumentConverterException {
// Convert a document into a RyaType
final Document document = new Document().append(RyaTypeDocumentConverter.DATA_TYPE, XMLSchema.DOUBLE.toString()).append(RyaTypeDocumentConverter.VALUE, "4.5");
final RyaType ryaType = new RyaTypeDocumentConverter().fromDocument(document);
// Show the converted value has the expected structure.
final RyaType expected = RdfToRyaConversions.convertLiteral(new ValueFactoryImpl().createLiteral(4.5));
assertEquals(expected, ryaType);
}
use of org.openrdf.model.impl.ValueFactoryImpl in project incubator-rya by apache.
the class MongoExecuteSparqlQueryIT method makeTestStatements.
/**
* @return some data to load
*/
private List<Statement> makeTestStatements() {
final List<Statement> loadMe = new ArrayList<>();
final ValueFactory vf = new ValueFactoryImpl();
loadMe.add(vf.createStatement(vf.createURI("http://example#alice"), vf.createURI("http://example#talksTo"), vf.createURI("http://example#bob")));
loadMe.add(vf.createStatement(vf.createURI("http://example#bob"), vf.createURI("http://example#talksTo"), vf.createURI("http://example#charlie")));
loadMe.add(vf.createStatement(vf.createURI("http://example#charlie"), vf.createURI("http://example#likes"), vf.createURI("http://example#icecream")));
return loadMe;
}
Aggregations