public static Path pathFixedLength(Path path, long count) { return new P_FixedLength(path, count) ; } public static Path pathDistinct(Path path) { return new P_Distinct(path) ; }
@Override public Path transform(P_FixedLength path, Path subPath, long count) { Path result = path.getSubPath() == subPath && path.getCount() == count ? path : new P_FixedLength(subPath, count) ; return result; }
@Override protected void doFixedLengthPath(Path pathStep, Node node, long fixedLength, Collection<Node> output) { // Not SPARQL if ( fixedLength == 0 ) { output.add(node) ; return ; } // P_Mod(path, count, count) // One step. Iterator<Node> iter = eval(pathStep, node) ; // Build a path for all remaining steps. long count2 = dec(fixedLength) ; P_FixedLength nextPath = new P_FixedLength(pathStep, count2) ; // For each element in the first step, do remaining step // Accumulate across everything from first step. for (; iter.hasNext();) { Node n2 = iter.next() ; Iterator<Node> iter2 = eval(nextPath, n2) ; fill(iter2, output) ; } }
@Override protected void doFixedLengthPath(Path pathStep, Node node, long fixedLength, Collection<Node> output) { if ( fixedLength == 0 ) { output.add(node) ; return ; } // P_Mod(path, count, count) // One step. Iterator<Node> iter = eval(pathStep, node) ; // Build a path for all remaining steps. long count2 = dec(fixedLength) ; P_FixedLength nextPath = new P_FixedLength(pathStep, count2) ; // For each element in the first step, do remaining step // Accumulate across everything from first step. for (; iter.hasNext();) { Node n2 = iter.next() ; Iterator<Node> iter2 = eval(nextPath, n2) ; fill(iter2, output) ; } }
@Override public Path transform(P_FixedLength path, Path subPath, long count) { Path result = new P_FixedLength(new P_Inverse(subPath), path.getCount()); return result; }
@Override public Path make(ItemList list) { BuilderLib.checkLength(3, 3, list, "path fixed repeat: wanted 2 arguments") ; long count = modInt(list.get(1)) ; Path path = build(list, 2) ; return new P_FixedLength(path, count) ; } } ;
@Override public void visit(P_FixedLength path) { result = new P_FixedLength(new P_Inverse(path.getSubPath()), path.getCount()); }
@Override public void visit(P_FixedLength path) { Path newSubPath = apply(path.getSubPath()); result = path.getSubPath() == newSubPath ? path : new P_FixedLength(newSubPath, path.getCount()) ; }
@Override public void visit(P_FixedLength pFixedLength) { pFixedLength.getSubPath().visit(this); push(new P_FixedLength(pop(), pFixedLength.getCount())); }
@Override public void visit(P_FixedLength pFixedLength) { pFixedLength.getSubPath().visit(this); push(new P_FixedLength(pop(), pFixedLength.getCount())); }