Dataset

Interface to a set of data modelled according according to the Resource Description Framework.

typedef std::unique_ptr<IMapping> XS::Dataset::IMappingPtr
typedef std::reference_wrapper<IElement> XS::Dataset::IElementRef
typedef std::reference_wrapper<IInstance> XS::Dataset::IInstanceRef
typedef std::unique_ptr<IInstance> XS::Dataset::IInstancePtr
DLL_API IInstance *DLL_CALL XS::Dataset::makeInstance (const IInterface &interface, std::optional< std::function< std::string(std::string_view, std::string_view)>> identification_id=std::nullopt, std::optional< std::function< std::string(std::string_view, std::string_view)>> property_id=std::nullopt, std::optional< std::function< std::string(std::string_view, std::string_view)>> value_id=std::nullopt)

Create a new (empty) IInstance.

inline IInstancePtr XS::Dataset::makeInstancePtr(const IInterface &interface, std::optional<std::function<std::string(std::string_view, std::string_view)>> identification_id = std::nullopt, std::optional<std::function<std::string(std::string_view, std::string_view)>> property_id = std::nullopt, std::optional<std::function<std::string(std::string_view, std::string_view)>> value_id = std::nullopt)
DLL_API IMapping *DLL_CALL XS::Dataset::makeMapping (const IInterface &interface, const XML::Document &mapping_doc)
inline IMappingPtr XS::Dataset::makeMappingPtr(const IInterface &interface, const XML::Document &mapping_doc)
class IEvent : public XS::IEvent
#include <dataset.h>
class IMapping : public XS::Interface
#include <dataset.h>

Describes a translation between a SourceModel and RDF.

class ITag : public XS::RDF::IResource
#include <dataset.h>

A tag, which consists of a (typically) human-readable string and an optional classification.

Public Functions

virtual std::string_view value() const noexcept = 0

Get the (typically) human-readable value of the tag.

virtual const RDF::IClass *RDLClass() const noexcept = 0

Get the (optional) classification.

class IAttribute : public XS::Interface
#include <dataset.h>

The attributes of IElement instances.

Public Functions

virtual explicit operator const RDF::IClass&() const = 0

Convert the attribute to RDF::IClass.

virtual Type type() const = 0

Get the Type of the attribute.

virtual const RDF::IProperty &mproperty() const = 0

Get the RDF::IProperty of the attribute.

class IProperty : public XS::RDF::IResource
#include <dataset.h>

The properties of IElement instances.

Public Types

enum class Type

The type of attribute/property.

Values:

enumerator DATE

A property whose value is a date (point in time).

enumerator QUALITY

A property whose value is a quality.

enumerator QUANTITY

A property whose value is a numerical quantity (with optional unit of measure).

Public Functions

virtual Type type() const = 0

Get the Type of the property.

virtual const RDF::IClass &RDLClass() const = 0

Get the RDF::IClass of the property.

virtual const IValue &value() const = 0

Get the IValue of the property.

class IValue : public IResource
#include <dataset.h>

Public Types

enum class Type

The type of value.

Values:

enumerator DATE

A value holding a date.

enumerator STRING

A value holding a reference to a string.

enumerator CLASS

A value holding a reference to a RDF::IClass.

enumerator MEASURE

A value holding a reference to a string along with an optional reference to a RDF::IClass describing the unit of measure.

typedef std::pair<std::string_view, const RDF::IClass*> MeasureValue

A value holding a reference to a string along with an optional reference to a RDF::IClass describing the unit of measure.

Public Functions

virtual explicit operator const RDF::IClass&() const = 0

Convert the value to RDF::IClass.

virtual explicit operator MeasureValue() const = 0

Convert the value to MeasureValue.

virtual std::string_view uri() const = 0

Get the uri of the value.

virtual Type type() const = 0

Get the Type of the value.

class IRelationship : public XS::Interface
#include <dataset.h>

Describes a relationship between two IElement instances.

Public Functions

virtual const RDF::IProperty &mproperty() const = 0

Get the RDF::IProperty of the relationship.

This class is the predicate.

virtual const IElement &fromElement() const = 0

Get the from IElement of the relationship.

This element is the subject.

virtual const IElement &toElement() const = 0

Get the to IElement of the relationship.

This element is the object.

class IElement : public XS::RDF::IResource
#include <dataset.h>

The primary objects which make up the model.

Public Functions

virtual const RDF::IClass *RDLClass() const = 0

Get the (optional) RDF::IClass that classifies the element according to reference data.

This class is the object of a relationship describing a reference data relationship.

virtual const ITag *tag() const noexcept = 0

