knowrob  2.1.0
A Knowledge Base System for Cognition-enabled Robots
Resource.h
Go to the documentation of this file.
1 /*
2  * This file is part of KnowRob, please consult
3  * https://github.com/knowrob/knowrob for license details.
4  */
5 
6 #ifndef KNOWROB_SEMWEB_RESOURCE_H
7 #define KNOWROB_SEMWEB_RESOURCE_H
8 
9 #include <string>
10 #include "knowrob/terms/Atom.h"
11 #include "knowrob/terms/IRIAtom.h"
12 
13 namespace knowrob::semweb {
17  class Resource {
18  public:
19  explicit Resource(std::string_view iri);
20 
21  explicit Resource(const IRIAtomPtr &iri) : iri_(iri) {}
22 
26  auto iri() const { return iri_->stringForm(); }
27 
31  auto iriAtom() const { return iri_; }
32 
36  std::string_view name() const;
37 
41  std::string_view ns(bool includeDelimiter = false) const;
42 
49  static IRIAtomPtr unique_iri(std::string_view ns, std::string_view name);
50 
56  static IRIAtomPtr unique_iri(std::string_view type_iri);
57 
62  static std::string_view iri_name(std::string_view iri);
63 
69  static std::string_view iri_ns(std::string_view iri, bool includeDelimiter = false);
70 
76  static AtomPtr graph_atom(std::optional<std::string_view> graph);
77 
78  protected:
80 
81  struct AtomComparator {
82  bool operator()(const AtomPtr &lhs, const AtomPtr &rhs) const;
83  };
84  };
85 
86 } // knowrob::semweb
87 
88 #endif //KNOWROB_SEMWEB_RESOURCE_H
static AtomPtr graph_atom(std::optional< std::string_view > graph)
Resource(std::string_view iri)
knowrob::AtomPtr iri_
Definition: Resource.h:79
std::string_view ns(bool includeDelimiter=false) const
std::string_view name() const
auto iriAtom() const
Definition: Resource.h:31
static IRIAtomPtr unique_iri(std::string_view ns, std::string_view name)
std::string_view name() const
Definition: Resource.cpp:65
Resource(const IRIAtomPtr &iri)
Definition: Resource.h:21
static std::string_view iri_ns(std::string_view iri, bool includeDelimiter=false)
std::string_view ns(bool includeDelimiter=false) const
Definition: Resource.cpp:78
static IRIAtomPtr unique_iri(std::string_view type_iri)
static std::string_view iri_name(std::string_view iri)
std::shared_ptr< Atom > AtomPtr
Definition: Atom.h:69
std::shared_ptr< IRIAtom > IRIAtomPtr
Definition: IRIAtom.h:57
bool operator()(const AtomPtr &lhs, const AtomPtr &rhs) const