import logging, coloredlogs

##############################################################################
#############################   RML CONSTANTS  ###############################
##############################################################################

RML_URI = 'http://semweb.mmlab.be/ns/rml#'
R2RML_URI = 'http://www.w3.org/ns/r2rml#'
RDF_URI = 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'
D2RQ_URI = 'http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#'
QL_URI = 'http://semweb.mmlab.be/ns/ql#'
EXAMPLE_PREFIX = 'ex'
EXAMPLE_URI = "http://myexampleuri.org/data#"
RDFS_URI = 'http://www.w3.org/2000/01/rdf-schema#'
XSD_URI = 'http://www.w3.org/2001/XMLSchema#'
FOAF_URI = 'http://xmlns.com/foaf/0.1/'
RDF_TYPE = 'rdf:type'
SCHEMA_URI = 'http://schema.org/'
STAR_URI = 'https://w3id.org/kg-construct/rml-star'
COMPRESSION_URI = 'http://semweb.mmlab.be/ns/rml-compression#'
FORMATS_URI = 'http://www.w3.org/ns/formats/'
VOID_URI = 'http://rdfs.org/ns/void#'
FNML_URI = 'http://semweb.mmlab.be/ns/fnml#'
GREL_URI = 'http://users.ugent.be/~bjdmeest/function/grel.ttl#'
OCH_URI = 'http://w3id.org/def/och#'

R2RML_PREFIX = 'rr'
RML_PREFIX = 'rml'
OCH_PREFIX = 'och'
RDF_PREFIX = 'rdf'
RDFS_PREFIX = 'rdfs'
RDF_FIRST = f'{RDF_PREFIX}:first'
RDF_REST = f'{RDF_PREFIX}:rest'
RDF_TYPE = f'{RDF_PREFIX}:type'
TURTLE_PREFIX = '@prefix'
RML_BASE = '@base'
RML_LOGICAL_SOURCE_CLASS = f'{RML_PREFIX}:LogicalSource'
RML_LOGICAL_SOURCE = f'{RML_PREFIX}:logicalSource'
RML_SOURCE = f'{RML_PREFIX}:source'
RML_REFERENCE_FORMULATION = f'{RML_PREFIX}:referenceFormulation'
RML_ITERATOR = f'{RML_PREFIX}:iterator'
RML_REFERENCE = f'{RML_PREFIX}:reference'
RML_LANGUAGE_MAP = f'{RML_PREFIX}:languageMap'
RML_LANGUAGE_MAP_CLASS = f'{RML_PREFIX}:LanguageMap'
RML_DATATYPE_MAP = f'{RML_PREFIX}:datatypeMap'
RML_DATATYPE_MAP_CLASS = f'{RML_PREFIX}:DatatypeMap'
RML_QUERY = f'{RML_PREFIX}:query'

RML_LOGICAL_TARGET = f'{RML_PREFIX}:logicalTarget'
RML_LOGICAL_TARGET_CLASS = f'{RML_PREFIX}:LogicalTarget'
RML_TARGET = f'{RML_PREFIX}:target'
RML_SERIALIZATION = f'{RML_PREFIX}:serialization'
RML_COMPRESSION = f'{RML_PREFIX}:compression'

