use of org.apache.rya.indexing.entity.query.EntityQueryNode in project incubator-rya by apache.
the class MongoEntityIndex2IT method queryIsFullEntityWithOptional.
@Test()
public void queryIsFullEntityWithOptional() throws Exception {
// A pattern that has two different subjects.
final String query = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + "<urn:SSN:111-11-1111> <urn:name> ?name . " + " OPTIONAL{" + " <urn:SSN:222-22-2222> <urn:age> ?age . " + " <urn:SSN:222-22-2222> <urn:eye> ?eye . " + " <urn:SSN:222-22-2222> <urn:name> ?name . " + " } . " + "}";
final String expectedQuery = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + "<urn:SSN:111-11-1111> <urn:name> ?name . " + "}";
final EntityQueryNode expected = new EntityQueryNode(PERSON_TYPE, getSPs(expectedQuery), entityStorage);
assertOptimizer(query, expected);
}
use of org.apache.rya.indexing.entity.query.EntityQueryNode in project incubator-rya by apache.
the class MongoEntityIndex2IT method queryIsPartEntity.
@Test()
public void queryIsPartEntity() throws Exception {
// A pattern that has two different subjects.
final String query = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + "<urn:SSN:111-11-1111> <urn:age> ?age . " + "}";
final EntityQueryNode expected = new EntityQueryNode(PERSON_TYPE, getSPs(query), entityStorage);
assertOptimizer(query, expected);
}
use of org.apache.rya.indexing.entity.query.EntityQueryNode in project incubator-rya by apache.
the class MongoEntityIndex2IT method queryIsPartEntityandExtra.
@Test()
public void queryIsPartEntityandExtra() throws Exception {
// A pattern that has two different subjects.
final String query = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:222-22-2222> <urn:age> ?age . " + "<urn:SSN:222-22-2222> <urn:eye> ?eye . " + "<urn:SSN:222-22-2222> <urn:name> ?name . " + "}";
final String expectedQuery = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + "<urn:SSN:111-11-1111> <urn:age> ?age . " + "}";
final EntityQueryNode expected = new EntityQueryNode(PERSON_TYPE, getSPs(expectedQuery), entityStorage);
assertOptimizer(query, expected);
}
use of org.apache.rya.indexing.entity.query.EntityQueryNode in project incubator-rya by apache.
the class MongoEntityIndex2IT method queryEntityInOptional.
@Test()
public void queryEntityInOptional() throws Exception {
// A pattern that has two different subjects.
final String query = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <urn:age> ?age . " + "<urn:SSN:111-11-1111> <urn:eye> ?eye . " + " OPTIONAL{" + " <urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + " <urn:SSN:111-11-1111> <urn:name> ?name . " + " } . " + "}";
final String expectedQuery = "SELECT * WHERE { " + "<urn:SSN:111-11-1111> <" + RDF.TYPE + "> <urn:person> ." + "<urn:SSN:111-11-1111> <urn:name> ?name . " + "}";
final EntityQueryNode expected = new EntityQueryNode(PERSON_TYPE, getSPs(expectedQuery), entityStorage);
assertOptimizer(query, expected);
}
Aggregations