knowL: Knowledge Libraries
Loading...
Searching...
No Matches
knowRDF::Literal Class Reference

#include <Literal.h>

Inheritance diagram for knowRDF::Literal:
Collaboration diagram for knowRDF::Literal:

Public Member Functions

 Literal ()
 
 Literal (const knowCore::Value &_rhs, const QString &_lang=QString())
 
 Literal (const Literal &_rhs)
 
Literaloperator= (const Literal &_rhs)
 
knowCore::Uri datatype () const
 
QString lang () const
 
bool operator< (const Literal &_rhs) const
 
bool operator== (const Literal &_rhs) const
 
knowCore::ReturnValue< QByteArray > md5 () const
 
knowCore::ReturnValue< QJsonValue > toJsonValue (const knowCore::SerialisationContexts &_contexts) const
 
knowCore::ReturnValue< QCborValue > toCborValue (const knowCore::SerialisationContexts &_contexts) const
 
- Public Member Functions inherited from knowCore::Value
 Value ()
 
 Value (const Value &_rhs)
 
Valueoperator= (const Value &_rhs)
 
QVariant toVariant () const
 
Uri datatype () const
 
bool isEmpty () const
 
bool operator< (const Value &_rhs) const
 
bool operator== (const Value &_rhs) const
 
bool operator!= (const Value &_rhs) const
 
ReturnValue< bool > compare (const Value &_value, ComparisonOperators _operators) const
 
ReturnValue< Valueconvert (const Uri &_uri, TypeCheckingMode _conversion=TypeCheckingMode::Safe) const
 
ReturnValue< Valuecompute (const Value &_value, ArithmeticOperator _operator) const
 
template<typename _T_ >
ReturnValue< _T_ > value (TypeCheckingMode _conversion=TypeCheckingMode::Safe) const
 
template<typename _T_ >
_T_ value (const _T_ &_default, TypeCheckingMode _conversion=TypeCheckingMode::Safe) const
 
template<typename _T_ >
bool canConvert (TypeCheckingMode _conversion=TypeCheckingMode::Safe) const
 
bool canConvert (const Uri &_uri, TypeCheckingMode _conversion=TypeCheckingMode::Safe) const
 
template<typename _T_ >
bool is () const
 
ReturnValue< QByteArray > md5 () const
 
ReturnValue< QJsonValue > toJsonValue (const SerialisationContexts &_contexts=defaultSerialisationContext()) const
 
ReturnValue< QCborValue > toCborValue (const SerialisationContexts &_contexts=defaultSerialisationContext()) const
 
ReturnValue< QString > toRdfLiteral (const SerialisationContexts &_contexts=defaultSerialisationContext()) const
 
ReturnValue< QString > printable () const
 
ReturnValue< QJsonObject > toJsonObject (const SerialisationContexts &_contexts=defaultSerialisationContext()) const
 
ReturnValue< QCborMap > toCborMap (const SerialisationContexts &_contexts=defaultSerialisationContext()) const
 
ReturnValue< ValueListtoList () const
 
ReturnValue< ValueHashtoHash () const
 

Static Public Member Functions

template<typename _T_ >
static Literal fromValue (const _T_ &_value, const Lang &_lang=Lang(QString()))
 
static knowCore::ReturnValue< LiteralfromValue (const knowCore::Value &_value, const Lang &_lang)
 
static knowCore::ReturnValue< LiteralfromValue (const Literal &_value, const Lang &_lang=Lang(QString()))
 
static knowCore::ReturnValue< LiteralfromValue (const QVariant &_value, const Lang &_lang=Lang(QString()))
 
template<typename _T_ >
static knowCore::ReturnValue< LiteralfromValue (const knowCore::Uri &_datatype, const _T_ &_value, const QString &_lang=QString(), knowCore::TypeCheckingMode _conversion=knowCore::TypeCheckingMode::Safe)
 
static Literal fromValue (const knowCore::Value &_rhs)
 
static knowCore::ReturnValue< LiteralfromVariant (const knowCore::Uri &_datatype, const QVariant &_value, const QString &_lang=QString(), knowCore::TypeCheckingMode _conversion=knowCore::TypeCheckingMode::Safe)
 
