def do_parse(infilename: str, jsonfilename: Optional[str], rdffilename: Optional[str], rdffmt: str,<EOL>context: Optional[str] = None) -> bool:
shexj = parse(FileStream(infilename, encoding="<STR_LIT:utf-8>"))<EOL>if shexj is not None:<EOL><INDENT>shexj['<STR_LIT>'] = context if context else "<STR_LIT>"<EOL>if jsonfilename:<EOL><INDENT>with open(jsonfilename, '<STR_LIT:w>') as outfile:<EOL><INDENT>outfile.write(shexj._as_json_dumps())<EOL><DEDENT><DEDENT>if rdffilename:<EOL><INDENT>g = Graph().parse(data=shexj._as_json, format="<STR_LIT>")<EOL>g.serialize(open(rdffilename, "<STR_LIT:wb>"), format=rdffmt)<EOL><DEDENT>return True<EOL><DEDENT>return False<EOL>
Parse the jsg in infilename and save the results in outfilename
:param infilename: name of the file containing the ShExC
:param jsonfilename: target ShExJ equivalent
:param rdffilename: target ShExR equivalent
:param rdffmt: target RDF format
:param context: @context to use for rdf generation. If None use what is in the file
:return: true if success