Class ParticipantAgqlToSql


  • public class ParticipantAgqlToSql
    extends Object
    Converts AGQL expressions into SQL queries for matching participants.
    Author:
    Robert Fromont robert@fromont.net.nz
    • Constructor Detail

      • ParticipantAgqlToSql

        public ParticipantAgqlToSql()
        Default constructor.
      • ParticipantAgqlToSql

        public ParticipantAgqlToSql​(nzilbb.ag.Schema schema)
        Attribute constructor.
    • Method Detail

      • getSchema

        public nzilbb.ag.Schema getSchema()
        Getter for schema.
        Returns:
        Layer schema.
      • setSchema

        public ParticipantAgqlToSql setSchema​(nzilbb.ag.Schema schema)
        Setter for schema.
        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 > 2
        • all('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.