static knowCore::ReturnValue< LiteralfromVariant (const QVariant &_value, const QString &_lang=QString())
 
static knowCore::ReturnValue< LiteralfromRdfLiteral (const knowCore::Uri &_datatype, const QString &_value, const QString &_lang=QString())
 
static knowCore::ReturnValue< LiteralfromJsonValue (const QJsonValue &_value, const knowCore::DeserialisationContexts &_contexts)
 
static knowCore::ReturnValue< LiteralfromCborValue (const QCborValue &_value, const knowCore::DeserialisationContexts &_contexts)
 
template<>
knowCore::ReturnValue< LiteralfromValue (const knowCore::Uri &_datatype, const QVariant &_value, const QString &_lang, knowCore::TypeCheckingMode _conversion)
 
- Static Public Member Functions inherited from knowCore::Value
template<typename _T_ >
static Value fromValue (const _T_ &_value)
 
static ReturnValue< ValuefromValue (const QVariant &_value)
 
template<typename _T_ >
static ReturnValue< ValuefromValue (const Uri &_datatype, const _T_ &_value, TypeCheckingMode _conversion=TypeCheckingMode::Safe)
 
static ReturnValue< ValuefromVariant (const Uri &_datatype, const QVariant &_value, TypeCheckingMode _conversion=TypeCheckingMode::Safe)
 
static ReturnValue< ValuefromVariant (const QVariant &_variant)
 
static ReturnValue< ValuefromJsonValue (const Uri &_datatype, const QJsonValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext())
 
template<typename _T_ >
static ReturnValue< _T_ > fromJsonValue (const QJsonValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext())
 
static ReturnValue< ValuefromCborValue (const Uri &_datatype, const QCborValue &_value, const DeserialisationContexts &_context=defaultDeserialisationContext())
 
static ReturnValue< ValuefromRdfLiteral (const Uri &_datatype, const QString &_value, const DeserialisationContexts &_context=defaultDeserialisationContext())
 
static ReturnValue< ValuefromJsonObject (const QJsonObject &_value, const DeserialisationContexts &_context=defaultDeserialisationContext())
 
static ReturnValue< ValuefromCborMap (const QCborMap &_value, const DeserialisationContexts &_context=defaultDeserialisationContext())
 
template<>
ReturnValue< ValuefromValue (const Uri &_datatype, const QVariant &_value, TypeCheckingMode _conversion)
 

Detailed Description

Represents a RDF Literal, as knowCore::Value with a lang tag.

Constructor & Destructor Documentation

◆ Literal()

Literal::Literal ( )

Construct an empty Literal

Member Function Documentation

◆ datatype()

knowCore::Uri Literal::datatype ( ) const
Returns
the URI corresponding to the datatype, this might differ from Value::datatype in case Value::datatype is set to knowCore::Uris::xsd::string and the literal hold a value as a QString for an unregistered type.

◆ fromRdfLiteral()

knowCore::ReturnValue< Literal > Literal::fromRdfLiteral ( const knowCore::Uri & _datatype,
const QString & _value,
const QString & _lang = QString() )
static

Create a Literal from a string and datatype. If the type is not available in knowCore MetaType system, it is stored as a string. If the type is available, attemps a conversion, which may fails.

◆ fromValue()

Literal Literal::fromValue ( const knowCore::Value & _rhs)
static

Construct a literal from a value. If _rhs contains a Literal, it returns it, otherwise, it call the Literal constructor with the value and an empty lang.

◆ fromVariant() [1/2]

knowCore::ReturnValue< Literal > Literal::fromVariant ( const knowCore::Uri & _datatype,
const QVariant & _value,
const QString & _lang = QString(),
knowCore::TypeCheckingMode _conversion = knowCore::TypeCheckingMode::Safe )
static

Construct a literal from its full definition

Parameters
_datatypethe type of the literal
_valuea variant with the value
_langthe language tag (ie 'en')
_normalisewhether the QVariant should be casted to the default type for _datatype

◆ fromVariant() [2/2]

knowCore::ReturnValue< Literal > Literal::fromVariant ( const QVariant & _value,
const QString & _lang = QString() )
static

Create a Literal from a variant.

◆ lang()

QString Literal::lang ( ) const
Returns
the lang tag

The documentation for this class was generated from the following files: