===================================================== =================================== get GraphQL Value =====================================================
167258
function getGraphQLValue(value) {
      if ("string" === typeof value) {
        value = JSON.stringify(value);
      } else if (Array.isArray(value)) {
        value = value.map(item => {
            return getGraphQLValue(item);
            }).join();
        value = `[${value}]`;
      } else if ("object" === typeof value) {
      /*if (value.toSource)
            value = value.toSource().slice(2,-2);
        else*/
            value = objectToString(value);
            //console.error("No toSource!!",value);
      }
      return value;
}
124610
def get_graph(graph=None, *, _limit=(), _print=()):
    
    graph = graph or bonobo.Graph()

    producer = (
        graph.get_cursor()
        >> ODSReader(dataset="liste-des-cafes-a-un-euro", netloc="opendata.paris.fr")
        >> PartialGraph(*_limit)
        >> bonobo.UnpackItems(0)
        >> bonobo.Rename(name="nom_du_cafe", address="adresse", zipcode="arrondissement")
        >> bonobo.Format(city="Paris", country="France")
        >> bonobo.OrderFields(["name", "address", "zipcode", "city", "country", "geometry", "geoloc"])
        >> PartialGraph(*_print)
    )

    # Comma separated values.
    graph.get_cursor(producer.output) >> bonobo.CsvWriter(
        "coffeeshops.csv", fields=["name", "address", "zipcode", "city"], delimiter=","
    )

    # Standard JSON
    graph.get_cursor(producer.output) >> bonobo.JsonWriter(path="coffeeshops.json")

    # Line-delimited JSON
    graph.get_cursor(producer.output) >> bonobo.LdjsonWriter(path="coffeeshops.ldjson")

    return graph
26458
function jql(queryChunks, ...injects) {
    try {
        let res = '';


        for (let i = 0; i < injects.length; i++) {

            let value = injects[i];
            let q = queryChunks[i];

            if (typeof value === 'string') {
                //make string value safe

                value = cleanString(value);
            }
            else if (Array.isArray(value)) {

                //We do not support nested arrays or objects
                value = value.map((it) => {
                    if (Array.isArray(it))
                        throw new Error('JQL: Nested arrays not supported . Consider using a nativeFunction for that query instead.')

                    if (typeof it === 'string') {
                        //make string value safe

                        it = cleanString(it);
                    }

                    return it;
                })

                value = "(" + value.join(', ') + ")";
            }

            res += q + value;

        }

        res += queryChunks[queryChunks.length - 1];

        //console.log('query:', res);

        return res;
    } catch (err) {
        throw new Boom.badRequest('Bad JQL:', err)
    }
}
180579
function getValidGraphQLTag(path: any): ?DocumentNode {
  const tag = path.get('tag');

  if (!tag.isIdentifier({name: 'graphql'})) {
    return null;
  }

  const quasis = path.node.quasi.quasis;

  if (quasis.length !== 1) {
    throw new Error(
      'BabelPluginRelay: Substitutions are not allowed in graphql fragments. ' +
        'Included fragments should be referenced as `...MyModule_propName`.',
    );
  }

  const text = quasis[0].value.raw;

  const ast = GraphQL.parse(text);

  if (ast.definitions.length === 0) {
    throw new Error('BabelPluginRelay: Unexpected empty graphql tag.');
  }

  return ast;
}
1001242
function parseFind(_levelA) {
    // +++++++++++++++++++++++++++++++++++ work over Array
    // ++++++++++++++++++++++++++++++++++++++++++++++++++++
    return _levelA.map(function (currentValue) {
        if (currentValue instanceof Query) {
            return currentValue.toString();
        }
        else if (!Array.isArray(currentValue) && 'object' === typeof currentValue) {
            var propsA = Object.keys(currentValue);
            if (1 !== propsA.length) {
                throw new RangeError('Alias objects should only have one value. was passed: ' +
                    JSON.stringify(currentValue));
            }
            var propS = propsA[0];
            var item = currentValue[propS];
            // tslint:disable-next-line
            // contributor: https://github.com/charlierudolph/graphql-query-builder/commit/878328e857e92d140f5ba6f7cfe07837620ec490
            if (Array.isArray(item)) {
                return new Query(propS).find(item);
            }
            return propS + " : " + item + " ";
        }
        else if ('string' === typeof currentValue) {
            return currentValue;
        }
        else {
            throw new RangeError('cannot handle Find value of ' + currentValue);
        }
    }).join(',');
}
146122
def complete_list_value(
        self,
        return_type: GraphQLList[GraphQLOutputType],
        field_nodes: List[FieldNode],
        info: GraphQLResolveInfo,
        path: ResponsePath,
        result: Iterable[Any],
    ) -> AwaitableOrValue[Any]:
        
        if not isinstance(result, Iterable) or isinstance(result, str):
            raise TypeError(
                "Expected Iterable, but did not find one for field"
                f" {info.parent_type.name}.{info.field_name}."
            )

        # This is specified as a simple map, however we're optimizing the path where
        # the list contains no coroutine objects by avoiding creating another coroutine
        # object.
        item_type = return_type.of_type
        awaitable_indices: List[int] = []
        append_awaitable = awaitable_indices.append
        completed_results: List[Any] = []
        append_result = completed_results.append
        for index, item in enumerate(result):
            # No need to modify the info object containing the path, since from here on
            # it is not ever accessed by resolver functions.
            field_path = add_path(path, index)
            completed_item = self.complete_value_catching_error(
                item_type, field_nodes, info, field_path, item
            )

            if isawaitable(completed_item):
                append_awaitable(index)
            append_result(completed_item)

        if not awaitable_indices:
            return completed_results

        # noinspection PyShadowingNames
        async def get_completed_results():
            for index, result in zip(
                awaitable_indices,
                await gather(
                    *(completed_results[index] for index in awaitable_indices)
                ),
            ):
                completed_results[index] = result
            return completed_results

        return get_completed_results()
