Package nzilbb.labbcat.server.db
Class ParticipantAgqlToSql
- java.lang.Object
-
- nzilbb.labbcat.server.db.ParticipantAgqlToSql
-
public class ParticipantAgqlToSql extends Object
Converts AGQL expressions into SQL queries for matching participants.- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classParticipantAgqlToSql.QueryEncapsulates the results ofsqlFor(String,String,String,boolean,String)including the SQL.
-
Constructor Summary
Constructors Constructor Description ParticipantAgqlToSql()Default constructor.ParticipantAgqlToSql(nzilbb.ag.Schema schema)Attribute constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description nzilbb.ag.SchemagetSchema()Getter forschema.ParticipantAgqlToSqlsetSchema(nzilbb.ag.Schema schema)Setter forschema.ParticipantAgqlToSql.QuerysqlFor(String expression, String sqlSelectClause, String userWhereClause, boolean publicAttributesOnly, String sqlOrderClause)Transforms the given AGQL query into an SQL query.
-
-
-
Method Detail
-
getSchema
public nzilbb.ag.Schema getSchema()
Getter forschema.- Returns:
- Layer schema.
-
setSchema
public ParticipantAgqlToSql setSchema(nzilbb.ag.Schema schema)
Setter forschema.- Parameters:
schema- Layer schema.- Returns:
- this.
-
sqlFor
public ParticipantAgqlToSql.Query sqlFor(String expression, String sqlSelectClause, String userWhereClause, boolean publicAttributesOnly, String sqlOrderClause) throws nzilbb.ag.ql.AGQLException
Transforms the given AGQL query into an SQL query.- Parameters:
expression- The graph-matching expression, for example:id MATCHES 'Ada.+''CC' IN labels('corpus')'en' IN labels('participant_languages')'en' IN labels('transcript_language')id NOT MATCHES 'Ada.+' AND first('corpus').label = 'CC'all('transcript_rating').length > 2all('participant_rating').length = 0'labbcat' NOT IN annotators('transcript_rating')first('participant_gender').label = 'NA'
sqlSelectClause- The SQL expression that is to go between SELECT and FROM, e.g. "speaker.name, speaker.speaker_number".userWhereClause- The expression to add to the WHERE clause to ensure the user doesn't get access to data to which they're not entitled, or null.publicAttributesOnly- Whether to restrict participant attribute values to only attributes marked as 'public'.sqlOrderClause- The SQL expression that appended to the end of the SQL query, e.g. "ORDER BY speaker.name LIMIT 150, 200, or null"- Throws:
nzilbb.ag.ql.AGQLException- If the expression is invalid.
-
-