Skip to content

Commit

Permalink
bug fix: getTPsInPattern in QueryPatternUtils must also consider OpFi…
Browse files Browse the repository at this point in the history
…lter
  • Loading branch information
hartig committed Feb 2, 2025
1 parent 0b149bd commit 2784cb4
Showing 1 changed file with 8 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,20 @@ public static Set<TriplePattern> getTPsInPattern( final Op op ) {
if ( op instanceof OpJoin || op instanceof OpLeftJoin || op instanceof OpUnion ) {
return getTPsInPattern( (Op2) op );
}
if ( op instanceof OpService ){
return getTPsInPattern( ((Op1) op).getSubOp());

if ( op instanceof OpService || op instanceof OpFilter ){
return getTPsInPattern( ((Op1) op).getSubOp() );
}

final Set<TriplePattern> tps = new HashSet<>();
if ( op instanceof OpBGP ) {
final List<Triple> triples = ((OpBGP) op).getPattern().getList();
for ( final Triple t: triples ) {
if ( op instanceof OpBGP opBGP ) {
final Set<TriplePattern> tps = new HashSet<>();
for ( final Triple t : opBGP.getPattern().getList() ) {
tps.add( new TriplePatternImpl(t) );
}
return tps;
}
else {
throw new UnsupportedOperationException("Getting the triple patterns from arbitrary SPARQL patterns is an open TODO (type of Jena Op in the current case: " + op.getClass().getName() + ").");
}

throw new UnsupportedOperationException("Getting the triple patterns from arbitrary SPARQL patterns is an open TODO (type of Jena Op in the current case: " + op.getClass().getName() + ").");
}

public static Set<TriplePattern> getTPsInPattern( final Op2 op ) {
Expand Down

0 comments on commit 2784cb4

Please sign in to comment.