340030
public static List<GraphQLArgument> getGraphQLArgumentsForType(final Type type) {

		final List<GraphQLArgument> arguments = new LinkedList<>();

		switch (type) {

			case String:
				arguments.add(GraphQLArgument.newArgument().name("_equals").type(Scalars.GraphQLString).build());
				arguments.add(GraphQLArgument.newArgument().name("_contains").type(Scalars.GraphQLString).build());
				arguments.add(GraphQLArgument.newArgument().name("_conj").type(Scalars.GraphQLString).build());
				break;

			case Integer:
				arguments.add(GraphQLArgument.newArgument().name("_equals").type(Scalars.GraphQLInt).build());
				arguments.add(GraphQLArgument.newArgument().name("_conj").type(Scalars.GraphQLString).build());
				break;

			case Long:
				arguments.add(GraphQLArgument.newArgument().name("_equals").type(Scalars.GraphQLLong).build());
				arguments.add(GraphQLArgument.newArgument().name("_conj").type(Scalars.GraphQLString).build());
				break;
		}

		return arguments;
	}
670574
function getTypeInfo (obj, info) {
  const constructorName = _.constructorName(obj)
  const _info = info || {
    type: null,
    name: null,
    isList: false,
    isNonNull: false
  }

  switch (constructorName) {
    case 'GraphQLNonNull':
      _info.isNonNull = true
      return getTypeInfo(obj.ofType, _info)
    case 'GraphQLList':
      _info.isList = true
      return getTypeInfo(obj.ofType, _info)
    default:
      _info.type = obj
      _info.name = obj.name
  }
  return _info
}
139157
function instrumentSchemaForExpressGraphQL(schema) {
  addTracingToResolvers(schema);
  addSchemaLevelResolveFunction(schema, (root, args, ctx, info) => {
    const operation = print(info.operation);
    const fragments = Object.keys(info.fragments).map(k => print(info.fragments[k])).join('\n');

    ctx.tracer.log('request.query', `${operation}\n${fragments}`);
    ctx.tracer.log('request.variables', info.variableValues);
    ctx.tracer.log('request.operationName', info.operation.name);
    return root;
  });
}
1364215
def print_value(value: Any, type_: GraphQLInputType) -> str:
    """"""
    return print_ast(ast_from_value(value, type_))
1343841
def graph_val_dump(self):
        """"""
        self._flush_graph_val()
        for (graph, key, branch, turn, tick, value) in self.sql('graph_val_dump'):
            yield (
                self.unpack(graph),
                self.unpack(key),
                branch,
                turn,
                tick,
                self.unpack(value)
            )
985198
function isGraphQL(path) {
  const node = path.getValue();
  const parent = path.getParentNode();

  return (
    hasLanguageComment(node, "GraphQL") ||
    (parent &&
      ((parent.type === "TaggedTemplateExpression" &&
        ((parent.tag.type === "MemberExpression" &&
          parent.tag.object.name === "graphql" &&
          parent.tag.property.name === "experimental") ||
          (parent.tag.type === "Identifier" &&
            (parent.tag.name === "gql" || parent.tag.name === "graphql")))) ||
        (parent.type === "CallExpression" &&
          parent.callee.type === "Identifier" &&
          parent.callee.name === "graphql")))
  );
}
24482
function(options) {
    options = options || {}
    var exclude = options.exclude || []
    var schema = []
    var query = []
    var mutation = []

    Object.keys(this.models).forEach(function(modelName) {
      var model = this.models[modelName]
      var definition = model.definition

      if (definition.graphqlHelper.hidden) return // via this.graphQLExclude()
      if (exclude.indexOf(modelName) !== -1) return

      schema.push(model.toGraphQLType())
      schema.push.apply(schema, definition.graphqlHelper.schema)

      query.push.apply(query, definition.graphqlHelper.query)
      mutation.push.apply(mutation, definition.graphqlHelper.mutation)
    }, this)

    if (query.length > 0) {
      schema.push(
        [
          'type Query{',
          query
            .map(function(str) {
              return '  ' + str
            })
            .join('\n'),
          '}'
        ].join('\n')
      )
    }

    if (mutation.length > 0) {
      schema.push(
        [
          'type Mutation{',
          mutation
            .map(function(str) {
              return '  ' + str
            })
            .join('\n'),
          '}'
        ].join('\n')
      )
    }

    return schema.join('\n\n')
  }
