@param string|null                    $schemaName
@param array                          $request
@param array|\ArrayObject|object|null $rootValue

@return ExecutionResult
518943
public function execute(?string $schemaName = null, array $request, $rootValue = null): ExecutionResult
    {
        $executorArgumentsEvent = $this->preExecute(
            $this->getSchema($schemaName),
            $request[ParserInterface::PARAM_QUERY] ?? null,
            new \ArrayObject(),
            $rootValue,
            $request[ParserInterface::PARAM_VARIABLES],
            $request[ParserInterface::PARAM_OPERATION_NAME] ?? null
        );

        $executorArgumentsEvent->getSchema()->processExtensions();

        $result = $this->executor->execute(
            $executorArgumentsEvent->getSchema(),
            $executorArgumentsEvent->getRequestString(),
            $executorArgumentsEvent->getRootValue(),
            $executorArgumentsEvent->getContextValue(),
            $executorArgumentsEvent->getVariableValue(),
            $executorArgumentsEvent->getOperationName()
        );

        $result = $this->postExecute($result);

        return $result;
    }
231491
function (namespace, schemaContent, cb) {
    var self = this;

    if (multivalue.hasValue(self.parsedSchemas, namespace, schemaContent)) {
      cb(null, {});
      return;
    }

    xml2js.parseString(schemaContent, function (err, result) {
      if (err) {
        cb(err);
        return;
      }

      // Only one root element expected
      if (!result || _.size(result) !== 1) {
        cb("Invalid schema for " + namespace + ": " + util.inspect(result, false, null));
        return;
      }

      parseNamespacePrefixes(result, function (err, defaultNamespace, namespaces, xsPrefix) {
        if (err) {
          cb(err);
          return;
        }

        assert(result[xsPrefix + 'schema'], result);

        var schema = result[xsPrefix + 'schema'];

        if (schema.$ && schema.$.targetNamespace && schema.$.targetNamespace !== namespace) {
          cb("Schema does not have expected target namespace " + namespace + ": " + util.inspect(result, false, null));
          return;
        }

        var schemaParser = new XsdSchema(self, namespace, defaultNamespace, namespaces, xsPrefix);

        var importsAndIncludes = schemaParser.parseImportsAndIncludes(namespace, schema);

        var newElements = schemaParser.parseElements(schema, null);
        // TODO: Check if we are overriding anything
        _.extend(self.elements, newElements);

        var newAttributes = schemaParser.parseAttributes(schema);
        // TODO: Check if we are overriding anything
        _.extend(self.attributes, newAttributes);

        var newTypes = schemaParser.parseTypes(schema);
        // TODO: Check if we are overriding anything
        _.extend(self.types, newTypes);

        // TODO: Add support for element and attribute groups
        delete schema[xsPrefix + 'group'];
        delete schema[xsPrefix + 'attributeGroup'];

        // Previous parsing calls are destructive and should consume schema so that it is empty now
        assert(_.isEmpty(schema), schema);

        multivalue.addValue(self.parsedSchemas, namespace, schemaContent);

        cb(null, importsAndIncludes);
      });
    });
  }
1127181
public function schema($key = null, $value = null)
    {
        $numArgs = func_num_args();
        if (0 === $numArgs) {
            return $this->schema;
        } elseif (1 === $numArgs) {
            if (is_array($key)) {
                $this->schema = new NObject($key);
            } elseif ($this->schema->offsetExists($key)) {
                return $this->schema[$key];
            }
        } else {
            $this->schema[$key] = $value;
        }
    }
625645
protected function validateProperties($entity, $schema, $entityName)
    {
        $properties = get_object_vars($entity);

        if (!isset($schema->properties)) {
        	return $this;
            //throw new SchemaException(sprintf('No properties defined for [%s]', $entityName));
        }

        // Check defined properties
        foreach($schema->properties as $propertyName => $property) {
            if (array_key_exists($propertyName, $properties)) {
                // Check type
                $path = $entityName . '.' . $propertyName;
                $this->validateType($entity->{$propertyName}, $property, $path);
            } else {
                // Check required
                if (isset($property->required) && $property->required) {
                    throw new ValidationException(sprintf('Missing required property [%s] for [%s]', $propertyName, $entityName));
                }
            }
        }

        // Check additional properties
        if (isset($schema->additionalProperties) && !$schema->additionalProperties) {
            $extra = array_diff(array_keys((array)$entity), array_keys((array)$schema->properties));
            if (count($extra)) {
                throw new ValidationException(sprintf('Additional properties [%s] not allowed for property [%s]', implode(',', $extra), $entityName));
            }
        }

        return $this;
    }
