/*global RuleResult, createExecutionContext, SupportError
506213
function Rule(spec, parentAudit) {
	'use strict';

	this._audit = parentAudit;

	/**
	 * The code, or string ID of the rule
	 * @type {String}
	 */
	this.id = spec.id;

	/**
	 * Selector that this rule applies to
	 * @type {String}
	 */
	this.selector = spec.selector || '*';

	/**
	 * Whether to exclude hiddden elements form analysis.  Defaults to true.
	 * @type {Boolean}
	 */
	this.excludeHidden =
		typeof spec.excludeHidden === 'boolean' ? spec.excludeHidden : true;

	/**
	 * Flag to enable or disable rule
	 * @type {Boolean}
	 */
	this.enabled = typeof spec.enabled === 'boolean' ? spec.enabled : true;

	/**
	 * Denotes if the rule should be run if Context is not an entire page AND whether
	 * the Rule should be satisified regardless of Node
	 * @type {Boolean}
	 */
	this.pageLevel = typeof spec.pageLevel === 'boolean' ? spec.pageLevel : false;

	/**
	 * Checks that any may return true to satisfy rule
	 * @type {Array}
	 */
	this.any = spec.any || [];

	/**
	 * Checks that must all return true to satisfy rule
	 * @type {Array}
	 */
	this.all = spec.all || [];

	/**
	 * Checks that none may return true to satisfy rule
	 * @type {Array}
	 */
	this.none = spec.none || [];

	/**
	 * Tags associated to this rule
	 * @type {Array}
	 */
	this.tags = spec.tags || [];

	/**
	 * Preload necessary for this rule
	 */
	this.preload = spec.preload ? true : false;

	if (spec.matches) {
		/**
		 * Optional function to test if rule should be run against a node, overrides Rule#matches
		 * @type {Function}
		 */
		this.matches = createExecutionContext(spec.matches);
	}
}
785598
function create(context) {
    const options = Array.isArray(context.options) ? context.options : [];
    const isPathAndPatternsObject =
        typeof options[0] === "object" &&
        (Object.prototype.hasOwnProperty.call(options[0], "paths") ||
            Object.prototype.hasOwnProperty.call(options[0], "patterns"));

    const restrictedPaths =
        (isPathAndPatternsObject ? options[0].paths : options) || [];
    const restrictedPatterns =
        (isPathAndPatternsObject ? options[0].patterns : []) || [];

    const restrictedPathMessages = restrictedPaths.reduce(
        (memo, importName) => {
            if (typeof importName === "string") {
                memo[importName] = null;
            } else {
                memo[importName.name] = importName.message;
            }
            return memo;
        },
        {}
    );

    // if no modules are restricted we don"t need to check
    if (
        Object.keys(restrictedPaths).length === 0 &&
        restrictedPatterns.length === 0
    ) {
        return {};
    }

    const ig = ignore().add(restrictedPatterns);

    /**
     * Report a restricted path.
     * @param {node} node representing the restricted path reference
     * @returns {void}
     * @private
     */
    function reportPath(node) {
        const moduleName = node.value.trim();
        const customMessage = restrictedPathMessages[moduleName];
        const message = customMessage
            ? CUSTOM_MESSAGE_TEMPLATE
            : DEFAULT_MESSAGE_TEMPLATE;

        context.report({
            node,
            message,
            data: {
                moduleName,
                customMessage
            }
        });
    }

    /**
     * Check if the given name is a restricted path name
     * @param {string} name name of a variable
     * @returns {boolean} whether the variable is a restricted path or not
     * @private
     */
    function isRestrictedPath(name) {
        return Object.prototype.hasOwnProperty.call(
            restrictedPathMessages,
            name
        );
    }

    return {
        CallExpression(node) {
            if (!isAmdDefine(node) && !isAmdRequire(node)) return;

            const paths = getDependencyStringNodes(node);

            for (let i = 0; i < paths.length; i++) {
                const nodeCurrent = paths[i];
                const moduleName = nodeCurrent.value.trim();

                // check if argument value is in restricted modules array
                if (isRestrictedPath(moduleName)) {
                    reportPath(nodeCurrent);
                }

                if (restrictedPatterns.length > 0 && ig.ignores(moduleName)) {
                    context.report({
                        node,
                        message:
                            "'{{moduleName}}' module is restricted from being used by a pattern.",
                        data: { moduleName }
                    });
                    break;
                }
            }
        }
    };
}
1202440
private final void assertIsLocPathIterator(Expression expr1, ExpressionOwner eo) 
    throws RuntimeException 
  {
		if(!(expr1 instanceof LocPathIterator))
		{
			String errMsg;
			if(expr1 instanceof Variable)
			{
				errMsg = "Programmer's assertion: expr1 not an iterator: "+
				          ((Variable)expr1).getQName();
			}
			else
			{
				errMsg = "Programmer's assertion: expr1 not an iterator: "+
				          expr1.getClass().getName();
			}
			throw new RuntimeException(errMsg + ", "+
				          eo.getClass().getName()+" "+
				          expr1.exprGetParent());
		}
  }