R2RML_TEMPLATE = f'{R2RML_PREFIX}:template'
R2RML_TRIPLES_MAP = f'{R2RML_PREFIX}:TriplesMap'
R2RML_CONSTANT = f'{R2RML_PREFIX}:constant'
R2RML_SUBJECT = f'{R2RML_PREFIX}:subjectMap'
R2RML_SUBJECT_CLASS = f'{R2RML_PREFIX}:SubjectMap'
R2RML_CLASS = f'{R2RML_PREFIX}:class'
R2RML_SQL_VERSION = f'{R2RML_PREFIX}:sqlVersion'
R2RML_SQL_QUERY = f'{R2RML_PREFIX}:sqlQuery'
R2RML_PREDICATE_OBJECT_MAP = f'{R2RML_PREFIX}:predicateObjectMap'
R2RML_PREDICATE_OBJECT_MAP_CLASS = f'{R2RML_PREFIX}:PredicateObjectMap'
R2RML_SHORTCUT_PREDICATE = f'{R2RML_PREFIX}:predicate'
R2RML_PREDICATE = f'{R2RML_PREFIX}:predicateMap'
R2RML_PREDICATE_CLASS = f'{R2RML_PREFIX}:PredicateMap'
R2RML_SHORTCUT_OBJECT = f'{R2RML_PREFIX}:object'
R2RML_OBJECT = f'{R2RML_PREFIX}:objectMap'
R2RML_OBJECT_CLASS = f'{R2RML_PREFIX}:ObjectMap'
R2RML_GRAPH = f'{R2RML_PREFIX}:graph'
R2RML_GRAPH_MAP = f'{R2RML_PREFIX}:graphMap'
R2RML_GRAPH_CLASS = f'{R2RML_PREFIX}:GraphMap'
R2RML_DATATYPE = f'{R2RML_PREFIX}:datatype'
R2RML_TERMTYPE = f'{R2RML_PREFIX}:termType'
R2RML_LANGUAGE = f'{R2RML_PREFIX}:language'
R2RML_IRI = f'{R2RML_PREFIX}:IRI'
R2RML_BLANK_NODE = f'{R2RML_PREFIX}:BlankNode'
R2RML_LITERAL = f'{R2RML_PREFIX}:Literal'
R2RML_REFOBJECT_CLASS = f'{R2RML_PREFIX}:RefObjectMap'
R2RML_PARENT_TRIPLESMAP = f'{R2RML_PREFIX}:parentTriplesMap'
R2RML_JOIN_CONDITION = f'{R2RML_PREFIX}:joinCondition'
R2RML_CHILD = f'{R2RML_PREFIX}:child'
R2RML_PARENT = f'{R2RML_PREFIX}:parent'
R2RML_LOGICAL_TABLE_CLASS = f'{R2RML_PREFIX}:LogicalTable'
R2RML_LOGICAL_TABLE = f'{R2RML_PREFIX}:logicalTable'
R2RML_TABLE_NAME = f'{R2RML_PREFIX}:tableName'
R2RML_COLUMN = f'{R2RML_PREFIX}:column'

##############################################################################
#############################   SHACL CONSTANTS  ###############################
##############################################################################
SHACL_URI = 'http://www.w3.org/ns/shacl#'
SHACL_PREFIX = 'sh'
SHACL_SHAPE = f'{SHACL_PREFIX}:Shape'
SHACL_NODE_SHAPE = f'{SHACL_PREFIX}:NodeShape'
SHACL_PROPERTY_SHAPE = f'{SHACL_PREFIX}:PropertyShape'
SHACL_TARGET_CLASS = f'{SHACL_PREFIX}:targetClass'
SHACL_DEACTIVATED = f'{SHACL_PREFIX}:deactivated'
SHACL_PATH = f'{SHACL_PREFIX}:path'
SHACL_IN = f'{SHACL_PREFIX}:in'
SHACL_OR = f'{SHACL_PREFIX}:or'
SHACL_AND = f'{SHACL_PREFIX}:and'
SHACL_XONE = f'{SHACL_PREFIX}:xone'
SHACL_SPARQL = f'{SHACL_PREFIX}:sparql'
SHACL_SPARQL_CONSTRAINT = f'{SHACL_PREFIX}:SPARQLConstraint'
SHACL_SPARQL_SELECT = f'{SHACL_PREFIX}:select'
SHACL_CLASS = f'{SHACL_PREFIX}:class'
SHACL_PROPERTY = f'{SHACL_PREFIX}:property'
SHACL_DATATYPE = f'{SHACL_PREFIX}:datatype'
SHACL_NOT = f'{SHACL_PREFIX}:not'
SHACL_MAX_COUNT = f'{SHACL_PREFIX}:maxCount'
SHACL_INVERSE_PATH = f'{SHACL_PREFIX}:inversePath'
SHACL_DISJOINT = f'{SHACL_PREFIX}:disjoint'
SHACL_EQUALS = f'{SHACL_PREFIX}:equals'

##############################################################################
#############################   D2RQ CONSTANTS  ##############################
##############################################################################
D2RQ_DATABASE_CLASS = 'd2rq:Database'#
D2RQ_DSN = 'd2rq:jdbcDSN'
D2RQ_DRIVER = 'd2rq:jdbcDriver'
D2RQ_USER = 'd2rq:username'
D2RQ_PASS = 'd2rq:password'

