Entity
class Entity
Represents an entity in the RO-Crate. An entity can have multiple types and properties, where each property can have multiple values. Properties can be set as either literal values or references to other entities.
Functions
| Name | Description |
|---|---|
| Entity | Constructs an Entity with the specified types. |
| set | Sets a property-value pair for the entity. |
| set | Sets a property to reference another entity. |
| assignId | Assigns an '@id' to the entity. |
Function Details
Entity
explicit Entity(std::vector<std::string> types)
Constructs an Entity with the specified types.
-
types - A vector of strings representing the types of the entity.
- Throw
- std::invalid_argument if the types vector is empty.
assignId
void assignId(const std::string& id)
Assigns an '@id' to the entity.
-
id - The identifier to assign to the entity.
- Throw
- std::invalid_argument if the id is empty.
set
void set( Property property, Value value, ValueType type = ValueType::Literal )
Sets a property-value pair for the entity.
-
property - The name of the property to set.
-
value - The value to assign to the property.
-
valueType - The type of the value (Literal or Reference).
- Throw
- std::invalid_argument if the property name or value is empty, or if attempting to set '@id' directly.
void set(Property property, const Entity& entity)
Sets a property to reference another entity.
-
property - The name of the property to set.
-
entity - The entity to reference.
- Throw
- std::invalid_argument if the property name is empty.
- Throw
- std::runtime_error if the referenced entity does not have an '@id' property set.