Interface NCSqlExtractor
-
public interface NCSqlExtractor
Utility methods for extracting various SQL components fromNCToken
tokens. Instances of this interface are created usingNCSqlExtractorBuilder
builder.Note that
NCSqlExtractorBuilder
builder requiresNCSqlSchema
andNCVariant
objects when creating an instance of SQL extractor. Methods in this interface will search the parsing variant and schema to find necessary referenced tokens.Note also that wherever necessary the implementation will scan part (constituent) tokens as well (see
NCToken.findPartTokens(String...)
for more information).- See Also:
NCSqlExtractorBuilder
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description NCSqlColumn
extractColumn(NCToken colTok)
Extract column object from the token.NCSqlDateRange
extractDateRange(NCToken dateTok)
Extract date range object from givennlpcraft:date
token.NCSqlLimit
extractLimit(NCToken limitTok)
Extracts limit object from givennlpcraft:limit
token.List<NCSqlSort>
extractSort(NCToken sortTok)
Extracts sort object from givennlpcraft:sort
token.NCSqlTable
extractTable(NCToken tblTok)
Extract table object from the token.
-
-
-
Method Detail
-
extractLimit
NCSqlLimit extractLimit(NCToken limitTok)
Extracts limit object from givennlpcraft:limit
token.- Parameters:
limitTok
- Limit token with IDnlpcraft:limit
.- Returns:
- SQL limit object extracted from given token.
- Throws:
org.apache.nlpcraft.common.NCException
- Thrown in case of any errors.
-
extractSort
List<NCSqlSort> extractSort(NCToken sortTok)
Extracts sort object from givennlpcraft:sort
token.- Parameters:
sortTok
- Sort token with IDnlpcraft:sort
.- Returns:
- SQL sort object extracted from given token.
- Throws:
org.apache.nlpcraft.common.NCException
- Thrown in case of any errors.
-
extractTable
NCSqlTable extractTable(NCToken tblTok)
Extract table object from the token.- Parameters:
tblTok
- A token that belongs to atable
group.- Returns:
- SQL table object extracted from the given token.
- Throws:
org.apache.nlpcraft.common.NCException
- Thrown in case of any errors.
-
extractColumn
NCSqlColumn extractColumn(NCToken colTok)
Extract column object from the token.- Parameters:
colTok
- A token that belongs to acolumn
group.- Returns:
- SQL column object extracted from the given token.
- Throws:
org.apache.nlpcraft.common.NCException
- Thrown in case of any errors.
-
extractDateRange
NCSqlDateRange extractDateRange(NCToken dateTok)
Extract date range object from givennlpcraft:date
token.- Parameters:
dateTok
- Date token with IDnlpcraft:date
.- Returns:
- A data range object extracted from given token.
- Throws:
org.apache.nlpcraft.common.NCException
- Thrown in case of any errors.
-
-