protected void addVars(TriplePath t) { addVar(t.getSubject()); if (t.getPredicate()!=null) { addVar(t.getPredicate()); } addVar(t.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) ; }
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) ; }
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) {
@Override public Op transform(OpPath opPath) { TriplePath tp = opPath.getTriplePath() ; Node s = tp.getSubject() ; Node s1 = transform.convert(s) ; Node o = tp.getObject() ; Node o1 = transform.convert(o) ; if ( s1 == s || o1 == o ) // No change. return opPath ; Path path = tp.getPath() ; TriplePath tp2 ; if ( path != null ) tp2 = new TriplePath(s1, path, o1) ; else { Triple t = new Triple(s1, tp.getPredicate(), o1) ; tp2 = new TriplePath(t) ; } return new OpPath(tp2) ; }
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(); }
@Override public Op transform(OpPath opPath) { TriplePath tp = opPath.getTriplePath() ; Node s = tp.getSubject() ; Node s1 = transform.convert(s) ; Node o = tp.getObject() ; Node o1 = transform.convert(o) ; if ( s1 == s && o1 == o ) // No change. return super.transform(opPath) ; Path path = tp.getPath() ; TriplePath tp2 ; if ( path != null ) tp2 = new TriplePath(s1, path, o1) ; else { Triple t = new Triple(s1, tp.getPredicate(), o1) ; tp2 = new TriplePath(t) ; } return new OpPath(tp2) ; }
printProperty(tp.getPredicate()) ; out.print(" ") ; printObject(tp.getObject()) ;
printProperty(tp.getPredicate()) ; out.print(" ") ; printObject(tp.getObject()) ;