539145
private void cmdCreateMappingActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_cmdCreateMappingActionPerformed
		// Stop any editing action and save whatever in the text field
		if (!pnlPropertyEditorList.isEmpty() && pnlPropertyEditorList.isEditing()) {
			pnlPropertyEditorList.stopCellEditing();
		}
		try {
			// Prepare the mapping source
			String source = txtQueryEditor.getText();

			if (source.isEmpty()) {
				JOptionPane.showMessageDialog(this, "ERROR: The SQL source cannot be empty", "Error", JOptionPane.ERROR_MESSAGE);
				return;
			}
			String subjectTargetString = predicateSubjectMap.getTargetMapping();
			if(subjectTargetString.equals(":")){
				JOptionPane.showMessageDialog(this, "ERROR: Focus on URI cannot be empty", "Error", JOptionPane.ERROR_MESSAGE);
				return;
			}
			// Prepare the mapping target
			List<MapItem> predicateObjectMapsList = pnlPropertyEditorList.getPredicateObjectMapsList();
			ImmutableList<TargetAtom> target = prepareTargetQuery(predicateSubjectMap, predicateObjectMapsList);

			if (target.isEmpty()) {
				JOptionPane.showMessageDialog(this, "ERROR: The target cannot be empty. Add a class or a property", "Error", JOptionPane.ERROR_MESSAGE);
				return;
			}
			// Create the mapping axiom
			SQLPPTriplesMap mappingAxiom = new OntopNativeSQLPPTriplesMap(MAPPING_FACTORY.getSQLQuery(source), target);
			obdaModel.addTriplesMap(mappingAxiom, false);

			// Clear the form afterwards
			clearForm();
		} catch (DuplicateMappingException e) {
			DialogUtils.showQuickErrorDialog(null, e, "Duplicate mapping identification.");
			return;
		} catch (NullPointerException e) {
			DialogUtils.showQuickErrorDialog(null, new Exception("Data source has not been defined."));
			return;
		} catch (RuntimeException e) {
			DialogUtils.showQuickErrorDialog(null, e, "Empty property mapping.");
			return;
		}
	}
252416
function create(context) {
    return {
        ReturnStatement(node) {
            if (isCommonJsWrapper(nearestFunction(node).parent)) {
                context.report(node, message);
            }
        }
    };
}
1108575
function(rule, kb) {
        var mappingList = this.getMappings(rule, kb), deferred = q.defer(),
            consequences = [], consequence, causes, iterationConsequences;

        this.checkOperators(rule, mappingList);

        try {
            for (var i = 0; i < mappingList.length; i++) {
                if (mappingList[i]) {
                    // Replace mappings on all consequences
                    causes = Logics.buildCauses(mappingList[i].__facts__);
                    iterationConsequences = [];
                    for (var j = 0; j < rule.consequences.length; j++) {
                        consequence = this.substituteFactVariables(mappingList[i], rule.consequences[j], causes, rule);
                        //if (Logics.filterKnownOrAlternativeImplicitFact(consequence, kb, resolvedImplicitFacts)) {
                        consequences.push(consequence);
                        iterationConsequences.push(consequence);
                        //}
                    }
                    try {
                        Logics.addConsequences(mappingList[i].__facts__, iterationConsequences);
                    } catch(e) {
                        throw "Error when trying to add consequences on the implicit fact.";
                    }
                }
            }
            deferred.resolve(consequences);
        } catch(e) {
            deferred.reject(e);
        }

        return deferred.promise;
    }
