6 #include "knowrob/storage/redland/RaptorContainer.h"
7 #include "knowrob/terms/XSDAtomic.h"
8 #include "knowrob/Logger.h"
34 return [
this, i = std::size_t(0)]()
mutable ->
const TriplePtr * {
41 return [
this, i = std::size_t(0)]()
mutable ->
TriplePtr * {
59 KB_WARN(
"received malformed data from raptor, skipping statement.");
64 auto c_s = raptor_term_copy(s);
65 auto c_p = raptor_term_copy(p);
66 auto c_o = raptor_term_copy(o);
68 endpoint_triple.s = c_s;
69 endpoint_triple.p = c_p;
70 endpoint_triple.o = c_o;
79 triple->setGraph((
const char *) librdf_node_get_literal_value(context));
80 }
else if (
origin_.has_value()) {
82 triple->setGraph(
origin_.value().data());
86 triple->setPredicate((
const char *) raptor_uri_as_string(c_p->value.uri));
88 if (c_s->type == RAPTOR_TERM_TYPE_BLANK)
89 triple->setSubjectBlank((
const char *) c_s->value.blank.string);
91 triple->setSubject((
const char *) raptor_uri_as_string(c_s->value.uri));
94 if (c_o->type == RAPTOR_TERM_TYPE_BLANK) {
95 triple->setObjectBlank((
const char *) c_o->value.blank.string);
96 }
else if (c_o->type == RAPTOR_TERM_TYPE_LITERAL) {
97 auto stringForm = (
const char *) c_o->value.literal.string;
100 if (c_o->value.literal.datatype) {
101 auto typeURI = (
const char *) raptor_uri_as_string(c_o->value.literal.datatype);
104 triple->setXSDValue(stringForm, xsdType);
106 triple->setObjectIRI((
const char *) raptor_uri_as_string(c_o->value.uri));
114 return add(statement->subject, statement->predicate, statement->object, context);
std::function< TriplePtr *()> MutableGenerator
std::optional< std::string_view > origin_
RaptorContainer(uint32_t size, std::string_view origin)
std::vector< mapped_statement > raptorData_
ConstGenerator cgenerator() const override
Triple * add(raptor_term *s, raptor_term *p, raptor_term *o, librdf_node *context=nullptr)
std::vector< TriplePtr > mappedData_
MutableGenerator generator() override
std::function< const TriplePtr *()> ConstGenerator
XSDType xsdTypeFromIRI(std::string_view iri)
XSDType
The XSDType enum Enumeration of the XSD types.
TripleTemplate< std::string_view > TripleView