Initialize SQL extractor rule definition.

@param ruleDefinitionEntity extractor rule definition entity
330353
@SneakyThrows
    public void init(final ExtractorRuleDefinitionEntity ruleDefinitionEntity) {
        for (ExtractorRuleEntity each : ruleDefinitionEntity.getRules()) {
            rules.put(each.getId(), (SQLSegmentExtractor) Class.forName(each.getExtractorClass()).newInstance());
        }
    }
385707
private void initEntityResolver() {
        final String entityResolveClazzName = System.getProperty( ExtensibleXmlParser.ENTITY_RESOLVER_PROPERTY_NAME );
        if ( entityResolveClazzName != null && entityResolveClazzName.length() > 0 ) {
            try {

                final Class entityResolverClazz = classLoader.loadClass( entityResolveClazzName );
                this.entityResolver = (EntityResolver) entityResolverClazz.newInstance();
            } catch ( final Exception ignoreIt ) {
            }
        }
    }
1182736
protected void init(T[] ancestorDefinition, T[] recipientDefinition, List<T> sameDefinitionData,
      List<RelatedDefinition<T>> changedDefinitionData, List<T> newDefinitionData, List<T> removedDefinitionData)
   {
      for (int i = 0; i < recipientDefinition.length; i++)
      {
         boolean isNew = true;
         for (int j = 0; j < ancestorDefinition.length; j++)
         {
            if (recipientDefinition[i].getName().equals(ancestorDefinition[j].getName()))
            {
               isNew = false;
               if (recipientDefinition[i].equals(ancestorDefinition[j]))
                  sameDefinitionData.add(recipientDefinition[i]);
               else
               {
                  RelatedDefinition<T> relatedDefinition =
                     new RelatedDefinition<T>(ancestorDefinition[j], recipientDefinition[i]);
                  changedDefinitionData.add(relatedDefinition);
               }
            }
         }
         if (isNew)
            newDefinitionData.add(recipientDefinition[i]);
      }
      for (int i = 0; i < ancestorDefinition.length; i++)
      {
         boolean isRemoved = true;
         for (int j = 0; j < recipientDefinition.length && isRemoved; j++)
         {
            if (recipientDefinition[j].getName().equals(ancestorDefinition[i].getName()))
            {
               isRemoved = false;
               break;
            }
         }
         if (isRemoved)
            removedDefinitionData.add(ancestorDefinition[i]);
      }
   }
749927
public static void deinitialize() {
      SqlClosure.setDefaultDataSource(null);
      TransactionElf.setUserTransaction(null);
      TransactionElf.setTransactionManager(null);
   }
558730
@Override
    public synchronized void prepareAnalyzer(Engine engine) throws InitializationException {
        if (rules.isEmpty()) {
            try {
                loadSuppressionBaseData();
            } catch (SuppressionParseException ex) {
                throw new InitializationException("Error initializing the suppression analyzer: " + ex.getLocalizedMessage(), ex, true);
            }

            try {
                loadSuppressionData();
            } catch (SuppressionParseException ex) {
                throw new InitializationException("Warn initializing the suppression analyzer: " + ex.getLocalizedMessage(), ex, false);
            }
        }
    }
549453
@SuppressWarnings("unchecked")
    @SneakyThrows
    public void init(final FillerRuleDefinitionEntity fillerRuleDefinitionEntity) {
        for (FillerRuleEntity each : fillerRuleDefinitionEntity.getRules()) {
            rules.put((Class<? extends SQLSegment>) Class.forName(each.getSqlSegmentClass()), (SQLSegmentFiller) Class.forName(each.getFillerClass()).newInstance());
        }
    }
1203307
private function addRuleCondition(QueryBuilder $query, EntityDefinition $definition, Context $context): void
    {
        if ($definition->isBlacklistAware() && $context->getRuleIds()) {
            $wheres = [];

            $accessor = $this->getFieldAccessor('blacklistIds', $definition, $definition->getEntityName(), $context);

            foreach ($context->getRuleIds() as $ruleId) {
                if (!Uuid::isValid($ruleId)) {
                    throw new InvalidUuidException($ruleId);
                }
                $wheres[] = sprintf(
                    'JSON_CONTAINS(IFNULL(' . $accessor . ', JSON_ARRAY()), JSON_ARRAY(:%s))',
                    'contextRule' . $ruleId
                );
                $query->setParameter('contextRule' . $ruleId, $ruleId);
            }

            $query->andWhere(implode(' + ', $wheres) . ' = 0');
        }

        if (!$definition->isWhitelistAware()) {
            return;
        }

        $accessor = $this->getFieldAccessor('whitelistIds', $definition, $definition->getEntityName(), $context);

        $wheres = [];
        foreach ($context->getRuleIds() as $id) {
            if (!Uuid::isValid($id)) {
                throw new InvalidUuidException($id);
            }
            $wheres[] = sprintf(
                'JSON_CONTAINS(IFNULL(' . $accessor . ', JSON_ARRAY()), JSON_ARRAY(:%s))',
                'contextRule' . $id
            );
            $query->setParameter('contextRule' . $id, $id);
        }

        $conditions = [
            '(JSON_DEPTH(' . $accessor . ') is null)',
            '(JSON_DEPTH(' . $accessor . ') = 1)',
        ];

        if (!empty($wheres)) {
            $conditions[] = implode(' + ', $wheres) . ' >= 1';
        }

        $query->andWhere('(' . implode(' OR ', $conditions) . ')');
    }
