def query(ctx, input, output, context, query_file): """ Run an MQL query and store the results. """ graph = ctx.obj['GRAPH'] for uri in input: load_dump(graph, ensure_uri(uri)) if query_file is not None: query = read_yaml_uri(ensure_uri(query_file)) else: query = yaml.loads(sys.stdin) save_query_json(graph, query, output, context_id=context)
def merge(ctx, input, output): """ Combine multiple graph files. """ graph = ctx.obj['GRAPH'] for uri in input: load_dump(graph, ensure_uri(uri)) save_dump(graph, output)
def dump_json(ctx, input, types, output, depth): """ Generate JSON of registered schemas. """ graph = ctx.obj['GRAPH'] for uri in input: load_dump(graph, ensure_uri(uri)) save_json_dump(graph, output, types, depth=depth)