365034
protected function getOperationType(Schema $schema, OperationDefinitionNode $operation): ?ObjectType
    {
        switch ($operation->getOperation()) {
            case 'query':
                return $schema->getQueryType();
            case 'mutation':
                $mutationType = $schema->getMutationType();

                if (null === $mutationType) {
                    throw new ExecutionException('Schema is not configured for mutations.', [$operation]);
                }

                return $mutationType;
            case 'subscription':
                $subscriptionType = $schema->getSubscriptionType();

                if (null === $subscriptionType) {
                    throw new ExecutionException('Schema is not configured for subscriptions.', [$operation]);
                }

                return $subscriptionType;
            default:
                throw new ExecutionException('Can only execute queries, mutations and subscriptions.', [$operation]);
        }
    }
183641
public function extractDefault(ColumnSchema $field, $defaultValue)
    {
        if (strncmp($field->dbType, 'bit', 3) === 0) {
            $field->defaultValue = bindec(trim($defaultValue, 'b\''));
        } else {
            parent::extractDefault($field, $defaultValue);
        }
    }
1178796
public function setSchemaName($schemaName)
    {
        if (trim($schemaName) == '') {
            $schemaName = null;
        }
        $this->schemaName = $schemaName;

        return $this;
    }
489725
public function validateJson(string $json, string $schemaName): ValidationResult
    {
        $schemaDir = $this->config->get('schema-dir');
        $schemaPath = $this->configDirectoryPath.$schemaDir.'/'.$schemaName.'.json';
        if(!file_exists($schemaPath)){
            throw new FileNotFoundException("File $schemaPath not found");
        }
        
        $schemaJsonString = file_get_contents($schemaPath);
        $decodedJson = json_decode($json);
        if ($decodedJson === false) {
            $schema = json_decode($schemaJsonString);
            // error decoding json
            return (new ValidationResult())
                ->addError(new ValidationError($json,
                        [],
                        [],
                        $schema,
                        "Failed to decode JSON string")
                );
        }
        return $this->dataValidation($decodedJson, $schemaJsonString);
    }
1241520
public function export($schemaName = null)
    {
        $dump = [];
        $sql  =
            "SELECT type, name, sql
            FROM sqlite_master
            WHERE type != 'index' AND name != 'sqlite_sequence'
            ORDER BY type";
        
        $rows = $this->connection->selectAll($sql);
        foreach ($rows as $row) {
            $dump[] = preg_replace('/\v/', ' ', $row['sql']);
        }
        
        return implode(";\n\n", $dump) . ";\n";
    }
532397
public static function defaultFieldResolver($rootValue, array $arguments, $contextValues, ResolveInfo $info)
    {
        $fieldName = $info->getFieldName();
        $property  = null;

        if (\is_array($rootValue) && isset($rootValue[$fieldName])) {
            $property = $rootValue[$fieldName];
        }

        if (\is_object($rootValue)) {
            $getter = 'get' . \ucfirst($fieldName);
            if (\method_exists($rootValue, $getter)) {
                $property = $rootValue->{$getter}();
            } elseif (\method_exists($rootValue, $fieldName)) {
                $property = $rootValue->{$fieldName}($rootValue, $arguments, $contextValues, $info);
            } elseif (\property_exists($rootValue, $fieldName)) {
                $property = $rootValue->{$fieldName};
            }
        }

        return $property instanceof \Closure
            ? $property($rootValue, $arguments, $contextValues, $info)
            : $property;
    }
839092
public function endpointAction(Request $request, string $schemaName = null)
    {
        return $this->createResponse($request, $schemaName, false);
    }
471128
public function remoteEditFormSchema(HTTPRequest $request)
    {
        $schemaID = $request->getURL();
        try {
            $form = $this->remoteEditForm();
            return $this->getSchemaResponse($schemaID, $form);
        } catch (InvalidUrlException $exception) {
            $errors = ValidationResult::create()
                ->addError($exception->getMessage());
            // @todo - Don't create dummy form (pass $form = null)
            $form = Form::create(null, 'Form', FieldList::create(), FieldList::create());
            $code = $exception->getCode();

            if ($code < 300) {
                $code = 500;
            }

            return $this
                ->getSchemaResponse($schemaID, $form, $errors)
                ->setStatusCode($code);
        }
    }
964922
public function parser(string $className, $objectAnnotation = null, string $propertyName = "", string $methodName = "", $propertyValue = null)
    {
        $injectValue = $objectAnnotation->getName();
        $envValue    = $objectAnnotation->getEnv();
        if (empty($injectValue) && empty($envValue)) {
            throw new \InvalidArgumentException("the name and env of @Value can't be empty! class={$className} property={$propertyName}");
        }

        $isRef          = false;
        $injectProperty = null;
        if (!empty($injectValue)) {
            list($injectProperty, $isRef) = $this->annotationResource->getTransferProperty($injectValue);
        }

        if (!empty($envValue)) {
            $value          = $this->getEnvValue($envValue);
            $isArray        = $this->isEnvArrayValue($className, $propertyName);
            $value          = $this->getTransferEnvValue($value, $isArray);
            $injectProperty = ($value !== null) ? $value : $injectProperty;
            $isRef          = ($value !== null) ? false : $isRef;
        }

        return [$injectProperty, $isRef];
    }