1269720
public static void initialize()
        throws CacheReloadException
    {
        Context.getDbType().initialize(AbstractDataModelObject.class);
        AttributeType.initialize(AbstractDataModelObject.class);
        SQLTable.initialize(AbstractDataModelObject.class);
        Type.initialize(AbstractDataModelObject.class);
        Dimension.initialize(AbstractDataModelObject.class);
        Attribute.initialize(AbstractDataModelObject.class);
        Status.initialize(AbstractDataModelObject.class);
    }
496949
private void onInheritedProperty(TableInfo tableInfo, EntityType entityType)
    {
        String discrColumn = ((AbstractManagedType) entityType).getDiscriminatorColumn();

        if (discrColumn != null)
        {
            ColumnInfo columnInfo = new ColumnInfo();
            columnInfo.setColumnName(discrColumn);
            columnInfo.setType(String.class);
            columnInfo.setIndexable(true);

            IndexInfo idxInfo = new IndexInfo(discrColumn);
            tableInfo.addColumnInfo(columnInfo);
            tableInfo.addToIndexedColumnList(idxInfo);
        }
    }
1200650
@Override
    @Deprecated
    protected void initializeInternal() throws RepositoryException {
        this.databaseClient = DatabaseClientFactory.newClient(host,port,user,password,DatabaseClientFactory.Authentication.valueOf(auth));
        this.client = new MarkLogicClient(databaseClient);
    }
983416
public void initializeExtensions() throws SQLException {
        if (extensionsNeedInitialization) {
            for (EmbeddedDbExtension ext : MdwServiceRegistry.getInstance().getEmbeddedDbExtensions()) {
                logger.info("Initializing embedded db extension: " + ext);
                List<String> sources = ext.getSqlSourceAssets();
                if (sources != null) {
                    try {
                        for (String source : sources) {
                            String assetPath = source;
                            if (source.indexOf('/') == -1)
                                assetPath = ext.getClass().getPackage().getName() + "/" + source;
                            logger.info("Sourcing asset sql script: " + assetPath);
                            String contents = AssetCache.getAsset(assetPath).getStringContent();
                            embeddedDb.source(contents);
                        }
                    }
                    catch (Exception ex) {
                        throw new SQLException("Error processing db extension " + ext.getClass(), ex);
                    }
                }
                ext.initialize();
            }
            extensionsNeedInitialization = false;
        }
    }
1266292
private void attributes( RuleDescrBuilder rule ) throws RecognitionException {
        if ( helper.validateIdentifierKey( DroolsSoftKeywords.ATTRIBUTES ) ) {
            match( input,
                   DRL5Lexer.ID,
                   DroolsSoftKeywords.ATTRIBUTES,
                   null,
                   DroolsEditorType.IDENTIFIER );
            if ( state.failed ) return;

            if ( input.LA( 1 ) == DRL5Lexer.COLON ) {
                match( input,
                       DRL5Lexer.COLON,
                       null,
                       null,
                       DroolsEditorType.SYMBOL );
                if ( state.failed ) return;
            }
        }

        if ( helper.validateAttribute( 1 ) ) {
            attribute( rule );
            if ( state.failed ) return;

            while ( input.LA( 1 ) == DRL5Lexer.COMMA || helper.validateAttribute( 1 ) ) {
                if ( input.LA( 1 ) == DRL5Lexer.COMMA ) {
                    match( input,
                           DRL5Lexer.COMMA,
                           null,
                           null,
                           DroolsEditorType.SYMBOL );
                    if ( state.failed ) return;
                }
                attribute( rule );
                if ( state.failed ) return;
            }
        }
    }
646847
public void init(Rec record, PTable tableRemote, PhysicalDatabaseParent dbOwner)
    {
        super.init(record, tableRemote, dbOwner);
        m_iPhysicalIndex = NO_INDEX;
        m_iLogicalIndex = NO_INDEX;
    }
725988
public void init(Rec record, PTable tableRemote, PhysicalDatabaseParent dbOwner)
    {
        super.init(record);
        this.setPTableRef(tableRemote, dbOwner);
    }
