# Path: schema_salad/exceptions.py
# class SchemaException(SchemaSaladException):
#     """Indicates error with the provided schema definition."""
# 
# Path: schema_salad/utils.py
# def add_dictlist(di, key, val):  # type: (Dict[Any, Any], Any, Any) -> None
# def aslist(thing):  # type: (Any) -> MutableSequence[Any]
# def flatten(thing, ltypes=(list, tuple)):
# def onWindows():
# def convert_to_dict(j4):  # type: (Any) -> Any
# def json_dump(
#     obj,  # type: Any
#     fp,  # type: IO[str]
#     **kwargs  # type: Any
# ):  # type: (...) -> None
# def json_dumps(
#     obj,  # type: Any
#     **kwargs  # type: Any
# ):  # type: (...) -> str
# def stdout() -> BufferedWriter:
#     def construct_yaml_timestamp(self: Any, node: Any, values: Any = None) -> Any:
# def yaml_no_ts() -> YAML:
# class _RoundTripNoTimeStampConstructor(RoundTripConstructor):


import logging
import unicodedata
import rdflib
import rdflib.namespace
from typing import (
    Any,
    Dict,
    Iterable,
    List,
    MutableMapping,
    MutableSequence,
    Optional,
    Tuple,
    Union,
    cast,
)
from urllib.parse import urldefrag, urlsplit
from rdflib import Graph, URIRef
from rdflib.namespace import RDF, RDFS
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from .exceptions import SchemaException
from .utils import ContextType, aslist, json_dumps
        del context["@base"]
    else:
        defaultBase = ""

    for k, v in namespaces.items():
        g.bind(str(k), v)

    for t in j:
        process_type(t, g, context, defaultBase, namespaces, defaultPrefix)

    return (context, g)


def fix_jsonld_ids(
    obj: Union[CommentedMap, float, str, CommentedSeq], ids: List[str]
) -> None:
    if isinstance(obj, MutableMapping):
        for i in ids:
            if i in obj:
                obj["@id"] = obj[i]
        for v in obj.values():
            fix_jsonld_ids(v, ids)
    if isinstance(obj, MutableSequence):
        for entry in obj:
            fix_jsonld_ids(entry, ids)


def makerdf(
    workflow: Optional[str],
    wf: Union[CommentedMap, float, str, CommentedSeq],

# Path: schema_salad/exceptions.py
# class SchemaException(SchemaSaladException):
#     """Indicates error with the provided schema definition."""
# 
# Path: schema_salad/utils.py
# def add_dictlist(di, key, val):  # type: (Dict[Any, Any], Any, Any) -> None
# def aslist(thing):  # type: (Any) -> MutableSequence[Any]
# def flatten(thing, ltypes=(list, tuple)):
# def onWindows():
# def convert_to_dict(j4):  # type: (Any) -> Any
# def json_dump(
#     obj,  # type: Any
#     fp,  # type: IO[str]
#     **kwargs  # type: Any
# ):  # type: (...) -> None
# def json_dumps(
#     obj,  # type: Any
#     **kwargs  # type: Any
# ):  # type: (...) -> str
# def stdout() -> BufferedWriter:
#     def construct_yaml_timestamp(self: Any, node: Any, values: Any = None) -> Any:
# def yaml_no_ts() -> YAML:
# class _RoundTripNoTimeStampConstructor(RoundTripConstructor):


# Path: schema_salad/jsonld_context.py
import logging
import unicodedata
import rdflib
import rdflib.namespace
from typing import (
    Any,
    Dict,
    Iterable,
    List,
    MutableMapping,
    MutableSequence,
    Optional,
    Tuple,
    Union,
    cast,
)
from urllib.parse import urldefrag, urlsplit
from rdflib import Graph, URIRef
from rdflib.namespace import RDF, RDFS
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from .exceptions import SchemaException
from .utils import ContextType, aslist, json_dumps

        del context["@base"]
    else:
        defaultBase = ""

    for k, v in namespaces.items():
        g.bind(str(k), v)

    for t in j:
        process_type(t, g, context, defaultBase, namespaces, defaultPrefix)

    return (context, g)


def fix_jsonld_ids(
    obj: Union[CommentedMap, float, str, CommentedSeq], ids: List[str]
) -> None:
    if isinstance(obj, MutableMapping):
        for i in ids:
            if i in obj:
                obj["@id"] = obj[i]
        for v in obj.values():
            fix_jsonld_ids(v, ids)
    if isinstance(obj, MutableSequence):
        for entry in obj:
            fix_jsonld_ids(entry, ids)


def makerdf(
    workflow: Optional[str],
    wf: Union[CommentedMap, float, str, CommentedSeq],

    ctx: ContextType,