Allow the base_iri of RDF.Vocabulary.Namespaces to end with a dot

This commit is contained in:
Marcel Otto 2020-10-07 16:01:51 +02:00
parent 51e6712d69
commit 8325ba9988
2 changed files with 4 additions and 2 deletions

View file

@ -51,7 +51,9 @@ are specified.
almost never the expected behaviour. This is fixed now by relying on the new
`put/2` behaviour.
- for consistency reasons the internal `:id` struct field of `RDF.BlankNode` was renamed
to `:value`
to `:value`
- allow the `base_iri` of `RDF.Vocabulary.Namespace`s to end with a `.` to support
vocabularies which use dots in the IRIs for further structuring (eg. CIM-based formats like CGMES)
### Fixed

View file

@ -200,7 +200,7 @@ defmodule RDF.Vocabulary.Namespace do
defp base_iri!(opts) do
base_iri = Keyword.fetch!(opts, :base_iri)
unless is_binary(base_iri) and String.ends_with?(base_iri, ["/", "#"]) do
unless is_binary(base_iri) and String.ends_with?(base_iri, ~w[/ # .]) do
raise RDF.Namespace.InvalidVocabBaseIRIError,
"a base_iri without a trailing '/' or '#' is invalid"
else