def _rdf2dot_simple(g, stream):
    """Create a simple graph of processes and artifacts."""
    from itertools import chain
    import re
    path_re = re.compile(
        '(?P<prefix>https://\\w+/|https://\\w+/\\w+/){0,1}(?P<type>[a-zA-Z]+)/(?P<commit>\\w+)(?P<path>.+)?'
        )
    inputs = g.query(
        """
        SELECT ?input ?role ?activity ?comment
        WHERE {
            ?activity (prov:qualifiedUsage/prov:entity) ?input .
            ?activity prov:qualifiedUsage ?qual .
            ?qual prov:hadRole ?role .
            ?qual prov:entity ?input .
            ?qual rdf:type ?type .
            ?activity rdf:type wfprov:ProcessRun .
            ?activity rdfs:comment ?comment .
            FILTER NOT EXISTS {?activity rdf:type wfprov:WorkflowRun}
        }
        """
        )
    outputs = g.query(
        """
        SELECT ?activity ?role ?output ?comment
        WHERE {
            ?output (prov:qualifiedGeneration/prov:activity) ?activity .
            ?output prov:qualifiedGeneration ?qual .
            ?qual prov:hadRole ?role .
            ?qual prov:activity ?activity .
            ?qual rdf:type ?type .
            ?activity rdf:type wfprov:ProcessRun ;
                      rdfs:comment ?comment .
            FILTER NOT EXISTS {?activity rdf:type wfprov:WorkflowRun}
        }
        """
        )
    activity_nodes = {}
    artifact_nodes = {}
    for source, role, target, comment in chain(inputs, outputs):
        src_path = path_re.match(source).groupdict()
        tgt_path = path_re.match(target).groupdict()
        stream.write(
            '\t"{src_commit}:{src_path}" -> "{tgt_commit}:{tgt_path}" [label={role}] \n'
            .format(src_commit=src_path['commit'][:5], src_path=src_path.
            get('path') or '', tgt_commit=tgt_path['commit'][:5], tgt_path=
            tgt_path.get('path') or '', role=role))
        if src_path.get('type') == 'commit':
            activity_nodes.setdefault(source, {'comment': comment})
            artifact_nodes.setdefault(target, {})
        if tgt_path.get('type') == 'commit':
            activity_nodes.setdefault(target, {'comment': comment})
            artifact_nodes.setdefault(source, {})
    for node, content in activity_nodes.items():
        node_path = path_re.match(node).groupdict()
        stream.write(
            '\t"{commit}:{path}" [shape=box label="#{commit}:{path}:{comment}"] \n'
            .format(comment=content['comment'], commit=node_path['commit'][
            :5], path=node_path.get('path') or ''))
    for node, content in artifact_nodes.items():
        node_path = path_re.match(node).groupdict()
        stream.write('\t"{commit}:{path}" [label="#{commit}:{path}"] \n'.
            format(commit=node_path['commit'][:5], path=node_path.get(
            'path') or ''))
    stream.write('}\n')
