21 #include "literal_p.h"
23 #include <QtCore/QHash>
24 #include <QtCore/QVariant>
26 #include <Soprano/Vocabulary/RDFS>
34 K_GLOBAL_STATIC(XmlSchemaMap, s_xmlSchemaTypes)
36 void initXmlSchemaTypes() {
37 if( s_xmlSchemaTypes->isEmpty() ) {
38 s_xmlSchemaTypes->insert(
"int", QVariant::Int );
39 s_xmlSchemaTypes->insert(
"integer", QVariant::Int );
40 s_xmlSchemaTypes->insert(
"negativeInteger", QVariant::Int );
41 s_xmlSchemaTypes->insert(
"decimal", QVariant::Int );
42 s_xmlSchemaTypes->insert(
"short", QVariant::Int );
43 s_xmlSchemaTypes->insert(
"long", QVariant::LongLong );
44 s_xmlSchemaTypes->insert(
"unsignedInt", QVariant::UInt );
45 s_xmlSchemaTypes->insert(
"unsignedShort", QVariant::UInt );
46 s_xmlSchemaTypes->insert(
"unsignedLong", QVariant::ULongLong );
47 s_xmlSchemaTypes->insert(
"boolean", QVariant::Bool );
48 s_xmlSchemaTypes->insert(
"double", QVariant::Double );
49 s_xmlSchemaTypes->insert(
"float", QVariant::Double );
50 s_xmlSchemaTypes->insert(
"string", QVariant::String );
51 s_xmlSchemaTypes->insert(
"date", QVariant::Date );
52 s_xmlSchemaTypes->insert(
"time", QVariant::Time );
53 s_xmlSchemaTypes->insert(
"dateTime", QVariant::DateTime );
58 const XmlSchemaMap& xmlSchemaTypes()
60 if(s_xmlSchemaTypes->isEmpty())
62 return *s_xmlSchemaTypes;
82 d->dataTypeUri = dataType;
88 if ( dataType == Soprano::Vocabulary::RDFS::Literal() ) {
89 d->dataType = QVariant::String;
93 if ( it != xmlSchemaTypes().constEnd() ) {
94 d->dataType = it.value();
114 return d->dataTypeUri;
126 return d->dataTypeUri.isValid();
bool isValid() const
Is this a valid Literal, i.e.
Literal & operator=(const Literal &)
QUrl dataTypeUri() const
The XML Schema type URI.
QVariant::Type dataType() const
The type converted to a QVariant::Type.
Defines a literal type based on XML Schema.
Literal()
Default constructor.