public interface PrologQueryBuilder
PrologEngine.newQueryBuilder()
. The query
builder emulate the query creation process. After define all participant
terms with the begin(PrologTerm)
method, we specify the first term
in the query. If the query have more terms, they are created using
comma(PrologTerm)
for every one. Clause builder have a
getQueryString()
for string representation of the clause in
progress. After clause definition this builder have query()
method
that create the final query instance ready to be used.
PrologVariable x = provider.newVariable("X", 0); PrologStructure big = provider.newStructure("big", x); PrologStructure dark = provider.newStructure("dark", x); PrologQueryBuilder builder = engine.newQueryBuilder(); PrologQuery query = builder.begin(dark).comma(big).query();Prolog result
?- big(X), dark(X).
Modifier and Type | Method and Description |
---|---|
PrologQueryBuilder |
begin(PrologTerm term)
Append to the query builder the first term to be query.
|
PrologQueryBuilder |
begin(String functor,
PrologTerm... arguments)
Append to the query builder the first term to be query.
|
PrologQueryBuilder |
comma(PrologTerm term)
Append to the query builder other term to be query in conjunctive mode.
|
PrologQueryBuilder |
comma(PrologTerm left,
String operator,
PrologTerm right)
Append to the query builder other term to be query in conjunctive mode.
|
PrologQueryBuilder |
comma(String functor,
PrologTerm... arguments)
Append to the query builder other term to be query in conjunctive mode.
|
PrologEngine |
getEngine()
Engine hold by the current builder
|
String |
getQueryString()
Get the query in string format.
|
PrologQuery |
query()
Create and return the result query.
|
PrologQueryBuilder |
semicolon(PrologTerm term)
Append to the query builder other term to be query in disjunctive mode.
|
PrologQueryBuilder |
semicolon(PrologTerm left,
String operator,
PrologTerm right)
Append to the query builder other term to be query in disjunctive mode.
|
PrologQueryBuilder |
semicolon(String functor,
PrologTerm... arguments)
Append to the query builder other term to be query in disjunctive mode.
|
PrologQueryBuilder begin(PrologTerm term)
term
- term to be query.PrologQueryBuilder begin(String functor, PrologTerm... arguments)
functor
- string name for the structure term to be query.arguments
- prolog term arguments for the structure term to be query.PrologQueryBuilder semicolon(PrologTerm left, String operator, PrologTerm right)
operator
- expression operator.left
- left hand prolog term operand.right
- right hand prolog term operand.PrologQueryBuilder semicolon(String functor, PrologTerm... arguments)
functor
- string name for the structure term to be query.arguments
- prolog term arguments for the structure term to be query.PrologQueryBuilder semicolon(PrologTerm term)
term
- term to be query.PrologQueryBuilder comma(PrologTerm left, String operator, PrologTerm right)
operator
- expression operator.left
- left hand prolog term operand.right
- right hand prolog term operand.PrologQueryBuilder comma(String functor, PrologTerm... arguments)
functor
- string name for the structure term to be query.arguments
- prolog term arguments for the structure term to be query.PrologQueryBuilder comma(PrologTerm term)
term
- term to be query.String getQueryString()
PrologQuery query()
PrologEngine getEngine()
Copyright © 2020–2024 Prolobjectlink Project. All rights reserved.