Class MySQLDBFunctionSymbolFactory
- java.lang.Object
-
- it.unibz.inf.ontop.model.term.functionsymbol.db.impl.AbstractDBFunctionSymbolFactory
-
- it.unibz.inf.ontop.model.term.functionsymbol.db.impl.AbstractSQLDBFunctionSymbolFactory
-
- it.unibz.inf.ontop.model.term.functionsymbol.db.impl.MySQLDBFunctionSymbolFactory
-
- All Implemented Interfaces:
DBFunctionSymbolFactory
public class MySQLDBFunctionSymbolFactory extends AbstractSQLDBFunctionSymbolFactory
-
-
Field Summary
Fields Modifier and Type Field Description protected static StringCURRENT_TZ_STRprotected static StringUUID_STR-
Fields inherited from class it.unibz.inf.ontop.model.term.functionsymbol.db.impl.AbstractSQLDBFunctionSymbolFactory
ABS_STR, abstractRootDBType, abstractRootType, ADD_STR, AND_STR, CEIL_STR, CHAR_LENGTH_STR, COALESCE_STR, CONCAT_OP_STR, CONCAT_STR, CURRENT_TIMESTAMP_STR, dbBooleanType, dbDecimalType, dbDoubleType, dbIntegerType, dbStringType, dbTypeFactory, DIVIDE_STR, FLOOR_STR, LCASE_STR, LENGTH_STR, LOWER_STR, MULTIPLY_STR, NOT_STR, NULLIF_STR, OR_STR, RAND_STR, REGEXP_REPLACE_STR, REPLACE_STR, RIGHT_STR, ROUND_STR, ST_ASTEXT, ST_CONTAINS, ST_CONTAINSPROPERLY, ST_COVEREDBY, ST_COVERS, ST_CROSSES, ST_DISJOINT, ST_DISTANCE, ST_DISTANCE_SPHERE, ST_DISTANCE_SPHEROID, ST_EQUALS, ST_FLIP_COORDINATES, ST_GEOMFROMTEXT, ST_INTERSECTS, ST_MAKEPOINT, ST_OVERLAPS, ST_SETSRID, ST_TOUCHES, ST_TRANSFORM, ST_WITHIN, SUBSTR_STR, SUBSTRING_STR, SUBTRACT_STR, typeFactory, UCASE_STR, UPPER_STR
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMySQLDBFunctionSymbolFactory(TypeFactory typeFactory)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected DBTypeConversionFunctionSymbolcreateDateTimeDenormFunctionSymbol(DBTermType timestampType)TODO: provide a MySQL specific implementationprotected DBTypeConversionFunctionSymbolcreateDateTimeNormFunctionSymbol(DBTermType dbDateTimestampType)protected DBTypeConversionFunctionSymbolcreateDatetimeToDatetimeCastFunctionSymbol(DBTermType inputType, DBTermType targetType)Made Implicitprotected DBConcatFunctionSymbolcreateDBConcatOperator(int arity)protected DBFunctionSymbolcreateDBGroupConcat(DBTermType dbStringType, boolean isDistinct)protected DBFunctionSymbolcreateEncodeURLorIRI(boolean preserveInternationalChars)protected static it.unibz.inf.ontop.com.google.common.collect.ImmutableTable<String,Integer,DBFunctionSymbol>createMySQLRegularFunctionTable(TypeFactory typeFactory)protected it.unibz.inf.ontop.com.google.common.collect.ImmutableTable<DBTermType,RDFDatatype,DBTypeConversionFunctionSymbol>createNormalizationTable()We know that the normalization function DATETIME -> xsd:datetimeStamp will always be invalid (it is not bound to any timezone).protected DBConcatFunctionSymbolcreateNullRejectingDBConcat(int arity)MySQL only supports n-ary CONCAT but not operators like || and +protected DBConcatFunctionSymbolcreateRegularDBConcat(int arity)CONCAT regular function symbol, not an operator (like || or +)DBBooleanFunctionSymbolgetDBRegexpMatches2()NB: For MySQL >= 8, REGEXP_LIKE could be usedDBBooleanFunctionSymbolgetDBRegexpMatches3()protected StringgetUUIDNameInDialect()protected StringserializeContains(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeDateTimeNorm(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeDateTimeNorm(DBTermType dbDateTimestampType, it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter)For DATETIME, never provides a time zone.protected StringserializeDBRegexpMatches3(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)TODO: throw an exception when the version is detected to be < 8 and reaching the "default" case?protected StringserializeDBRowNumber(Function<ImmutableTerm,String> converter, TermFactory termFactory)Only for >= 8.0.2 TODO: provide an alternative implementation for the row unique str for previous versionsprotected StringserializeMD5(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeMillisBetween(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeSHA1(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeSHA256(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeSHA512(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeStrAfter(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeStrBefore(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)protected StringserializeTz(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)Tricky as this information may be lost while converting SPARQL constants into DB ones-
Methods inherited from class it.unibz.inf.ontop.model.term.functionsymbol.db.impl.AbstractSQLDBFunctionSymbolFactory
createAbsFunctionSymbol, createAddOperator, createBooleanCoalesceFunctionSymbol, createBooleanDenormFunctionSymbol, createBooleanInequality, createBooleanNormFunctionSymbol, createCeilFunctionSymbol, createCoalesceFunctionSymbol, createDateInequality, createDatetimeInequality, createDBAnd, createDBAvg, createDBBooleanCase, createDBCase, createDBCount, createDBIfThenElse, createDBIsNotNull, createDBIsNull, createDBIsTrue, createDBMax, createDBMin, createDBNotFunctionSymbol, createDBOr, createDBStrictEquality, createDBStrictNEquality, createDBSum, createDecimalToDecimalCastFunctionSymbol, createDecimalToStringCastFunctionSymbol, createDefaultCastToStringFunctionSymbol, createDefaultInequality, createDefaultRegularFunctionTable, createDivideOperator, createFloatDoubleToFloatDoubleCastFunctionSymbol, createFloatDoubleToStringCastFunctionSymbol, createFloorFunctionSymbol, createGeometryNormFunctionSymbol, createIntegerToIntegerCastFunctionSymbol, createIntegerToStringCastFunctionSymbol, createIsStringEmpty, createMultiplyOperator, createNonStrictDateEquality, createNonStrictDatetimeEquality, createNonStrictDefaultEquality, createNonStrictNumericEquality, createNonStrictStringEquality, createNumericInequality, createRegularBooleanFunctionSymbol, createRegularUntypedFunctionSymbol, createRoundFunctionSymbol, createSimpleCastFunctionSymbol, createSimpleCastFunctionSymbol, createStringInequality, createStringToStringCastFunctionSymbol, createSubtractOperator, createUntypedAddOperator, createUntypedDivideOperator, createUntypedMultiplyOperator, createUntypedSubtractOperator, getDBAnd, getDBAsText, getDBBoundary, getDBBuffer, getDBCharLength, getDBConcatOperator, getDBConvexHull, getDBDifference, getDBEnvelope, getDBGetSRID, getDBIfThenElse, getDBIntersection, getDBIsNotNull, getDBIsNull, getDBIsStringEmpty, getDBLower, getDBNow, getDBNullIf, getDBOr, getDBRand, getDBRegexpReplace3, getDBRegexpReplace4, getDBRelate, getDBRelateMatrix, getDBReplace, getDBRight, getDBSTContains, getDBSTContainsProperly, getDBSTCoveredBy, getDBSTCovers, getDBSTCrosses, getDBSTDisjoint, getDBSTDistance, getDBSTDistanceSphere, getDBSTDistanceSpheroid, getDBSTEquals, getDBSTFlipCoordinates, getDBSTGeomFromText, getDBSTIntersects, getDBSTMakePoint, getDBSTOverlaps, getDBSTSetSRID, getDBSTTouches, getDBSTTransform, getDBSTWithin, getDBSubString2, getDBSubString3, getDBSymDifference, getDBUnion, getDBUpper, getDBUUID, getIsTrue, getNullRejectingDBConcat, getRandNameInDialect, init, isAnd, isCoalesce, isConcat, isOr, serializeDay, serializeDayFromDate, serializeDayFromDatetime, serializeDaysBetween, serializeDaysBetweenFromDate, serializeDaysBetweenFromDateTime, serializeHours, serializeHoursBetween, serializeMinutes, serializeMinutesBetween, serializeMonth, serializeMonthFromDate, serializeMonthFromDatetime, serializeSeconds, serializeSecondsBetween, serializeWeeksBetween, serializeWeeksBetweenFromDate, serializeWeeksBetweenFromDateTime, serializeYear, serializeYearFromDate, serializeYearFromDatetime
-
Methods inherited from class it.unibz.inf.ontop.model.term.functionsymbol.db.impl.AbstractDBFunctionSymbolFactory
canonicalizeRegularFunctionSymbolName, createContainsFunctionSymbol, createCurrentDateTimeFunctionSymbol, createDayFromDateFunctionSymbol, createDayFromDatetimeFunctionSymbol, createDaysBetweenFromDateFunctionSymbol, createDaysBetweenFromDateTimeFunctionSymbol, createDBBinaryMathOperator, createDBBooleanIfElseNull, createDBCountTable, createDBIriStringResolver, createDBRowNumber, createDBRowUniqueStr, createDenormalizationTable, createExtractFunctionSymbol, createFalseOrNullFunctionSymbol, createHoursBetweenFromDateTimeFunctionSymbol, createHoursFunctionSymbol, createLikeFunctionSymbol, createMD5FunctionSymbol, createMillisBetweenFromDateTimeFunctionSymbol, createMinutesBetweenFromDateTimeFunctionSymbol, createMinutesFunctionSymbol, createMonthFromDateFunctionSymbol, createMonthFromDatetimeFunctionSymbol, createRegularIfElseNull, createSecondsBetweenFromDateTimeFunctionSymbol, createSecondsFunctionSymbol, createSHA1FunctionSymbol, createSHA256FunctionSymbol, createSHA512FunctionSymbol, createSimilarToFunctionSymbol, createStrAfterFunctionSymbol, createStrBeforeFunctionSymbol, createStrEndsFunctionSymbol, createStrStartsFunctionSymbol, createTrueOrNullFunctionSymbol, createTypeNullFunctionSymbol, createTzFunctionSymbol, createUntypedDBBinaryMathOperator, createWeeksBetweenFromDateFunctionSymbol, createWeeksBetweenFromDateTimeFunctionSymbol, createYearFromDateFunctionSymbol, createYearFromDatetimeFunctionSymbol, getAbs, getBnodeStringTemplateFunctionSymbol, getCeil, getConversion2RDFLexicalFunctionSymbol, getConversionFromRDFLexical2DBFunctionSymbol, getCurrentDateTimeSymbol, getDBBooleanCase, getDBBooleanCoalesce, getDBBooleanIfElseNull, getDBBooleanInequality, getDBCase, getDBCastFunctionSymbol, getDBCastFunctionSymbol, getDBCoalesce, getDBContains, getDBCount, getDBDateInequality, getDBDatetimeInequality, getDBDayFromDate, getDBDayFromDatetime, getDBDaysBetweenFromDate, getDBDaysBetweenFromDateTime, getDBDefaultInequality, getDBEncodeForURI, getDBEndsWith, getDBHours, getDBHoursBetweenFromDateTime, getDBIfElseNull, getDBIntIndex, getDBIriStringResolver, getDBLike, getDBMathBinaryOperator, getDBMax, getDBMd5, getDBMillisBetweenFromDateTime, getDBMin, getDBMinutes, getDBMinutesBetweenFromDateTime, getDBMonthFromDate, getDBMonthFromDatetime, getDBNonStrictDateEquality, getDBNonStrictDatetimeEquality, getDBNonStrictDefaultEquality, getDBNonStrictNumericEquality, getDBNonStrictStringEquality, getDBNot, getDBNumericInequality, getDBRowNumber, getDBRowUniqueStr, getDBSeconds, getDBSecondsBetweenFromDateTime, getDBSha1, getDBSha256, getDBSha512, getDBSimilarTo, getDBStartsWith, getDBStrAfter, getDBStrBefore, getDBStrictEquality, getDBStrictNEquality, getDBStringInequality, getDBSum, getDBTz, getDBWeeksBetweenFromDate, getDBWeeksBetweenFromDateTime, getDBYearFromDate, getDBYearFromDatetime, getExtractFunctionSymbol, getFalseOrNullFunctionSymbol, getFloor, getFreshBnodeStringTemplateFunctionSymbol, getIRIStringTemplateFunctionSymbol, getNullIgnoringDBAvg, getNullIgnoringDBGroupConcat, getNullIgnoringDBSum, getR2RMLIRISafeEncode, getRegularDBBooleanFunctionSymbol, getRegularDBFunctionSymbol, getRound, getTemporaryConversionToDBStringFunctionSymbol, getTrueOrNullFunctionSymbol, getTypedNullFunctionSymbol, getUntypedDBMathBinaryOperator, serializeCurrentDateTime, serializeDBRowUniqueStr, serializeExtract
-
-
-
-
Field Detail
-
UUID_STR
protected static final String UUID_STR
- See Also:
- Constant Field Values
-
CURRENT_TZ_STR
protected static final String CURRENT_TZ_STR
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
MySQLDBFunctionSymbolFactory
@Inject protected MySQLDBFunctionSymbolFactory(TypeFactory typeFactory)
-
-
Method Detail
-
createMySQLRegularFunctionTable
protected static it.unibz.inf.ontop.com.google.common.collect.ImmutableTable<String,Integer,DBFunctionSymbol> createMySQLRegularFunctionTable(TypeFactory typeFactory)
-
createNormalizationTable
protected it.unibz.inf.ontop.com.google.common.collect.ImmutableTable<DBTermType,RDFDatatype,DBTypeConversionFunctionSymbol> createNormalizationTable()
We know that the normalization function DATETIME -> xsd:datetimeStamp will always be invalid (it is not bound to any timezone). TODO: how to inform the user? In a mapping it would be invalid, but what about a cast in a SPARQL query?- Overrides:
createNormalizationTablein classAbstractDBFunctionSymbolFactory
-
createDBGroupConcat
protected DBFunctionSymbol createDBGroupConcat(DBTermType dbStringType, boolean isDistinct)
- Overrides:
createDBGroupConcatin classAbstractDBFunctionSymbolFactory
-
createDateTimeDenormFunctionSymbol
protected DBTypeConversionFunctionSymbol createDateTimeDenormFunctionSymbol(DBTermType timestampType)
TODO: provide a MySQL specific implementation- Overrides:
createDateTimeDenormFunctionSymbolin classAbstractSQLDBFunctionSymbolFactory
-
serializeContains
protected String serializeContains(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeContainsin classAbstractDBFunctionSymbolFactory
-
serializeStrBefore
protected String serializeStrBefore(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeStrBeforein classAbstractDBFunctionSymbolFactory
-
serializeStrAfter
protected String serializeStrAfter(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeStrAfterin classAbstractDBFunctionSymbolFactory
-
serializeMD5
protected String serializeMD5(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeMD5in classAbstractDBFunctionSymbolFactory
-
serializeSHA1
protected String serializeSHA1(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeSHA1in classAbstractDBFunctionSymbolFactory
-
serializeSHA256
protected String serializeSHA256(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeSHA256in classAbstractDBFunctionSymbolFactory
-
serializeSHA512
protected String serializeSHA512(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeSHA512in classAbstractDBFunctionSymbolFactory
-
serializeTz
protected String serializeTz(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
Tricky as this information may be lost while converting SPARQL constants into DB ones- Specified by:
serializeTzin classAbstractDBFunctionSymbolFactory
-
serializeDBRowNumber
protected String serializeDBRowNumber(Function<ImmutableTerm,String> converter, TermFactory termFactory)
Only for >= 8.0.2 TODO: provide an alternative implementation for the row unique str for previous versions- Overrides:
serializeDBRowNumberin classAbstractSQLDBFunctionSymbolFactory
-
createDateTimeNormFunctionSymbol
protected DBTypeConversionFunctionSymbol createDateTimeNormFunctionSymbol(DBTermType dbDateTimestampType)
- Overrides:
createDateTimeNormFunctionSymbolin classAbstractSQLDBFunctionSymbolFactory
-
serializeDateTimeNorm
protected String serializeDateTimeNorm(DBTermType dbDateTimestampType, it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter)
For DATETIME, never provides a time zone. For TIMESTAMP, provides the session time zone used for generating the string (NB: TIMESTAMP is stored as a duration from a fixed date time)
-
serializeDateTimeNorm
protected String serializeDateTimeNorm(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Specified by:
serializeDateTimeNormin classAbstractSQLDBFunctionSymbolFactory
-
createNullRejectingDBConcat
protected DBConcatFunctionSymbol createNullRejectingDBConcat(int arity)
MySQL only supports n-ary CONCAT but not operators like || and +- Specified by:
createNullRejectingDBConcatin classAbstractSQLDBFunctionSymbolFactory
-
createDBConcatOperator
protected DBConcatFunctionSymbol createDBConcatOperator(int arity)
- Specified by:
createDBConcatOperatorin classAbstractSQLDBFunctionSymbolFactory
-
createRegularDBConcat
protected DBConcatFunctionSymbol createRegularDBConcat(int arity)
Description copied from class:AbstractSQLDBFunctionSymbolFactoryCONCAT regular function symbol, not an operator (like || or +)- Specified by:
createRegularDBConcatin classAbstractSQLDBFunctionSymbolFactory
-
createDatetimeToDatetimeCastFunctionSymbol
protected DBTypeConversionFunctionSymbol createDatetimeToDatetimeCastFunctionSymbol(DBTermType inputType, DBTermType targetType)
Made Implicit- Overrides:
createDatetimeToDatetimeCastFunctionSymbolin classAbstractSQLDBFunctionSymbolFactory
-
createEncodeURLorIRI
protected DBFunctionSymbol createEncodeURLorIRI(boolean preserveInternationalChars)
- Overrides:
createEncodeURLorIRIin classAbstractSQLDBFunctionSymbolFactory
-
getUUIDNameInDialect
protected String getUUIDNameInDialect()
- Specified by:
getUUIDNameInDialectin classAbstractSQLDBFunctionSymbolFactory
-
getDBRegexpMatches2
public DBBooleanFunctionSymbol getDBRegexpMatches2()
NB: For MySQL >= 8, REGEXP_LIKE could be used- Specified by:
getDBRegexpMatches2in interfaceDBFunctionSymbolFactory- Overrides:
getDBRegexpMatches2in classAbstractSQLDBFunctionSymbolFactory
-
getDBRegexpMatches3
public DBBooleanFunctionSymbol getDBRegexpMatches3()
- Specified by:
getDBRegexpMatches3in interfaceDBFunctionSymbolFactory- Overrides:
getDBRegexpMatches3in classAbstractSQLDBFunctionSymbolFactory
-
serializeDBRegexpMatches3
protected String serializeDBRegexpMatches3(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
TODO: throw an exception when the version is detected to be < 8 and reaching the "default" case?
-
serializeMillisBetween
protected String serializeMillisBetween(it.unibz.inf.ontop.com.google.common.collect.ImmutableList<? extends ImmutableTerm> terms, Function<ImmutableTerm,String> termConverter, TermFactory termFactory)
- Overrides:
serializeMillisBetweenin classAbstractSQLDBFunctionSymbolFactory
-
-