7 #include "knowrob/terms/XSDAtomic.h"
8 #include "knowrob/terms/String.h"
9 #include "knowrob/terms/Numeric.h"
10 #include "knowrob/semweb/xsd.h"
11 #include "knowrob/Logger.h"
12 #include <boost/python.hpp>
13 #include "knowrob/integration/python/utils.h"
17 std::shared_ptr<XSDAtomic>
XSDAtomic::create(std::string_view lexicalForm, std::string_view xsdTypeIRI) {
21 return std::make_shared<String>(lexicalForm);
23 return std::make_shared<Boolean>(lexicalForm);
25 return std::make_shared<Double>(lexicalForm);
27 return std::make_shared<Float>(lexicalForm);
30 return std::make_shared<Integer>(lexicalForm);
32 return std::make_shared<Long>(lexicalForm);
34 return std::make_shared<Short>(lexicalForm);
36 return std::make_shared<UnsignedLong>(lexicalForm);
38 return std::make_shared<UnsignedInt>(lexicalForm);
40 return std::make_shared<UnsignedShort>(lexicalForm);
42 KB_ERROR(
"Unknown XSD type {} treated as string.",
static_cast<int>(
type));
43 return std::make_shared<String>(lexicalForm);
49 static std::map<std::string_view, XSDType> typeIRIs = {
64 auto it = typeIRIs.find(
iri);
65 if (it != typeIRIs.end())
return it->second;
66 KB_WARN(
"Unknown XSD type IRI {} treated as string.",
iri);
71 static std::map<XSDType, std::string_view> typeIRIs = {
84 auto it = typeIRIs.find(
type);
85 if (it != typeIRIs.end())
return it->second;
86 KB_WARN(
"Unknown XSD type {} treated as string.",
static_cast<int>(
type));
99 enum_<XSDType>(
"XSDType")
111 class_<XSDAtomic, std::shared_ptr<XSDAtomic>, bases<Atomic, RDFNode>, boost::noncopyable>
112 (
"XSDAtomic", no_init)
static std::shared_ptr< XSDAtomic > create(std::string_view lexicalForm, std::string_view xsdTypeIRI)
std::string_view xsdTypeIRI() const
void createType< XSDAtomic >()
const IRIAtomPtr IRI_integer
const IRIAtomPtr IRI_string
const IRIAtomPtr IRI_short
const IRIAtomPtr IRI_boolean
const IRIAtomPtr IRI_long
const IRIAtomPtr IRI_unsignedShort
const IRIAtomPtr IRI_unsignedLong
const IRIAtomPtr IRI_unsignedInt
const IRIAtomPtr IRI_float
const IRIAtomPtr IRI_anyURI
const IRIAtomPtr IRI_nonNegativeInteger
const IRIAtomPtr IRI_double
std::string_view xsdTypeToIRI(XSDType type)
XSDType xsdTypeFromIRI(std::string_view iri)
IRIAtomPtr iri(std::string_view ns, std::string_view name)
XSDType
The XSDType enum Enumeration of the XSD types.