##############################################################################
#############################  OCH CONSTANTS  ###############################
##############################################################################

OCH_ADD_CLASS = f'{OCH_PREFIX}:AddClass'
OCH_REMOVE_CLASS = f'{OCH_PREFIX}:RemoveClass'
OCH_ADD_SUBCLASS = f'{OCH_PREFIX}:AddSubClass'
OCH_REMOVE_SUBCLASS = f'{OCH_PREFIX}:RemoveSubClass'
OCH_ADD_OBJECT_PROPERTY = f'{OCH_PREFIX}:AddObjectProperty'
OCH_REMOVE_OBJECT_PROPERTY = f'{OCH_PREFIX}:RemoveObjectProperty'
OCH_ADD_DATA_PROPERTY = f'{OCH_PREFIX}:AddDataProperty'
OCH_REMOVE_DATA_PROPERTY = f'{OCH_PREFIX}:RemoveDataProperty'
OCH_ADD_DOMAIN = f'{OCH_PREFIX}:AddDomain'
OCH_REMOVE_DOMAIN = f'{OCH_PREFIX}:RemoveDomain'
OCH_ADD_RANGE_OBJECT = f'{OCH_PREFIX}:AddRangeObjectProperty'
OCH_REMOVE_RANGE_OBJECT = f'{OCH_PREFIX}:RemoveRangeObjectProperty'
OCH_ADD_RANGE_DATA = f'{OCH_PREFIX}:AddRangeDataProperty'
OCH_REMOVE_RANGE_DATA = f'{OCH_PREFIX}:RemoveRangeDataProperty'
OCH_DEPRECATE_ENTITY = f'{OCH_PREFIX}:DeprecateEntity'
OCH_REVOKE_DEPRECATE = f'{OCH_PREFIX}:RevokeDeprecate'
OCH_RENAME_ENTITY = f'{OCH_PREFIX}:RenameEntity'


OCH_ADDED_CLASS = f'{OCH_PREFIX}:addedClass'
OCH_DELETED_CLASS = f'{OCH_PREFIX}:removedClass'

OCH_ADD_SUBCLASS_SOURCE = f'{OCH_PREFIX}:sourceAddSubClass' 
OCH_ADD_SUBCLASS_TARGET = f'{OCH_PREFIX}:targetAddSubClass'

OCH_REMOVE_SUBCLASS_SOURCE = f'{OCH_PREFIX}:sourceRemoveSubClass'
OCH_REMOVE_SUBCLASS_TARGET = f'{OCH_PREFIX}:targetRemoveSubClass'

OCH_ADD_EQUIVALENT_CLASS_SOURCE = f'{OCH_PREFIX}:sourceAddEquivalentClass' 
OCH_ADD_EQUIVALENT_CLASS_TARGET = f'{OCH_PREFIX}:targetAddEquivalentClass'

OCH_REMOVE_EQUIVALENT_CLASS_SOURCE = f'{OCH_PREFIX}:sourceRemoveEquivalentClass'
OCH_REMOVE_EQUIVALENT_CLASS_TARGET = f'{OCH_PREFIX}:targetRemoveEquivalentClass'

OCH_ADD_DISJOINT_CLASS_SOURCE = f'{OCH_PREFIX}:sourceAddDisjointClass'
OCH_ADD_DISJOINT_CLASS_TARGET = f'{OCH_PREFIX}:targetAddDisjointClass'

OCH_REMOVE_DISJOINT_CLASS_SOURCE = f'{OCH_PREFIX}:sourceRemoveDisjointClass'
OCH_REMOVE_DISJOINT_CLASS_TARGET = f'{OCH_PREFIX}:targetRemoveDisjointClass'

OCH_ADDED_OBJECT_PROPERTY = f'{OCH_PREFIX}:addedObjectProperty'

OCH_ADDED_DATA_PROPERTY = f'{OCH_PREFIX}:addedDataProperty'

OCH_REMOVED_DATA_PROPERTY = f'{OCH_PREFIX}:removedDataProperty'

OCH_REMOVED_OBJECT_PROPERTY = f'{OCH_PREFIX}:removedObjectProperty'