523675
@Override
    public Vote prepare(String globalId) throws SystemException, HeuristicHazardException, HeuristicMixedException, RollbackException {

        final TransactionWrapper t = TransactionWrapper.getTransactionWrapper(globalId);

        if (t != null) {
            return t.prepare();
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "No matching TransactionWrapper: " + globalId);
            throw new SystemException();
        }
    }
41903
function processResult(loaderContext, resultPromise) {
  const { callback } = loaderContext;

  resultPromise
    .then(
      ({ css, map, imports }) => {
        imports.forEach(loaderContext.addDependency, loaderContext);
        return {
          // Removing the sourceMappingURL comment.
          // See removeSourceMappingUrl.js for the reasoning behind this.
          css: removeSourceMappingUrl(css),
          map: typeof map === 'string' ? JSON.parse(map) : map,
        };
      },
      (lessError) => {
        if (lessError.filename) {
          loaderContext.addDependency(lessError.filename);
        }
        throw formatLessError(lessError);
      }
    )
    .then(({ css, map }) => {
      callback(null, css, map);
    }, callback);
}
218303
function completeValueWithLocatedError(
  exeContext: ExecutionContext,
  returnType: GraphQLType,
  fieldNodes: Array<FieldNode>,
  info: GraphQLResolveInfo,
  path: ResponsePath,
  result: mixed,
  parentDirectiveTree: DirectiveTree,
  execDetails: ObjMap<mixed>
): mixed {
  try {
    const completed = completeValue(
      exeContext,
      returnType,
      fieldNodes,
      info,
      path,
      result,
      parentDirectiveTree,
      execDetails
    );
    const promise = getPromise(completed);
    if (promise) {
      return promise.then(
        undefined,
        error => Promise.reject(
          locatedError(error, fieldNodes, responsePathAsArray(path))
        )
      );
    }
    return completed;
  } catch (error) {
    throw locatedError(error, fieldNodes, responsePathAsArray(path));
  }
}
885016
function createContextPreExec(
    statementOptions, services, connectionConfig)
{
  // check for missing options
  Errors.checkArgumentExists(Util.exists(statementOptions),
      ErrorCodes.ERR_CONN_EXEC_STMT_MISSING_OPTIONS);

  // check for invalid options
  Errors.checkArgumentValid(Util.isObject(statementOptions),
      ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_OPTIONS);

  // check for missing sql text
  Errors.checkArgumentExists(Util.exists(statementOptions.sqlText),
      ErrorCodes.ERR_CONN_EXEC_STMT_MISSING_SQL_TEXT);

  // check for invalid sql text
  Errors.checkArgumentValid(Util.isString(statementOptions.sqlText),
      ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_SQL_TEXT);

  // check for invalid complete callback
  var complete = statementOptions.complete;
  if (Util.exists(complete))
  {
    Errors.checkArgumentValid(Util.isFunction(complete),
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_COMPLETE);
  }

  // check for invalid streamResult
  if (Util.exists(statementOptions.streamResult))
  {
    Errors.checkArgumentValid(Util.isBoolean(statementOptions.streamResult),
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_STREAM_RESULT);
  }

  // check for invalid fetchAsString
  var fetchAsString = statementOptions.fetchAsString;
  if (Util.exists(fetchAsString))
  {
    // check that the value is an array
    Errors.checkArgumentValid(Util.isArray(fetchAsString),
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_FETCH_AS_STRING);

    // check that all the array elements are valid
    var invalidValueIndex = NativeTypes.findInvalidValue(fetchAsString);
    Errors.checkArgumentValid(invalidValueIndex === -1,
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_FETCH_AS_STRING_VALUES,
        JSON.stringify(fetchAsString[invalidValueIndex]));
  }

  // if parameters are specified, make sure the specified value is an object
  if (Util.exists(statementOptions.parameters))
  {
    Errors.checkArgumentValid(Util.isObject(statementOptions.parameters),
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_PARAMETERS);
  }

  // if binds are specified
  var binds = statementOptions.binds;
  if (Util.exists(binds))
  {
    // make sure the specified value is an array
    Errors.checkArgumentValid(Util.isArray(binds),
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_BINDS);

    // make sure everything in the binds array is stringifiable
    for (var index = 0, length = binds.length; index < length; index++)
    {
      Errors.checkArgumentValid(JSON.stringify(binds[index]) !== undefined,
          ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_BIND_VALUES, binds[index]);
    }
  }

  // if an internal option is specified, make sure it's boolean
  if (Util.exists(statementOptions.internal))
  {
    Errors.checkArgumentValid(Util.isBoolean(statementOptions.internal),
        ErrorCodes.ERR_CONN_EXEC_STMT_INVALID_INTERNAL);
  }

  // create a statement context
  var statementContext = createStatementContext();

  statementContext.sqlText       = statementOptions.sqlText;
  statementContext.complete      = complete;
  statementContext.streamResult  = statementOptions.streamResult;
  statementContext.fetchAsString = statementOptions.fetchAsString;

  // if a binds array is specified, add it to the statement context
  if (Util.exists(statementOptions.binds))
  {
    statementContext.binds = statementOptions.binds;
  }

  // if parameters are specified, add them to the statement context
  if (Util.exists(statementOptions.parameters))
  {
    statementContext.parameters = statementOptions.parameters;
  }

  // if the internal flag is specified, add it to the statement context
  if (Util.exists(statementOptions.internal))
  {
    statementContext.internal = statementOptions.internal;
  }

  // validate non-user-specified arguments
  Errors.assertInternal(Util.isObject(services));
  Errors.assertInternal(Util.isObject(connectionConfig));

  // if we're not in qa mode, use a random uuid for the statement request id
  if (!connectionConfig.isQaMode())
  {
    statementContext.requestId = uuidv4();
  }
  else // we're in qa mode
  {
    // if a request id or sequence id are specified in the statement options,
    // use them as is; this is to facilitate testing by making things more
    // deterministic
    if (Util.isString(statementOptions.requestId))
    {
      statementContext.requestId = statementOptions.requestId;
    }
  }

  return statementContext;
}
101138
function(context) {
		if (this.directOutput)
			return this.directOutput(context);
		var out = "",
			odd = true,
			parts = this.parts;
		for (var j = 0, len = parts.length; j < len; ++j) {
			if (odd)
				out += parts[j];
			else {
				var r = tryExpr(parts[j].func, context);
				if (typeof r === 'undefined') {
					if (this._strict)
						return;
					out += '';
				}
				out += r;
			}
			odd = !odd;
		}
		return out;
	}