Get a (typically) human-readable tag for the element.

This is provided for historical compatibility and shouild return tag[0] if it exists.

virtual const ICollection<ITag> &tags() const = 0

Get the collection of (typically) human-readable tags for the element.

virtual ITag &setTag(std::string_view value, const RDF::IClass *rdl_class = nullptr) = 0

Set a (typically) human-readable tag for the element.

This will replace all existing tags with the value provided.

virtual ITag &addTag(std::string_view value, const RDF::IClass *rdl_class = nullptr) = 0

Add a (typically) human-readable tag for the element.

This will add the value provided to the existing set of tags.

virtual const ICollection<IAttribute> &attributes() const = 0

Get the collection of IAttribute instances belonging to the element.

virtual IAttribute &addAttribute(const RDF::IProperty &mproperty, std::string_view value) = 0

Add an attribute of type IAttribute::Type::STRING.

virtual IAttribute &addAttribute(const RDF::IProperty &mproperty, const RDF::IClass &value) = 0

Add an attribute of type IAttribute::Type::CLASS.

virtual const ICollection<IProperty> &properties() const = 0

Get the collection of IProperty instances belonging to the element.

virtual IProperty &addDateProperty(const RDF::IClass &rdl_class, std::string_view value) = 0

Add a date property (type IProperty::Type::DATE).

virtual IProperty &addQualitativeProperty(const RDF::IClass &rdl_class, std::string_view value) = 0

Add a qualitative property (type IProperty::Type::QUALITY) with an IProperty::StringValue.

virtual IProperty &addQualitativeProperty(const RDF::IClass &rdl_class, const RDF::IClass &value) = 0

Add a qualitative property (type IProperty::Type::QUALITY) with an IProperty::ClassValue.

virtual IProperty &addQuantitativeProperty(const RDF::IClass &rdl_class, std::string_view value, const RDF::IClass *UOM) = 0

Add a quantitative property (type IProperty::Type::QUANTITY) with an IProperty::MeasureValue.

virtual const ICollection<IRelationship> &relationships() const = 0

Get the collection of IRelationship instances from this element to others.

virtual IRelationship &addRelationship(const RDF::IProperty &mproperty, IElement &to_element) = 0

Add an IRelationship to another element.

virtual bool exports() const = 0

Get a flag indicating whether this element will be committed to the underlying DataStore::IInstance.

class IInstance : public XS::Interface
#include <dataset.h>

The dataset itself, which contains a collection of IElement instances.

Public Functions

virtual IEventManager &eventManager() const = 0

Get the IEventManager for events that may occur related to this instance.

virtual const RDF::INamedGraph &addNamedGraph(std::string_view uri, const RDF::IClass *element_mclass = nullptr, OptionalRef<const RDF::INamedGraph> element_named_graph = std::nullopt) = 0

Add an instance of RDF::INamedGraph to the model along with an (optional) IElement of the given class.

virtual const RDF::INamedGraphCollection &namedGraphs() const = 0

Get the collection of RDF::INamedGraph instances known to the model.

virtual XS::OptionalRef<const XS::RDF::INamedGraph> defaultNamedGraph() const = 0

Get the (possibly undefined) default RDF::INamedGraph for the model.

virtual void defaultNamedGraph(const RDF::INamedGraph &named_graph) = 0

Set the default RDF::INamedGraph for the model.

virtual IElement &addElement(std::string_view uri, const RDF::IClass &mclass, const RDF::IClass *rdl_class, std::optional<std::string_view> label = std::nullopt, std::optional<std::string_view> description = std::nullopt, std::optional<std::string_view> tag = std::nullopt, bool exports = true, OptionalRef<const RDF::INamedGraph> named_graph = std::nullopt) = 0

Add an instance of IElement to the model by URI (will be checked against the namespaces in the underlying DataStore::IInstance).

virtual const IElementCollection &elements() const = 0

Get the collection of IElement instances in the model.

virtual void DLL_CALL importRDFModel (const RDF::IStatementCollection &statements)=0

Import a model from a collection of RDF::IStatement.

virtual void DLL_CALL importSourceModel (SourceModel::IModel &source_model, IMapping &mapping)=0

Import a SourceModel::IModel following the rules defined by an IMapping.

virtual void DLL_CALL exportModel (RDF::IStatementCollection &statements) const =0

Export a collection of RDF::IStatement describing the model.

class IElementCollection : public XS::ICollection<IElement>
#include <dataset.h>

The collection of IElement instances in the model.

class IInterface : public XS::Interface
#include <dataset.h>

An interface enabling a source of RDF data such as a DataStore::IInstance to supply the base data.