from typing import Tuple
from typing import List
from typing import Dict


def selection(triple: Tuple[str, str, str], variables: List[str]) -> Dict[str, str]:
    """Apply a selection on a RDF triple, producing a set of solution mappings.

    Args:
      * triple: RDF triple on which the selection is applied.
      * variables: Input variables of the selection.

    Returns:
      A set of solution mappings built from the selection results.

    Example:
      >>> triple = (":Ann", "foaf:knows", ":Bob")
      >>> variables = ["?s", None, "?knows"]
      >>> selection(triple, variables)
      { "?s": ":Ann", "?knows": ":Bob" }
    """
    bindings = dict()
    if variables[0] is not None:
        bindings[variables[0]] = triple[0]
    if variables[1] is not None:
        bindings[variables[1]] = triple[1]
    if variables[2] is not None:
        bindings[variables[2]] = triple[2]
    return bindings