OCH_ADDED_DOMAIN = f'{OCH_PREFIX}:addedDomain'
OCH_REMOVED_DOMAIN = f'{OCH_PREFIX}:removedDomain'
OCH_ADDED_OBJECT_RANGE= f'{OCH_PREFIX}:addedObjectRange'
OCH_REMOVED_OBJECT_RANGE= f'{OCH_PREFIX}:removedObjectRange'
OCH_ADDED_DATA_RANGE= f'{OCH_PREFIX}:addedDataRange'
OCH_REMOVED_DATA_RANGE= f'{OCH_PREFIX}:removedDataRange'
OCH_ADDED_DOMAIN_TO_PROPERTY = f'{OCH_PREFIX}:addedDomainToProperty'
OCH_REMOVED_DOMAIN_TO_PROPERTY = f'{OCH_PREFIX}:removedDomainFromProperty'
OCH_ADDED_RANGE_TO_PROPERTY = f'{OCH_PREFIX}:addedRangeToProperty'
OCH_REMOVED_RANGE_TO_PROPERTY = f'{OCH_PREFIX}:removedRangeFromProperty'
OCH_DEPRECATED_ENTITY = f'{OCH_PREFIX}:deprecatedEntity'
OCH_UNDEPRECATED_ELEMENT= f'{OCH_PREFIX}:undeprecatedElement'
OCH_OLD_NAME = f'{OCH_PREFIX}:outdatedEntityName'
OCH_NEW_NAME = f'{OCH_PREFIX}:renamedEntityName'
OCH_ADD_EQUIVALENT_CLASS = f'{OCH_PREFIX}:AddEquivalentClass'
OCH_REMOVE_EQUIVALENT_CLASS = f'{OCH_PREFIX}:RemoveEquivalentClass'
OCH_ADD_DISJOINT_CLASS = f'{OCH_PREFIX}:AddDisjointClass'
OCH_REMOVE_DISJOINT_CLASS = f'{OCH_PREFIX}:RemoveDisjointClass'

OCH_ADD_CHARACTERISTIC = f'{OCH_PREFIX}:AddCharacteristic'
OCH_REMOVE_CHARACTERISTIC = f'{OCH_PREFIX}:RemoveCharacteristic'
OCH_ADDED_CHARACTERISTIC = f'{OCH_PREFIX}:addedCharacteristic'
OCH_REMOVED_CHARACTERISTIC = f'{OCH_PREFIX}:removedCharacteristic'
OCH_ADDED_CHARACTERISTIC_TO_PROPERTY = f'{OCH_PREFIX}:addedCharacteristicToProperty'
OCH_REMOVED_CHARACTERISTIC_FROM_PROPERTY = f'{OCH_PREFIX}:removedCharacteristicFromProperty'

OCH_ADD_INVERSE_PROPERTY = f'{OCH_PREFIX}:AddInverseProperty'
OCH_REMOVE_INVERSE_PROPERTY = f'{OCH_PREFIX}:RemoveInverseProperty'
OCH_ADD_INVERSE_PROPERTY_SOURCE = f'{OCH_PREFIX}:sourceAddInverseProperty'
OCH_ADD_INVERSE_PROPERTY_TARGET = f'{OCH_PREFIX}:targetAddInverseProperty'
OCH_REMOVE_INVERSE_PROPERTY_SOURCE = f'{OCH_PREFIX}:sourceRemoveInverseProperty'
OCH_REMOVE_INVERSE_PROPERTY_TARGET = f'{OCH_PREFIX}:targetRemoveInverseProperty'

OCH_ADD_DISJOINT_PROPERTY = f'{OCH_PREFIX}:AddDisjointProperty'
OCH_REMOVE_DISJOINT_PROPERTY = f'{OCH_PREFIX}:RemoveDisjointProperty'
OCH_ADD_DISJOINT_PROPERTY_SOURCE = f'{OCH_PREFIX}:sourceAddDisjointProperty'
OCH_ADD_DISJOINT_PROPERTY_TARGET = f'{OCH_PREFIX}:targetAddDisjointProperty'
OCH_REMOVE_DISJOINT_PROPERTY_SOURCE = f'{OCH_PREFIX}:sourceRemoveDisjointProperty'
OCH_REMOVE_DISJOINT_PROPERTY_TARGET = f'{OCH_PREFIX}:targetRemoveDisjointProperty'

