Search in sources :

Example 6 with EntityQueryNode

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);
}
Also used : EntityQueryNode(org.apache.rya.indexing.entity.query.EntityQueryNode) Test(org.junit.Test)

Example 7 with EntityQueryNode

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);
}
Also used : EntityQueryNode(org.apache.rya.indexing.entity.query.EntityQueryNode) Test(org.junit.Test)

Example 8 with EntityQueryNode

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);
}
Also used : EntityQueryNode(org.apache.rya.indexing.entity.query.EntityQueryNode) Test(org.junit.Test)

Example 9 with EntityQueryNode

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);
}
Also used : EntityQueryNode(org.apache.rya.indexing.entity.query.EntityQueryNode) Test(org.junit.Test)

Aggregations

EntityQueryNode (org.apache.rya.indexing.entity.query.EntityQueryNode)9 Test (org.junit.Test)8 StatementPattern (org.openrdf.query.algebra.StatementPattern)2 ArrayList (java.util.ArrayList)1 Property (org.apache.rya.indexing.entity.model.Property)1 Type (org.apache.rya.indexing.entity.model.Type)1 BindingSet (org.openrdf.query.BindingSet)1 QueryEvaluationException (org.openrdf.query.QueryEvaluationException)1 QueryModelNode (org.openrdf.query.algebra.QueryModelNode)1 QueryBindingSet (org.openrdf.query.algebra.evaluation.QueryBindingSet)1 StatementPatternCollector (org.openrdf.query.algebra.helpers.StatementPatternCollector)1 SPARQLParser (org.openrdf.query.parser.sparql.SPARQLParser)1