Skip to content

Commit 64d82b3

Browse files
author
anquetil
committed
Define a new method containsWithClause() in CoreseSparqlQuery for SparqlHttpClient
1 parent 4ba1482 commit 64d82b3

1 file changed

Lines changed: 22 additions & 3 deletions

File tree

src/main/java/fr/inria/corese/command/utils/coreseCoreWrapper/CoreseSparqlQuery.java

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import fr.inria.corese.core.query.QueryProcess;
66
import fr.inria.corese.core.sparql.exceptions.EngineException;
77
import fr.inria.corese.core.sparql.triple.update.ASTUpdate;
8+
import fr.inria.corese.core.sparql.triple.update.Composite;
9+
import fr.inria.corese.core.sparql.triple.update.Update;
810

911
/**
1012
* Wrapper class for corese core KGRAM query
@@ -78,8 +80,25 @@ public boolean isSPARQLUpdate() {
7880
return query.getAST().isSPARQLUpdate();
7981
}
8082

81-
public ASTUpdate getAstUpdate() {
82-
return query.getAST().getUpdate();
83+
/**
84+
* Checks if the query contains WITH clause.
85+
*
86+
* @return true if the query contains WITH clause, false otherwise
87+
*/
88+
public boolean containsWithClause() {
89+
ASTUpdate astUpdate = query.getAST().getUpdate();
90+
if (astUpdate != null) {
91+
for (Update update : astUpdate.getUpdates()) {
92+
Composite composite = update.getComposite();
93+
if (composite != null) {
94+
if (composite.getWith() != null) {
95+
return true;
96+
}
97+
}
98+
}
99+
}
100+
101+
return false;
83102
}
84103

85-
}
104+
}

0 commit comments

Comments
 (0)