6 #include "knowrob/semweb/Resource.h"
7 #include "knowrob/terms/IRIAtom.h"
8 #include "knowrob/terms/Blank.h"
9 #include "knowrob/Logger.h"
10 #include "knowrob/knowrob.h"
11 #include <boost/uuid/uuid_generators.hpp>
12 #include <boost/uuid/uuid_io.hpp>
14 #include "knowrob/integration/python/utils.h"
15 #include "knowrob/semweb/ImportHierarchy.h"
20 return lhs->stringForm() < rhs->stringForm();
32 KB_WARN(
"Resource created with guessed literal type: {}. Treating as IRI.",
iri);
41 if (!
ns.empty() &&
ns.back() !=
'#') {
58 auto pos =
iri.find(
'#');
59 if (pos != std::string::npos) {
60 return iri.substr(pos + 1);
70 auto pos =
iri.rfind(
'#');
71 if (pos != std::string::npos) {
72 auto pos_x = (includeDelimiter ? pos + 1 : pos);
73 return iri.substr(0, pos_x);
79 return iri_ns(
iri_->stringForm(), includeDelimiter);
88 void createType<semweb::Resource>() {
91 using IRIArg1 =
IRIAtomPtr (*)(std::string_view);
92 using IRIArg2 =
IRIAtomPtr (*)(std::string_view, std::string_view);
94 class_<semweb::Resource, std::shared_ptr<semweb::Resource>, boost::noncopyable>
static std::shared_ptr< Blank > Tabled(std::string_view stringForm)
static std::shared_ptr< IRIAtom > Tabled(std::string_view stringForm)
static constexpr std::string_view ORIGIN_SESSION
static std::string_view iri_name(std::string_view iri)
std::string_view name() const
static IRIAtomPtr unique_iri(std::string_view ns, std::string_view name)
Resource(std::string_view iri)
std::string_view ns(bool includeDelimiter=false) const
static std::string_view iri_ns(std::string_view iri, bool includeDelimiter=false)
static AtomPtr graph_atom(std::optional< std::string_view > graph)
RDFNodeType rdfNodeTypeGuess(std::string_view str)
std::shared_ptr< Atom > AtomPtr
std::shared_ptr< IRIAtom > IRIAtomPtr
void insertUnique(std::ostream &os)
bool operator()(const AtomPtr &lhs, const AtomPtr &rhs) const