682494
function resolveExceptPrivilegeMap(deferred, map) {
    var exceptPromises = map.resolvePropertyValidity(map.except);

    $q.any(exceptPromises)
      .then(function (rejectedPermissions) {
        deferred.reject(rejectedPermissions);
      })
      .catch(function () {
        resolveOnlyPermissionMap(deferred, map);
      });
  }
607120
void reportBoundError(UndetVar uv, InferenceBound ib1, InferenceBound ib2) {
        reportInferenceError(
                String.format("incompatible.%s.%s.bounds",
                        StringUtils.toLowerCase(ib1.name()),
                        StringUtils.toLowerCase(ib2.name())),
                uv.qtype,
                uv.getBounds(ib1),
                uv.getBounds(ib2));
    }
63838
public void perform(GraphRewrite event, EvaluationContext context)
    {
        Variables variables = Variables.instance(event);
        Iterable<? extends WindupVertexFrame> frames = getSelectionManager().getFrames(event, context);

        boolean hasCommitOperation = OperationUtil.hasCommitOperation(operationPerform) || OperationUtil.hasCommitOperation(operationOtherwise);
        boolean hasIterationOperation = OperationUtil.hasIterationProgress(operationPerform)
                    || OperationUtil.hasIterationProgress(operationOtherwise);
        DefaultOperationBuilder commit = new NoOp();
        DefaultOperationBuilder iterationProgressOperation = new NoOp();

        if (!hasCommitOperation || !hasIterationOperation)
        {
            int frameCount = Iterables.size(frames);
            if (frameCount > 100)
            {
                if (!hasCommitOperation)
                    commit = Commit.every(1000);

                if (!hasIterationOperation)
                {
                    // Use 500 here as 100 might be noisy.
                    iterationProgressOperation = IterationProgress.monitoring("Rule Progress", 500);
                }
            }
        }
        Operation commitAndProgress = commit.and(iterationProgressOperation);

        event.getRewriteContext().put(DEFAULT_VARIABLE_LIST_STRING, frames); // set the current frames
        try
        {
            for (WindupVertexFrame frame : frames)
            try
            {
                variables.push();
                getPayloadManager().setCurrentPayload(variables, frame);
                boolean conditionResult = true;
                if (condition != null)
                {
                    final String payloadVariableName = getPayloadVariableName(event, context);
                    passInputVariableNameToConditionTree(condition, payloadVariableName);
                    conditionResult = condition.evaluate(event, context);
                    /*
                     * Add special clear layer for perform, because condition used one and could have added new variables. The condition result put into
                     * variables is ignored.
                     */
                    variables.push();
                    getPayloadManager().setCurrentPayload(variables, frame);
                }
                if (conditionResult)
                {
                    if (operationPerform != null)
                    {
                        operationPerform.perform(event, context);
                    }
                }
                else if (condition != null)
                {
                    if (operationOtherwise != null)
                    {
                        operationOtherwise.perform(event, context);
                    }
                }
                commitAndProgress.perform(event, context);

                getPayloadManager().removeCurrentPayload(variables);
                // remove the perform layer
                variables.pop();
                if (condition != null)
                {
                    // remove the condition layer
                    variables.pop();
                }
            }
            catch (WindupStopException ex)
            {
                throw new WindupStopException(Util.WINDUP_BRAND_NAME_ACRONYM+" stop requested in " + this.toString(), ex);
            }
            catch (Exception e)
            {
                throw new WindupException("Failed when iterating " + frame.toPrettyString() + ", due to: " + e.getMessage(), e);
            }
        }
        finally
        {
            event.getRewriteContext().put(DEFAULT_VARIABLE_LIST_STRING, null);
        }
    }
