Search in sources :

Example 6 with SingletonSet

use of org.openrdf.query.algebra.SingletonSet in project incubator-rya by apache.

the class ConstructConsequentVisitorTest method testMultiProjection.

@Test
public void testMultiProjection() {
    Extension extension = new Extension(new SingletonSet(), new ExtensionElem(new ValueConstant(RDF.TYPE), "rdftype"), new ExtensionElem(new ValueConstant(OWL.OBJECTPROPERTY), "owlprop"), new ExtensionElem(new ValueConstant(OWL.EQUIVALENTCLASS), "owleqcls"), new ExtensionElem(new ValueConstant(OWL.CLASS), "owlclass"));
    MultiProjection projection = new MultiProjection(extension, Arrays.asList(new ProjectionElemList(new ProjectionElem("cls", "subject"), new ProjectionElem("rdftype", "predicate"), new ProjectionElem("owlclass", "object")), new ProjectionElemList(new ProjectionElem("prop", "subject"), new ProjectionElem("rdftype", "predicate"), new ProjectionElem("owlprop", "object")), new ProjectionElemList(new ProjectionElem("owleqcls", "predicate"), new ProjectionElem("cls", "object"))));
    ConstructConsequentVisitor visitor = new ConstructConsequentVisitor();
    projection.visit(visitor);
    Set<StatementPattern> expected = Sets.newHashSet(new StatementPattern(s(null), p(RDF.TYPE), o(OWL.CLASS)), new StatementPattern(s(null), p(RDF.TYPE), o(OWL.OBJECTPROPERTY)), new StatementPattern(s(null), p(OWL.EQUIVALENTCLASS), o(null)));
    Assert.assertEquals(expected, visitor.getConsequents());
}
Also used : Extension(org.openrdf.query.algebra.Extension) ProjectionElemList(org.openrdf.query.algebra.ProjectionElemList) StatementPattern(org.openrdf.query.algebra.StatementPattern) SingletonSet(org.openrdf.query.algebra.SingletonSet) ValueConstant(org.openrdf.query.algebra.ValueConstant) ExtensionElem(org.openrdf.query.algebra.ExtensionElem) MultiProjection(org.openrdf.query.algebra.MultiProjection) ProjectionElem(org.openrdf.query.algebra.ProjectionElem) Test(org.junit.Test)

Aggregations

SingletonSet (org.openrdf.query.algebra.SingletonSet)6 Test (org.junit.Test)5 Extension (org.openrdf.query.algebra.Extension)5 ExtensionElem (org.openrdf.query.algebra.ExtensionElem)5 MultiProjection (org.openrdf.query.algebra.MultiProjection)5 ProjectionElem (org.openrdf.query.algebra.ProjectionElem)5 ProjectionElemList (org.openrdf.query.algebra.ProjectionElemList)5 StatementPattern (org.openrdf.query.algebra.StatementPattern)5 Projection (org.openrdf.query.algebra.Projection)4 ValueConstant (org.openrdf.query.algebra.ValueConstant)3 Var (org.openrdf.query.algebra.Var)2 BNodeGenerator (org.openrdf.query.algebra.BNodeGenerator)1 Filter (org.openrdf.query.algebra.Filter)1 ParsedTupleQuery (org.openrdf.query.parser.ParsedTupleQuery)1