function createQueryFieldLeafStatement()

in templates/JSResolverOCHTTPS.js [602:626]


function createQueryFieldLeafStatement(fieldSchemaInfo, lastNamePath) {      
    
    let i = withStatements.findIndex(({carryOver}) => carryOver.startsWith(lastNamePath));
    
    if (withStatements[i].content.slice(-2) != ', ' && withStatements[i].content.slice(-1) != '{' && withStatements[i].content != '' )
        withStatements[i].content += ', ';
    
    withStatements[i].content += fieldSchemaInfo.name + ':';

    if (fieldSchemaInfo.graphDBIdArgName === fieldSchemaInfo.name && fieldSchemaInfo.graphQuery == null) {          
        withStatements[i].content += 'ID(' + lastNamePath + ')';
    } else {
    
        if (fieldSchemaInfo.graphQuery !=null ) {
            if (useCallSubquery) {
                matchStatements.push(` CALL { WITH ${lastNamePath} ${fieldSchemaInfo.graphQuery.replaceAll('this', lastNamePath)} AS ${lastNamePath + '_' + fieldSchemaInfo.name} }`);                  
                withStatements[i].content += ' ' + lastNamePath + '_' + fieldSchemaInfo.name;
            } else {
                createQueryFieldMatchStatement(fieldSchemaInfo, lastNamePath);
            }
        } else {              
            withStatements[i].content += ' ' + lastNamePath + '.' + `\`${fieldSchemaInfo.alias}\``;
        }
    }        
}