554449
function executeRelatedResultResolve (result) {
    // skip if resolve not specified
    if (!this.args.resolve) {
        return
    }
    // create new resolve instance
    var resolve = new ImmutableCoreModelResolve({
        query: this,
        result: result,
    })
    // exceute resolve
    return resolve.resolve()
}
564603
private void prepareExecutionAttempt(AsyncExecutionContextImpl<W> executionContext) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
            Tr.event(tc, "Execution {0} enqueuing new execution attempt", executionContext.getId());
        }

        AsyncAttemptContextImpl<W> attemptContext = new AsyncAttemptContextImpl<>(executionContext);

        TimeoutState timeout = FaultToleranceStateFactory.INSTANCE.createTimeoutState(executorService, timeoutPolicy, metricRecorder);
        attemptContext.setTimeoutState(timeout);

        if (!circuitBreaker.requestPermissionToExecute()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Execution {0} Circuit Breaker open, not executing", executionContext.getId());
            }

            MethodResult<W> result = MethodResult.failure(new CircuitBreakerOpenException());
            processEndOfAttempt(attemptContext, result);
            return;
        }

        attemptContext.setCircuitBreakerPermittedExecution(true);

        timeout.start();

        ExecutionReference ref = bulkhead.submit((reservation) -> runExecutionAttempt(attemptContext, reservation), getExceptionHandler(attemptContext));

        if (!ref.wasAccepted()) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "Execution {0} bulkhead rejected execution", executionContext.getId());
            }

            processEndOfAttempt(attemptContext, MethodResult.failure(new BulkheadException()));
            return;
        }

        timeout.setTimeoutCallback(handleExceptions(() -> timeout(attemptContext, ref), attemptContext, executionContext));

        // Update what we should do if the user cancels the execution
        executionContext.setCancelCallback((mayInterrupt) -> {
            ref.abort(mayInterrupt);
            processEndOfAttempt(attemptContext, MethodResult.failure(new CancellationException()));
        }
1237962
private IAsyncHandler<Throwable> createPolicyErrorHandler() {
        return error -> resultHandler.handle(AsyncResultImpl.<IEngineResult> create(error));
    }