Struct Namespace

Inheritance Relationships

Derived Types

Struct Documentation

struct Namespace

Namespace provides a simple tool to create IRIs from a certain namespace and vocabulary. Each Namespace instance maintains an internal cache to save roundtrip to storage::NodeStorage

.

Example:

Namespace ex("http://example.com/);
IRI me = ex + "me";

Subclassed by rdf4cpp::ClosedNamespace, rdf4cpp::namespaces::XSD

Public Functions

explicit Namespace(std::string_view namespace_iri, storage::DynNodeStoragePtr node_storage = storage::default_node_storage)

Namespace Constructor

Parameters:
  • namespace_iri – namespace IRI string. This will be used as prefix. IRI must not be encapsulated in <..>.

  • node_storage – where the IRIs will live

std::string_view name_space() const noexcept
Returns:

IRI string of the Namespace

storage::DynNodeStoragePtr node_storage() const
Returns:

NodeStorage used to create IRIs from this Namespace.

virtual IRI operator+(std::string_view suffix) const

Create an IRI with the suffix added to the Namespace.

Parameters:

suffix – suffix that is appended

Returns:

the constructed IRI

virtual void clear() const

Clears the cache.

Protected Attributes

std::string namespace_iri_

The IRI string of the namespace.

storage::DynNodeStoragePtr node_storage_

NodeStorage from which IRI objects are created.

mutable dice::sparse_map::sparse_map<std::string, storage::identifier::NodeBackendID, dice::hash::DiceHashwyhash<std::string_view>, std::equal_to<>> cache_

Cache storing the NodeBackendHandle for prefixes. This saves roundtrips to NodeStorage.