Skip to content

Commit 2784cb4

Browse files
committed
bug fix: getTPsInPattern in QueryPatternUtils must also consider OpFilter
1 parent 0b149bd commit 2784cb4

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

hefquin-base/src/main/java/se/liu/ida/hefquin/base/query/impl/QueryPatternUtils.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,21 +220,20 @@ public static Set<TriplePattern> getTPsInPattern( final Op op ) {
220220
if ( op instanceof OpJoin || op instanceof OpLeftJoin || op instanceof OpUnion ) {
221221
return getTPsInPattern( (Op2) op );
222222
}
223-
if ( op instanceof OpService ){
224-
return getTPsInPattern( ((Op1) op).getSubOp());
223+
224+
if ( op instanceof OpService || op instanceof OpFilter ){
225+
return getTPsInPattern( ((Op1) op).getSubOp() );
225226
}
226227

227-
final Set<TriplePattern> tps = new HashSet<>();
228-
if ( op instanceof OpBGP ) {
229-
final List<Triple> triples = ((OpBGP) op).getPattern().getList();
230-
for ( final Triple t: triples ) {
228+
if ( op instanceof OpBGP opBGP ) {
229+
final Set<TriplePattern> tps = new HashSet<>();
230+
for ( final Triple t : opBGP.getPattern().getList() ) {
231231
tps.add( new TriplePatternImpl(t) );
232232
}
233233
return tps;
234234
}
235-
else {
236-
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() + ").");
237-
}
235+
236+
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() + ").");
238237
}
239238

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

0 commit comments

Comments
 (0)