368930
@Override
    public void visit(LowLevelAbstractionDefinition def) throws ProtempaException {
        LOGGER.log(Level.FINER, "Creating rule for {0}", def);
        try {
            /*
             * If there are no value definitions defined, we might still have an
             * inverseIsA relationship with another low-level abstraction
             * definition.
             */
            if (!def.getValueDefinitions().isEmpty()) {
                Rule rule = new Rule(def.getId());
                Pattern sourceP = new Pattern(2, 1, PRIM_PARAM_OT, "");
                Set<String> abstractedFrom = def.getAbstractedFrom();
                String[] abstractedFromArr = 
                        abstractedFrom.toArray(new String[abstractedFrom.size()]);
                Set<String> subtrees = this.cache.collectPropIdDescendantsUsingInverseIsA(abstractedFromArr);
                sourceP.addConstraint(new PredicateConstraint(
                        new PropositionPredicateExpression(subtrees)));
                Pattern resultP = new Pattern(1, 1, ARRAY_LIST_OT, "result");
                resultP.setSource(new Collect(sourceP, new Pattern(1, 1,
                        ARRAY_LIST_OT, "result")));
                resultP.addConstraint(new PredicateConstraint(
                        new CollectionSizeExpression(1)));
                rule.addPattern(resultP);

                String contextId = def.getContextId();
                if (contextId != null) {
                    Pattern sourceP2 = new Pattern(4, 1, CONTEXT_OT, "context");
                    sourceP2.addConstraint(new PredicateConstraint(
                            new PropositionPredicateExpression(contextId)));
                    Pattern resultP2 = new Pattern(3, 1, ARRAY_LIST_OT, "result2");
                    resultP2.setSource(new Collect(sourceP2, new Pattern(3, 1, ARRAY_LIST_OT, "result")));
                    resultP2.addConstraint(new PredicateConstraint(
                            new CollectionSizeExpression(1)));
                    rule.addPattern(resultP2);
                }

                Algorithm algo = this.algorithms.get(def);

                rule.setConsequence(new LowLevelAbstractionConsequence(def,
                        algo, this.derivationsBuilder));
                rule.setSalience(TWO_SALIENCE);
                this.ruleToAbstractionDefinition.put(rule, def);
                rules.add(rule);
            }
        } catch (InvalidRuleException e) {
            throw new AssertionError(e.getClass().getName() + ": "
                    + e.getMessage());
        }
    }
538924
protected void initDatabase() throws NamingException, RepositoryException, IOException
   {
      DBInitializer dbInitializer = null;
      if (containerConfig.dbDialect.equals(DBConstants.DB_DIALECT_ORACLEOCI))
      {
         LOG.warn(DBConstants.DB_DIALECT_ORACLEOCI + " dialect is experimental!");

         this.connFactory = defaultConnectionFactory();
         dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_ORACLE))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new OracleDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_PGSQL))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new PgSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL))
      {
         if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MYSQL_MYISAM))
         {
            LOG.warn("MyISAM is not supported due to its lack of transaction support and integrity check, so use it only"
               + " if you don't expect any support and performances in read accesses are more important than the consistency"
               + " in your use-case. This dialect is only dedicated to the community.");
         }
         this.connFactory = new MySQLConnectionFactory(getDataSource(), containerConfig);
         dbInitializer = new MysqlDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_MSSQL))
      {
         this.connFactory = new MSSQLConnectionFactory(getDataSource(), containerConfig);
         dbInitializer=new MSSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DERBY))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = defaultDBInitializer();
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_DB2))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new DB2DBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_SYBASE))
      {
         this.connFactory = new SybaseConnectionFactory(getDataSource(), containerConfig);
         dbInitializer = new SybaseDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_INGRES))
      {
         this.connFactory = defaultConnectionFactory();
         dbInitializer = new IngresSQLDBInitializer(this.connFactory.getJdbcConnection(), containerConfig);
      }
      else if (containerConfig.dbDialect.startsWith(DBConstants.DB_DIALECT_HSQLDB))
      {
         this.connFactory = new HSQLDBConnectionFactory(getDataSource(), containerConfig);
         dbInitializer = new HSQLDBInitializer(this.connFactory.getJdbcConnection(),containerConfig);
      }
      else
      {
         // generic, DB_HSQLDB
         this.connFactory = defaultConnectionFactory();
         dbInitializer = defaultDBInitializer();
      }

      // database type
      try
      {
         dbInitializer.init();
      }
      catch (DBInitializerException e)
      {
         LOG.error("Error of init db " + e, e);
      }
   }
719987
private void initialize() {

		domainIds.addAll(getResourceIds("rdfs:domain"));
		rangeIds.addAll(getResourceIds("rdfs:range"));

		allowsInstances     = "true".equals(getValue(getFirstElement(getElement(), "krdf:allowsInstances")));
		multipleOccurrences = "true".equals(getValue(getFirstElement(getElement(), "krdf:multipleOccurrences")));
		isMixedIn           = "true".equals(getValue(getFirstElement(getElement(), "krdf:isMixedIn")));
		oneWay              = "true".equals(getValue(getFirstElement(getElement(), "krdf:oneWay")));
		icon                = getValue(getFirstElement(getElement(), "krdf:icon"));

		final Object isPrimaryValue = getValue(getFirstElement(getElement(), "krdf:primary"));
		if (isPrimaryValue == null || "true".equals(isPrimaryValue)) {

			primary = true;
		}


		final Node node = getFirstElement(getElement(), "owl:inverseOf");
		if (node != null) {

			final String inverse = getResourceId(node);
			if (inverse != null) {

				this.inverseId = URI.create(inverse);
			}
		}

	}