Skip to content

DatatypeInsideOntop

skomlaebri edited this page Jun 22, 2015 · 7 revisions

Datatype handling inside Ontop

Note that this page is only intended for ontop developers

Note that the behavior has changed as described in OntopDatatypes

Datatypes inside ontop:

  • SQL data type (DB and mappings) x #DBs,

  • java.sql.jdbc.Types

  • XSD data types (for Datalog) ans1(xsd:int(x))

  • XML Schema

  • COL_TYPE (used for the signature of the Predicate)

  • CODE (for SQL generation)

  • OWL Datatype (for OWLAPI)

  • Sesame Datatype (for SESAME API)

  • SQL CAST (for SQL Generation, in particular for aggregations)

Datatype conversions:

  • OWL datatype -> COL_TYPE
OWLAPI3Translator
		private static Predicate.COL_TYPE getColumnType(OWLDatatype datatype) throws TranslationException 
  • Sesame Datatype (XSD type) -> COL_TYPE
SesameRDFIterator
		private Predicate.COL_TYPE getColumnType(URI datatype) 
  • COL_TYPE -> Sesame Datatype
SesameBindingSet
      private Binding createBinding(String bindingName) 
  • XSD type -> CODE
	SQLGenerator
	private String getTypeColumnForSELECT(Term ht, List<String> signature, int hpos) 
  • XSD type -> jdbc Type
	SQLGenerator
	private int getVariableDataType (Term term, QueryAliasIndex idx) 
  • CODE -> COL_TYPE
QuestResultset
	private COL_TYPE getQuestType(int sqltype) 
  • jdbc Type -> XSD type
TypeMapper
        private static TypeMapper typeMapper;

NOTE: we return the most general XSD datatype from the correspondent database SQL type.
  • jdbc Type -> XSD type (use TypeMapper)
MappingDatatypeRepair 
     private Predicate getDataTypeFunctor(Map<String, List<Object[]>> termOccurenceIndex, Variable variable) throws OBDAException 
  • jdbc Type -> DB specific type
SQLDialectAdapters
      public String sqlCast(String value, int type)  
      private static Map<Integer, String> SqlDatatypes
  • XSD type -> COL_TYPE
SparqlAlgebraToDatalogTranslator
private COL_TYPE getDataType(LiteralImpl node) 
  • COL_TYPE -> XSD type
SparqlAlgebraToDatalogTranslator
private Predicate getDataTypePredicate(COL_TYPE dataType) throws RuntimeException 
  • XML Schema -> COL_TYPE
SparqlAlgebraToDatalogTranslator
private Function getConstantFunctionTerm(org.openrdf.query.algebra.ValueConstant expr) 
  • COL_TYPE -> XSD type
ExpressionEvaluator
private Predicate getDatatypePredicate(Term term) 

##Using Datatypes

  • COL_TYPE -> string
JDBCUtil 
        public String getSQLLexicalForm(ValueConstant constant)
  • jdbc Type -> boolean true/false
SQLGenerator
	private boolean isStringColType
Clone this wiki locally