Package nzilbb.labbcat.server.db
Class AnnotationAgqlToSql
- java.lang.Object
-
- nzilbb.labbcat.server.db.AnnotationAgqlToSql
-
public class AnnotationAgqlToSql extends Object
Converts AGQL expressions into SQL queries for matching graphs (transcripts).- Author:
- Robert Fromont robert@fromont.net.nz
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAnnotationAgqlToSql.QueryEncapsulates the results ofsqlFor(String,String,String,String)including the SQL.
-
Constructor Summary
Constructors Constructor Description AnnotationAgqlToSql()Default constructor.AnnotationAgqlToSql(nzilbb.ag.Schema schema)Attribute constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description nzilbb.ag.SchemagetSchema()Getter forschema.AnnotationAgqlToSqlsetSchema(nzilbb.ag.Schema schema)Setter forschema.AnnotationAgqlToSql.QuerysqlFor(String expression, String sqlSelectClause, String userWhereClause, String sqlLimitClause)Transforms the given AGQL query into an SQL query.
-
-
-
Method Detail
-
getSchema
public nzilbb.ag.Schema getSchema()
Getter forschema.- Returns:
- Layer schema.
-
setSchema
public AnnotationAgqlToSql setSchema(nzilbb.ag.Schema schema)
Setter forschema.- Parameters:
schema- Layer schema.- Returns:
- this.
-
sqlFor
public AnnotationAgqlToSql.Query sqlFor(String expression, String sqlSelectClause, String userWhereClause, String sqlLimitClause) throws nzilbb.ag.ql.AGQLException
Transforms the given AGQL query into an SQL query.- Parameters:
expression- The graph-matching expression, for example:id == 'ew_0_456'layer.id == 'orthography' && /th[aeiou].+/.test(label)layer.id == 'orthography' && first('participant').label == 'Robert' && first('utterances').start.offset == 12.345graph.id == 'AdaAicheson-01.trs' && layer.id == 'orthography' && start.offset > 10.5layer.id == 'utterances' && all('transcript').includes('ew_0_456')previous.id == 'ew_0_456'
id = 'ew_0_456'layer.id = 'orthography' AND label NOT MATCHES 'th[aeiou].*'layer.id = 'orthography' AND first('participant').label = 'Robert' AND first('utterances').start.offset = 12.345graph.id = 'AdaAicheson-01.trs' AND layer.id = 'orthography' AND start.offset > 10.5layer.id = 'utterances' AND 'ew_0_456' IN all('transcript')previous.id = 'ew_0_456'
sqlSelectClause- The SQL expression that is to go between SELECT and FROM.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.sqlLimitClause- The SQL LIMIT clause to append, or null for no LIMIT clause.- Throws:
nzilbb.ag.ql.AGQLException- If the expression is invalid.
-
-