pyshacl/rdfutil/clone.py
def mix_graphs(base_graph: GraphLike, extra_graph: GraphLike, target_graph: Optional[Union[GraphLike, str]] = None):
    """
    Make a clone of base_graph and add in the triples from extra_graph
    :param base_graph:
    :type base_graph: rdflib.Graph
    :param extra_graph:
    :type extra_graph: rdflib.Graph
    :param target_graph:
    :type target_graph: rdflib.Graph|str|NoneType
    :return: The cloned graph with mixed in triples from extra_graph
    :rtype: rdflib.Graph
    """
    if isinstance(base_graph, (rdflib.ConjunctiveGraph, rdflib.Dataset)) and isinstance(
        target_graph, (rdflib.ConjunctiveGraph, rdflib.Dataset)
    ):
        return mix_datasets(base_graph, extra_graph, target_ds=target_graph)
    if target_graph is None:
        g = clone_graph(base_graph, target_graph=None, identifier=base_graph.identifier)
    elif target_graph == "inplace":
        # Special case, don't clone the basegraph, just put extra straight in
        g = base_graph
    elif isinstance(target_graph, str):
        raise RuntimeError("target_graph cannot be a string (unless it is 'inplace')")
    else:
        g = clone_graph(base_graph, target_graph=target_graph)
    g = clone_graph(extra_graph, target_graph=g)
    return g

    Make a clone of base_graph and add in the triples from extra_graph
    :param base_graph:
    :type base_graph: rdflib.Graph
    :param extra_graph:
    :type extra_graph: rdflib.Graph
    :param target_graph:
    :type target_graph: rdflib.Graph|str|NoneType
    :return: The cloned graph with mixed in triples from extra_graph
    :rtype: rdflib.Graph
    
Make a clone of base_graph and add in the triples from extra_graph
Make a clone of base_graph and add in the triples from extra_graph
def mix_graphs(base_graph: GraphLike, extra_graph: GraphLike, target_graph: Optional[Union[GraphLike, str]] = None):
    if isinstance(base_graph, (rdflib.ConjunctiveGraph, rdflib.Dataset)) and isinstance(
        target_graph, (rdflib.ConjunctiveGraph, rdflib.Dataset)
    ):
        return mix_datasets(base_graph, extra_graph, target_ds=target_graph)
    if target_graph is None:
        g = clone_graph(base_graph, target_graph=None, identifier=base_graph.identifier)
    elif target_graph == "inplace":
        g = base_graph
    elif isinstance(target_graph, str):
        raise RuntimeError("target_graph cannot be a string (unless it is 'inplace')")
    else:
        g = clone_graph(base_graph, target_graph=target_graph)
    g = clone_graph(extra_graph, target_graph=g)
    return g
def mix_graphs ( base_graph : GraphLike , extra_graph : GraphLike , target_graph : Optional [ Union [ GraphLike , str ] ] = None ) : if isinstance ( base_graph , ( rdflib . ConjunctiveGraph , rdflib . Dataset ) ) and isinstance ( target_graph , ( rdflib . ConjunctiveGraph , rdflib . Dataset ) ) : return mix_datasets ( base_graph , extra_graph , target_ds = target_graph ) if target_graph is None : g = clone_graph ( base_graph , target_graph = None , identifier = base_graph . identifier ) elif target_graph == "inplace" : g = base_graph elif isinstance ( target_graph , str ) : raise RuntimeError ( "target_graph cannot be a string (unless it is 'inplace')" ) else : g = clone_graph ( base_graph , target_graph = target_graph ) g = clone_graph ( extra_graph , target_graph = g ) return g
Make a clone of base_graph and add in the triples from extra_graph
Make a clone of base_graph and add in the triples from extra_graph
"""
    Make a clone of base_graph and add in the triples from extra_graph
    :param base_graph:
    :type base_graph: rdflib.Graph
    :param extra_graph:
    :type extra_graph: rdflib.Graph
    :param target_graph:
    :type target_graph: rdflib.Graph|str|NoneType
    :return: The cloned graph with mixed in triples from extra_graph
    :rtype: rdflib.Graph
    """ # Special case, don't clone the basegraph, just put extra straight in
The cloned graph with mixed in triples from extra_graph
The cloned graph with mixed in triples from extra_graph
rdflib.Graph
base_graph
GraphLike
None
extra_graph
GraphLike
None
target_graph
Optional[Union[GraphLike, str]]
None