public void test_lubmQuery8(){
  final String relation="spo";
  final long timestamp=ITx.READ_COMMITTED;
  final Constant<?> rdfType=new Constant<String>("rdfType");
  final Constant<?> Department=new Constant<String>("Department");
  final Constant<?> Student=new Constant<String>("Student");
  final Constant<?> memberOf=new Constant<String>("memberOf");
  final Constant<?> subOrganizationOf=new Constant<String>("subOrganizationOf");
  final Constant<?> emailAddress=new Constant<String>("emailAddress");
  final Constant<?> University0=new Constant<String>("University0");
  final IPredicate<?> pred0=new Predicate(new IVariableOrConstant[]{Var.var("y"),rdfType,Department},new NV(Predicate.Annotations.RELATION_NAME,new String[]{relation}),new NV(Annotations.TIMESTAMP,timestamp));
  final IPredicate<?> pred1=new Predicate(new IVariableOrConstant[]{Var.var("x"),rdfType,Student},new NV(Predicate.Annotations.RELATION_NAME,new String[]{relation}),new NV(Annotations.TIMESTAMP,timestamp));
  final IPredicate<?> pred2=new Predicate(new IVariableOrConstant[]{Var.var("x"),memberOf,Var.var("y")},new NV(Predicate.Annotations.RELATION_NAME,new String[]{relation}),new NV(Annotations.TIMESTAMP,timestamp));
  final IPredicate<?> pred3=new Predicate(new IVariableOrConstant[]{Var.var("y"),subOrganizationOf,University0},new NV(Predicate.Annotations.RELATION_NAME,new String[]{relation}),new NV(Annotations.TIMESTAMP,timestamp));
  final IPredicate<?> pred4=new Predicate(new IVariableOrConstant[]{Var.var("x"),emailAddress,Var.var("z")},new NV(Predicate.Annotations.RELATION_NAME,new String[]{relation}),new NV(Annotations.TIMESTAMP,timestamp));
  final IRule rule=new Rule(getName(),null,new IPredicate[]{pred0,pred1,pred2,pred3,pred4},null);
  final Map<IPredicate,Long> rangeCount=new HashMap<IPredicate,Long>();
{
    rangeCount.put(pred0,15L);
    rangeCount.put(pred1,6463L);
    rangeCount.put(pred2,8830L);
    rangeCount.put(pred3,15L);
    rangeCount.put(pred4,8830L);
  }
  final IEvaluationPlan plan=newPlan(new MockJoinNexus(new MockRangeCountFactory(rangeCount)),rule);
  assertFalse(plan.isEmpty());
  final int[] expected=new int[]{0,3,2,1,4};
  final int[] actual=plan.getOrder();
  if (!Arrays.equals(expected,actual))   fail("evaluation order: expected=" + Arrays.toString(expected) + ", actual="+ Arrays.toString(actual));
}

public void test_lubmQuery8 ( ) { final String relation = "spo" ; final long timestamp = ITx . READ_COMMITTED ; final Constant < ? > rdfType = new Constant < String > ( "rdfType" ) ; final Constant < ? > Department = new Constant < String > ( "Department" ) ; final Constant < ? > Student = new Constant < String > ( "Student" ) ; final Constant < ? > memberOf = new Constant < String > ( "memberOf" ) ; final Constant < ? > subOrganizationOf = new Constant < String > ( "subOrganizationOf" ) ; final Constant < ? > emailAddress = new Constant < String > ( "emailAddress" ) ; final Constant < ? > University0 = new Constant < String > ( "University0" ) ; final IPredicate < ? > pred0 = new Predicate ( new IVariableOrConstant [ ] { Var . var ( "y" ) , rdfType , Department } , new NV ( Predicate . Annotations . RELATION_NAME , new String [ ] { relation } ) , new NV ( Annotations . TIMESTAMP , timestamp ) ) ; final IPredicate < ? > pred1 = new Predicate ( new IVariableOrConstant [ ] { Var . var ( "x" ) , rdfType , Student } , new NV ( Predicate . Annotations . RELATION_NAME , new String [ ] { relation } ) , new NV ( Annotations . TIMESTAMP , timestamp ) ) ; final IPredicate < ? > pred2 = new Predicate ( new IVariableOrConstant [ ] { Var . var ( "x" ) , memberOf , Var . var ( "y" ) } , new NV ( Predicate . Annotations . RELATION_NAME , new String [ ] { relation } ) , new NV ( Annotations . TIMESTAMP , timestamp ) ) ; final IPredicate < ? > pred3 = new Predicate ( new IVariableOrConstant [ ] { Var . var ( "y" ) , subOrganizationOf , University0 } , new NV ( Predicate . Annotations . RELATION_NAME , new String [ ] { relation } ) , new NV ( Annotations . TIMESTAMP , timestamp ) ) ; final IPredicate < ? > pred4 = new Predicate ( new IVariableOrConstant [ ] { Var . var ( "x" ) , emailAddress , Var . var ( "z" ) } , new NV ( Predicate . Annotations . RELATION_NAME , new String [ ] { relation } ) , new NV ( Annotations . TIMESTAMP , timestamp ) ) ; final IRule rule = new Rule ( getName ( ) , null , new IPredicate [ ] { pred0 , pred1 , pred2 , pred3 , pred4 } , null ) ; final Map < IPredicate , Long > rangeCount = new HashMap < IPredicate , Long > ( ) ; { rangeCount . put ( pred0 , 15L ) ; rangeCount . put ( pred1 , 6463L ) ; rangeCount . put ( pred2 , 8830L ) ; rangeCount . put ( pred3 , 15L ) ; rangeCount . put ( pred4 , 8830L ) ; } final IEvaluationPlan plan = newPlan ( new MockJoinNexus ( new MockRangeCountFactory ( rangeCount ) ) , rule ) ; assertFalse ( plan . isEmpty ( ) ) ; final int [ ] expected = new int [ ] { 0 , 3 , 2 , 1 , 4 } ; final int [ ] actual = plan . getOrder ( ) ; if ( ! Arrays . equals ( expected , actual ) ) fail ( "evaluation order: expected=" + Arrays . toString ( expected ) + ", actual=" + Arrays . toString ( actual ) ) ; }
based on lubm query # 8 with the u1 dataset .
