@Override protected INConstraint newINConstraint ( IVariable<?> var, IConstant<?> vals [] ) { return new INBinarySearch ( var, vals ) ; } }
@Override protected INConstraint newINConstraint ( IVariable<?> var, IConstant<?> vals [] ) { return new INBinarySearch ( var, vals ) ; } }
/** * Unit test for {@link INConstraint#accept(IBindingSet)} */ public void testAccept () { super.testAccept () ; // specific test because the implementation does a sort, etc... Var<?> x = Var.var ( "x" ) ; IConstant [] vals = new IConstant [ 100 ] ; for ( int i = 0; i < vals.length; i++ ) vals [ i ] = new Constant<Integer> ( i ) ; List<IConstant> list = Arrays.asList ( vals ) ; Collections.shuffle ( list ) ; vals = list.toArray ( vals ) ; INConstraint op = new INBinarySearch ( x, vals ) ; assertTrue ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 21 ) } ) ) ) ; assertTrue ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 37 ) } ) ) ) ; assertTrue ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 75 ) } ) ) ) ; assertFalse ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 101 ) } ) ) ) ; }
/** * Unit test for {@link INConstraint#accept(IBindingSet)} */ public void testAccept () { super.testAccept () ; // specific test because the implementation does a sort, etc... Var<?> x = Var.var ( "x" ) ; IConstant [] vals = new IConstant [ 100 ] ; for ( int i = 0; i < vals.length; i++ ) vals [ i ] = new Constant<Integer> ( i ) ; List<IConstant> list = Arrays.asList ( vals ) ; Collections.shuffle ( list ) ; vals = list.toArray ( vals ) ; INConstraint op = new INBinarySearch ( x, vals ) ; assertTrue ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 21 ) } ) ) ) ; assertTrue ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 37 ) } ) ) ) ; assertTrue ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 75 ) } ) ) ) ; assertFalse ( op.get ( new ListBindingSet ( new IVariable<?> [] { x }, new IConstant [] { new Constant<Integer> ( 101 ) } ) ) ) ; }
new NV(PipelineJoin.Annotations.PREDICATE, predOp),// new NV(PipelineJoin.Annotations.CONSTRAINTS, new IConstraint[] { Constraint.wrap(new INBinarySearch<String>(y, set)) }));
new NV(PipelineJoin.Annotations.PREDICATE, predOp),// new NV(PipelineJoin.Annotations.CONSTRAINTS, new IConstraint[] { Constraint.wrap(new INBinarySearch<String>(y, set)) }));
public MatchRule(String relationName, Vocabulary vocab, IVariable<IV> lit, IConstant<IV>[] preds, IConstant<IV> cls) { super( "matchRule", // new SPOPredicate(relationName, var("s"), var("t"), lit), // new SPOPredicate[] { // new SPOPredicate(relationName, var("s"), var("p"), lit), // new SPOPredicate( new BOp[] { var("s"), // vocab.getConstant(RDF.TYPE),// var("t") }, // new NV(IPredicate.Annotations.RELATION_NAME, new String[] { relationName }), new NV( IPredicate.Annotations.INDEX_LOCAL_FILTER, ElementFilter .newInstance(ExplicitSPOFilter.INSTANCE))), // new SPOPredicate(relationName, var("t"), vocab .getConstant(RDFS.SUBCLASSOF), cls) // }, new IConstraint[] { Constraint.wrap(new INBinarySearch(var("p"), preds)) // p IN preds }); }
public MatchRule(String relationName, Vocabulary vocab, IVariable<IV> lit, IConstant<IV>[] preds, IConstant<IV> cls) { super( "matchRule", // new SPOPredicate(relationName, var("s"), var("t"), lit), // new SPOPredicate[] { // new SPOPredicate(relationName, var("s"), var("p"), lit), // new SPOPredicate( new BOp[] { var("s"), // vocab.getConstant(RDF.TYPE),// var("t") }, // new NV(IPredicate.Annotations.RELATION_NAME, new String[] { relationName }), new NV( IPredicate.Annotations.INDEX_LOCAL_FILTER, ElementFilter .newInstance(ExplicitSPOFilter.INSTANCE))), // new SPOPredicate(relationName, var("t"), vocab .getConstant(RDFS.SUBCLASSOF), cls) // }, new IConstraint[] { Constraint.wrap(new INBinarySearch(var("p"), preds)) // p IN preds }); }