1011341
SchemaProperty createDatabaseSchema(final App app, final AbstractSchemaNode schemaNode) throws FrameworkException {

		final PropertyMap getOrCreateProperties = new PropertyMap();
		final PropertyMap updateProperties      = new PropertyMap();

		getOrCreateProperties.put(SchemaProperty.name, getName());
		getOrCreateProperties.put(SchemaProperty.schemaNode, schemaNode);

		SchemaProperty property = app.nodeQuery(SchemaProperty.class).and(getOrCreateProperties).getFirst();
		if (property == null) {

			getOrCreateProperties.put(SchemaProperty.compound, isCompoundUnique());
			getOrCreateProperties.put(SchemaProperty.unique, isUnique());
			getOrCreateProperties.put(SchemaProperty.indexed, isIndexed());
			getOrCreateProperties.put(SchemaProperty.notNull, isRequired());
			getOrCreateProperties.put(SchemaProperty.readOnly, isReadOnly());
			getOrCreateProperties.put(SchemaProperty.format, getFormat());
			getOrCreateProperties.put(SchemaProperty.hint, getHint());
			getOrCreateProperties.put(SchemaProperty.category, getCategory());
			getOrCreateProperties.put(SchemaProperty.validators, validators.toArray(new String[0]));
			getOrCreateProperties.put(SchemaProperty.transformers, transformers.toArray(new String[0]));
			getOrCreateProperties.put(SchemaProperty.defaultValue, defaultValue);

			property = app.create(SchemaProperty.class, getOrCreateProperties);
		}

		if (parent != null) {

			final JsonSchema root = parent.getSchema();
			if (root != null) {

				if (SchemaService.DynamicSchemaRootURI.equals(root.getId())) {

					updateProperties.put(SchemaProperty.isPartOfBuiltInSchema, true);
				}
			}
		}

		// update properties
		property.setProperties(SecurityContext.getSuperUserInstance(), updateProperties);

		// return modified property
		return property;
	}
1003127
protected function queryColumns ($queryType, $queryValues, $valueType, $keyValue = false, $ignoreNull = false) {
        $target_columns = array();

        if($queryType === "col_list") {
            // The caller has already specified a list of columns
            $target_columns = $queryValues;
        }
        else {
            /**
             * @var  $key
             * @var SQLColumn $col
             */
            foreach($this->columns as $key => $col) {
                if($queryType === "category") {
                    if(in_array($col->category, $queryValues)) {
                        $target_columns []= $key;
                    }
                }
                else if ($queryType === "all") {
                    $target_columns []= $key;
                }
            }
        }

        $results = array();

        foreach($target_columns as $colKey) {
            /**
             * @var $column SQLColumn
             */
            $column = $this->columns[$colKey];
            $resultItem = null;
            switch($valueType) {
                case "id":
                    $resultItem = $colKey;
                    break;
                case "expr":
                    $resultItem = $column->getExpr();
                    break;
                case "exprAs":
                    $resultItem = $column->getExprAs();
                    break;
                case "object":
                    $resultItem = $column;
                    break;
                case "schema":
                    $resultItem = $column->getSchema();
                    break;
                case "summary":
                    $resultItem = $column->getSummaryConfig();
                    break;
                default:
                    //TODO: Throw library-specific exceptions
                    throw new \Exception("Unknown value type $valueType");
            }

            if(is_null($resultItem) && $ignoreNull) {
                continue;
            }

            if($keyValue) {
                $results[$colKey] = $resultItem;
            }
            else {
                $results []= $resultItem;
            }
        }

        return $results;
    }
744487
private String processSchemaName(String dbProductName, String userName, String schemaName) {
        String result = null;

        if (schemaName != null) {
            result = schemaName.toUpperCase();
        } else {
            if ("DB2".equals(dbProductName) == true || "Apache Derby".equals(dbProductName) == true || "Oracle".equals(dbProductName) == true) {
                if (userName != null) {
                    result = userName.toUpperCase();
                }
            } else if ("PostgreSQL".equals(dbProductName) == true) {
                // for PostgreSQL - if no schema specified - public should be used
                result = "public";
            }
        }

        return result;
    }
1043121
public function find($documentName, $hashValue, $rangeValue = null)
    {
        return $this->getRepository($documentName)->find($hashValue, $rangeValue);
    }