private String getTableDefinition ( Function atom , AliasIndex index , String indent ) { if ( atom . isAlgebraFunction ( ) ) { Predicate functionSymbol = atom . getFunctionSymbol ( ) ; ImmutableList < Function > joinAtoms = convert ( atom . getTerms ( ) ) ; if ( functionSymbol . equals ( datalogFactory . getSparqlJoinPredicate ( ) ) ) { // nested joins we need to add parenthesis later boolean parenthesis = joinAtoms . get ( 0 ) . isAlgebraFunction ( ) || joinAtoms . get ( 1 ) . isAlgebraFunction ( ) ; return getTableDefinitions ( joinAtoms , index , "JOIN" , parenthesis , indent + INDENT ) ; } else if ( functionSymbol . equals ( datalogFactory . getSparqlLeftJoinPredicate ( ) ) ) { // in case of left join we want to add the parenthesis only for the right tables // we ignore nested joins from the left tables boolean parenthesis = joinAtoms . get ( 1 ) . isAlgebraFunction ( ) ; return getTableDefinitions ( joinAtoms , index , "LEFT OUTER JOIN" , parenthesis , indent + INDENT ) ; } } else if ( ! atom . isOperation ( ) && ! atom . isDataTypeFunction ( ) ) { return index . getViewDefinition ( atom ) ; // a database atom } return null ; }
Returns the table definition for the given atom . If the atom is a simple table or view then it returns the value as defined by the AliasIndex . If the atom is a Join or Left Join it will call getTableDefinitions on the nested term list .