RDF.PrefixMap.merge

You're seeing just the function merge, go back to RDF.PrefixMap module for more information.
Link to this function

merge(prefix_map1, prefix_map2)

View Source

Specs

merge(t(), t() | map() | keyword()) ::
  {:ok, t()} | {:error, [atom() | String.t()]}

Merges two RDF.PrefixMaps.

The second prefix map can also be given as any structure which can converted to a RDF.PrefixMap via new/1.

If the prefix maps can be merged without conflicts, that is there are no prefixes mapped to different namespaces an :ok tuple is returned. Otherwise an :error tuple with the list of prefixes with conflicting namespaces is returned.

See also merge/3 which allows you to resolve conflicts with a function.

Link to this function

merge(prefix_map1, prefix_map2, conflict_resolver)

View Source

Specs

merge(t(), t() | map() | keyword(), conflict_resolver() | nil) ::
  {:ok, t()} | {:error, [atom() | String.t()]}

Merges two RDF.PrefixMaps, resolving conflicts through the given conflict_resolver function.

The second prefix map can also be given as any structure which can converted to a RDF.PrefixMap via new/1.

The given function will be invoked when there are conflicting mappings of prefixes to different namespaces; its arguments are prefix, namespace1 (the namespace for the prefix in the first prefix map), and namespace2 (the namespace for the prefix in the second prefix map). The value returned by the conflict_resolver function is used as the namespace for the prefix in the resulting prefix map. Non-RDF.IRI values will be tried to be converted to RDF.IRIs via RDF.IRI.new implicitly.

The most common conflict resolution strategies on can be chosen directly with the following atoms:

  • :ignore: keep the original namespace from prefix_map1
  • :overwrite: use the other namespace from prefix_map2

If a conflict can't be resolved, the provided function can return nil. This will result in an overall return of an :error tuple with the list of prefixes for which the conflict couldn't be resolved.

If everything could be merged, an :ok tuple is returned.