OCH_ADD_SUBPROPERTY = f'{OCH_PREFIX}:AddSubProperty'
OCH_REMOVE_SUBPROPERTY = f'{OCH_PREFIX}:RemoveSubProperty'
OCH_ADD_SUBPROPERTY_SOURCE = f'{OCH_PREFIX}:sourceAddSubProperty'
OCH_ADD_SUBPROPERTY_TARGET = f'{OCH_PREFIX}:targetAddSubProperty'
OCH_REMOVE_SUBPROPERTY_SOURCE = f'{OCH_PREFIX}:sourceRemoveSubProperty'
OCH_REMOVE_SUBPROPERTY_TARGET = f'{OCH_PREFIX}:targetRemoveSubProperty'

##############################################################################
#############################  RDFS&OWL CONSTANTS  ###########################
##############################################################################
OWL_PREFIX = 'owl'
OWL_URI = 'http://www.w3.org/2002/07/owl#'
OWL_CLASS = '{OWL_PREFIX}:Class'
OWL_CLASS_URI = 'http://www.w3.org/2002/07/owl#Class'
OWL_DATA_PROPERTY = f'{OWL_PREFIX}:DatatypeProperty'
OWL_DATA_PROPERTY_URI = 'http://www.w3.org/2002/07/owl#DatatypeProperty'
OWL_OBJECT_PROPERTY = f'{OWL_PREFIX}:ObjectProperty'
OWL_OBJECT_PROPERTY_URI = 'http://www.w3.org/2002/07/owl#ObjectProperty'
OWL_FUNCTIONAL_PROPERTY_URI = f'{OWL_URI}FunctionalProperty'
OWL_SYMMETRIC_PROPERTY = f'{OWL_PREFIX}:SymmetricProperty'
OWL_SYMMETRIC_PROPERTY_URI = f'{OWL_URI}SymmetricProperty'
OWL_ASYMMETRIC_PROPERTY = f'{OWL_PREFIX}:AsymmetricProperty'
OWL_ASYMMETRIC_PROPERTY_URI = f'{OWL_URI}AsymmetricProperty'
OWL_REFLEXIVE_PROPERTY = f'{OWL_PREFIX}:ReflexiveProperty'
OWL_REFLEXIVE_PROPERTY_URI = f'{OWL_URI}ReflexiveProperty'
OWL_IRREFLEXIVE_PROPERTY = f'{OWL_PREFIX}:IrreflexiveProperty'
OWL_IRREFLEXIVE_PROPERTY_URI = f'{OWL_URI}IrreflexiveProperty'
OWL_INVERSE_FUNCTIONAL_PROPERTY = f'{OWL_PREFIX}:InverseFunctionalProperty'
OWL_INVERSE_FUNCTIONAL_PROPERTY_URI = f'{OWL_URI}InverseFunctionalProperty'
OWL_TRANSITIVE_PROPERTY = f'{OWL_PREFIX}:TransitiveProperty'
OWL_TRANSITIVE_PROPERTY_URI = f'{OWL_URI}TransitiveProperty'

OCH_ADD_EQUIVALENT_PROPERTY = f'{OCH_PREFIX}:AddEquivalentProperty'
OCH_REMOVE_EQUIVALENT_PROPERTY = f'{OCH_PREFIX}:RemoveEquivalentProperty'
OCH_ADD_EQUIVALENT_PROPERTY_SOURCE = f'{OCH_PREFIX}:sourceAddEquivalentProperty'
OCH_ADD_EQUIVALENT_PROPERTY_TARGET = f'{OCH_PREFIX}:targetAddEquivalentProperty'
OCH_REMOVE_EQUIVALENT_PROPERTY_SOURCE = f'{OCH_PREFIX}:sourceRemoveEquivalentProperty'
OCH_REMOVE_EQUIVALENT_PROPERTY_TARGET = f'{OCH_PREFIX}:targetRemoveEquivalentProperty'

RDFS_DOMAIN = 'rdfs:domain'
RDFS_RANGE = 'rdfs:range'
RDFS_SUBCLASS = 'rdfs:subClassOf'
PROV_PREFIX = 'prov'
PROV_URI = 'http://www.w3.org/ns/prov#'
PROV_WAS_DERIVED_FROM = f'{PROV_PREFIX}:wasDerivedFrom'

logger = logging.getLogger(__name__)
coloredlogs.install(level='DEBUG', fmt='%(asctime)s,%(msecs)03d | %(levelname)s: %(message)s')