980046
def graphql_request_create(self, data, **kwargs):
        ""
        api_path = "/graphql/request"
        return self.call(api_path, method="POST", data=data, **kwargs)
1003484
function (graph, opts, params) {
    var self = this;
    var updatedNodes = graph.allNodes;
    if (opts.restrictToComp) {
      updatedNodes = graph.allNodes.filter(function(node) {
        return node.comp && node.comp.name == opts.restrictToComp;
      });
    }

    function assign(statements, varName, hash) {
      params[varName] = hash;
      if (opts.additive) {
        _.forEach(hash, function(val, key) {
          statements.push(varName + '.`' + key + '`={' + varName + '}.`' + key + '`');
        });
      } else {
        statements.push(varName + '={' + varName + '}');
      }
    }

    return 'SET ' + updatedNodes.reduce(function(statements, node) {
      // set props
      var props = node.props;
      if (props[self.db.options.id]) props = _.omit(props, self.db.options.id);
      
      if (node.comp) assign(statements, '__rel_' + node.name, props._rel || {});
      
      props = _.omit(props, '_rel');
      assign(statements, node.name, props);

      // set timestamps
      if (!node.model.usingTimestamps) return statements;
      statements.push(getSetCreatedTimestampStatement(node));
      statements.push(node.name + '.' + node.model.updatedField + ' = timestamp()');

      return statements;
    }, []).join(',');
  }
199339
def _query(_node_id, value=None, **kw):
    ""
    query_result = []
    try:
        query_result = db.execute(text(fetch_query_string('select_query_from_node.sql')), **kw).fetchall()
    except DatabaseError as err:
        current_app.logger.error("DatabaseError: %s, %s", err, kw)
        return value
    #current_app.logger.debug("queries kw: %s", kw)
    #current_app.logger.debug("queries value: %s", value)
    current_app.logger.debug("queries: %s", query_result)
    if query_result:
        values = []
        for query_name in [x['name'] for x in query_result]:
            if query_name:
                result = []
                try:
                    current_app.logger.debug("query_name: %s", query_name)
                    #current_app.logger.debug("kw: %s", kw)
                    # Query string can be insert or select here
                    #statement = text(fetch_query_string(query_name))
                    #params = [x.key for x in statement.params().get_children()]
                    #skw = {key: kw[key] for key in params}
                    #result = db.execute(statement, **skw)
                    result = db.execute(text(fetch_query_string(query_name)), **kw)
                    current_app.logger.debug("result query: %s", result.keys())
                except (DatabaseError, StatementError) as err:
                    current_app.logger.error("DatabaseError (%s) %s: %s", query_name, kw, err)
                if result and result.returns_rows:
                    result = result.fetchall()
                    #values.append(([[dict(zip(result.keys(), x)) for x in result]], result.keys()))
                    #values.append((result.fetchall(), result.keys()))
                    #current_app.logger.debug("fetchall: %s", values)
                    if len(result) == 0:
                        values.append(([], []))
                    else:
                        current_app.logger.debug("result: %s", result)
                        # There may be more results, but only interested in the
                        # first one. Use the older rowify method for now.
                        # TODO: use case for rowify?
                        values.append(rowify(result, [(x, None) for x in result[0].keys()]))
                        #current_app.logger.debug("fetchone: %s", values)
        value = values
    #current_app.logger.debug("value: %s", value)
    return value
1344855
private OntModel getGraphSparqlQuery(URI graphUri) {

        StringBuilder queryStr = new StringBuilder("CONSTRUCT { ?s ?p ?o } \n")
                .append("WHERE {\n");

        // Add named graph if necessary
        if (graphUri != null) {
            queryStr.append("GRAPH <").append(graphUri.toASCIIString()).append("> ");
        }
        queryStr.append("{ ?s ?p ?o } } \n");

        log.debug("Querying graph store: {}", queryStr.toString());

        Query query = QueryFactory.create(queryStr.toString());
        QueryExecution qe = QueryExecutionFactory.sparqlService(this.getSparqlQueryEndpoint().toASCIIString(), query);
        MonitoredQueryExecution qexec = new MonitoredQueryExecution(qe);
        // Note that we are not using the store specification here to avoid retrieving remote models
//        OntModel resultModel = ModelFactory.createOntologyModel();
        OntModel resultModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF);
        try {
            qexec.execConstruct(resultModel);
            return resultModel;
        } finally {
            qexec.close();
        }
    }