public static void addVarsFromTriplePath(Set<Var> acc, TriplePath tpath) { addVar(acc, tpath.getSubject()) ; addVar(acc, tpath.getObject()) ; }
public static void addVarsFromTriplePath(Collection<Var> acc, TriplePath tpath) { addVar(acc, tpath.getSubject()) ; addVar(acc, tpath.getObject()) ; }
@Override public void visit(OpPath opPath) { addVar(acc, opPath.getTriplePath().getSubject()) ; addVar(acc, opPath.getTriplePath().getObject()) ; }
public PathBlock reduce(TriplePath triplePath) { PathBlock x = new PathBlock() ; reduce(x, varAlloc, triplePath.getSubject(), triplePath.getPath(), triplePath.getObject()) ; return x ; }
public PathBlock reduce(TriplePath triplePath) { PathBlock x = new PathBlock() ; reduce(x, varAlloc, triplePath.getSubject(), triplePath.getPath(), triplePath.getObject()) ; return x ; }
@Override public Op transform(OpPath opPath) { TriplePath tp = opPath.getTriplePath() ; Op op = transformPath(opPath, tp.getSubject(), tp.getPath(), tp.getObject() ) ; // And combine adjacent triple patterns. return op ; }
public static QueryIterator execTriplePath(Binding binding, TriplePath triplePath, ExecutionContext execCxt) { if ( triplePath.isTriple() ) { // Fake it. This happens only for API constructed situations. Path path = new P_Link(triplePath.getPredicate()) ; triplePath = new TriplePath(triplePath.getSubject(), path, triplePath.getObject()) ; } return execTriplePath(binding, triplePath.getSubject(), triplePath.getPath(), triplePath.getObject(), execCxt) ; }
void reduce(PathBlock x, PathBlock pathBlock, VarAlloc varAlloc ) { for ( TriplePath tp : pathBlock ) { if ( tp.isTriple() ) { x.add(tp) ; continue ; } reduce(x, varAlloc, tp.getSubject(), tp.getPath(), tp.getObject()) ; } }
@Override public void visit(OpPath opPath) { addVar(acc, opPath.getTriplePath().getSubject()) ; addVar(acc, opPath.getTriplePath().getObject()) ; }
void reduce(PathBlock x, PathBlock pathBlock, VarAlloc varAlloc ) { for ( TriplePath tp : pathBlock ) { if ( tp.isTriple() ) { x.add(tp) ; continue ; } reduce(x, varAlloc, tp.getSubject(), tp.getPath(), tp.getObject()) ; } }
public static QueryIterator execTriplePath(Binding binding, TriplePath triplePath, ExecutionContext execCxt) { if ( triplePath.isTriple() ) { // Fake it. This happens only for API constructed situations. Path path = new P_Link(triplePath.getPredicate()) ; triplePath = new TriplePath(triplePath.getSubject(), path, triplePath.getObject()) ; } return execTriplePath(binding, triplePath.getSubject(), triplePath.getPath(), triplePath.getObject(), execCxt) ; }
@Override public void visit(OpPath opPath) { addVar(subjAcc, opPath.getTriplePath().getSubject()) ; addVar(objAcc, opPath.getTriplePath().getObject()) ; }
@Override public void visit(OpPath opPath) { process(opPath.getTriplePath().getSubject()); process(opPath.getTriplePath().getObject()); }
protected void addVars(TriplePath t) { addVar(t.getSubject()); if (t.getPredicate()!=null) { addVar(t.getPredicate()); } addVar(t.getObject()); }
public static boolean triplePathIso(TriplePath tp1, TriplePath tp2, NodeIsomorphismMap isoMap) { if ( tp1.isTriple() ^ tp2.isTriple() ) return false ; if ( tp1.isTriple() ) return Utils.tripleIso(tp1.asTriple(), tp2.asTriple(), isoMap) ; else return Utils.nodeIso(tp1.getSubject(), tp2.getSubject(), isoMap) && Utils.nodeIso(tp1.getObject(), tp2.getObject(), isoMap) && tp1.getPath().equalTo(tp2.getPath(), isoMap) ; }
public static boolean triplePathIso(TriplePath tp1, TriplePath tp2, NodeIsomorphismMap isoMap) { if ( tp1.isTriple() ^ tp2.isTriple() ) return false ; if ( tp1.isTriple() ) return Iso.tripleIso(tp1.asTriple(), tp2.asTriple(), isoMap) ; else return Iso.nodeIso(tp1.getSubject(), tp2.getSubject(), isoMap) && Iso.nodeIso(tp1.getObject(), tp2.getObject(), isoMap) && tp1.getPath().equalTo(tp2.getPath(), isoMap) ; }
public static TriplePath substitute(TriplePath triplePath, Binding binding) { if ( triplePath.isTriple() ) return new TriplePath(Substitute.substitute(triplePath.asTriple(), binding)) ; Node s = triplePath.getSubject() ; Node o = triplePath.getObject() ; Node s1 = substitute(s, binding) ; Node o1 = substitute(o, binding) ; TriplePath tp = triplePath ; if ( s1 != s || o1 != o ) tp = new TriplePath(s1, triplePath.getPath(), o1) ; return tp ; }
public static TriplePath substitute(TriplePath triplePath, Binding binding) { if ( triplePath.isTriple() ) return new TriplePath(Substitute.substitute(triplePath.asTriple(), binding)) ; Node s = triplePath.getSubject() ; Node o = triplePath.getObject() ; Node s1 = substitute(s, binding) ; Node o1 = substitute(o, binding) ; TriplePath tp = triplePath ; if ( s1 != s || o1 != o ) tp = new TriplePath(s1, triplePath.getPath(), o1) ; return tp ; }
public TriplePath copySubstitute(TriplePath triple) { Node newSubj = replace(triple.getSubject()); Node newObj = replace(triple.getObject()); Path path = triple.getPath(); TriplePath newTriple; if (path!=null) { newTriple = new TriplePath(newSubj, path, newObj); } else { Node pred = replace(triple.getPredicate()); assert pred!=null : triple; //assert pred.isURI() : "predicate must be an IRI: "+ triple; newTriple = new TriplePath(new Triple(newSubj, pred, newObj)); } return newTriple; } public Triple copySubstitute(Triple triple) {
public Element transform(TriplePath tp,boolean bestEffort, NewVariableGenerator vargen, boolean[] resultHasPropertyPaths) { Triple t = tp.asTriple(); if (t!=null) { // this is a simple triple ElementTriplesBlock ret =new ElementTriplesBlock(); ret.addTriple(t); return ret; } assert !tp.isTriple(); assert tp.getPredicate()==null: tp; JenaPathRewrite pr = new JenaPathRewrite(tp.getSubject(), tp.getObject(), bestEffort, vargen); tp.getPath().visit(pr); if (resultHasPropertyPaths!=null) { resultHasPropertyPaths[0] = pr.resultWithPropertyPaths(); } return pr.getResult(); }