def dot(graph, simple=True, debug=False, landscape=False):
    """Format graph as a dot file."""
    import sys

    from rdflib import ConjunctiveGraph
    from rdflib.plugin import register, Parser
    from rdflib.tools.rdf2dot import rdf2dot

    register('json-ld', Parser, 'rdflib_jsonld.parser', 'JsonLDParser')

    g = ConjunctiveGraph().parse(
        data=_jsonld(graph, 'expand'),
        format='json-ld',
    )

    g.bind('prov', 'http://www.w3.org/ns/prov#')
    g.bind('wfdesc', 'http://purl.org/wf4ever/wfdesc#')
    g.bind('wf', 'http://www.w3.org/2005/01/wf/flow#')
    g.bind('wfprov', 'http://purl.org/wf4ever/wfprov#')

    if debug:
        rdf2dot(g, sys.stdout)
        return

    sys.stdout.write('digraph { \n node [ fontname="DejaVu Sans" ] ; \n ')
    if landscape:
        sys.stdout.write('rankdir="LR" \n')
    if simple:
        _rdf2dot_simple(g, sys.stdout)
        return
    _rdf2dot_reduced(g, sys.stdout)
def dot ( graph , simple = True , debug = False , landscape = False ) : import sys from rdflib import ConjunctiveGraph from rdflib . plugin import register , Parser from rdflib . tools . rdf2dot import rdf2dot register ( 'json-ld' , Parser , 'rdflib_jsonld.parser' , 'JsonLDParser' ) g = ConjunctiveGraph ( ) . parse ( data = _jsonld ( graph , 'expand' ) , format = 'json-ld' , ) g . bind ( 'prov' , 'http://www.w3.org/ns/prov#' ) g . bind ( 'wfdesc' , 'http://purl.org/wf4ever/wfdesc#' ) g . bind ( 'wf' , 'http://www.w3.org/2005/01/wf/flow#' ) g . bind ( 'wfprov' , 'http://purl.org/wf4ever/wfprov#' ) if debug : rdf2dot ( g , sys . stdout ) return sys . stdout . write ( 'digraph { \n node [ fontname="DejaVu Sans" ] ; \n ' ) if landscape : sys . stdout . write ( 'rankdir="LR" \n' ) if simple : _rdf2dot_simple ( g , sys . stdout ) return _rdf2dot_reduced ( g , sys . stdout )
Format graph as a dot file.