#include <Resource.h>
A RDF resource.
Definition at line 17 of file Resource.h.
◆ Resource() [1/4]
Resource::Resource |
( |
std::string_view |
iri | ) |
|
|
explicit |
Definition at line 23 of file Resource.cpp.
32 KB_WARN(
"Resource created with guessed literal type: {}. Treating as IRI.",
iri);
static std::shared_ptr< Blank > Tabled(std::string_view stringForm)
static std::shared_ptr< IRIAtom > Tabled(std::string_view stringForm)
RDFNodeType rdfNodeTypeGuess(std::string_view str)
◆ Resource() [2/4]
knowrob::semweb::Resource::Resource |
( |
const IRIAtomPtr & |
iri | ) |
|
|
inlineexplicit |
◆ Resource() [3/4]
knowrob::semweb::Resource::Resource |
( |
std::string_view |
iri | ) |
|
|
explicit |
◆ Resource() [4/4]
knowrob::semweb::Resource::Resource |
( |
const IRIAtomPtr & |
iri | ) |
|
|
inlineexplicit |
◆ graph_atom() [1/2]
knowrob::AtomPtr Resource::graph_atom |
( |
std::optional< std::string_view > |
graph | ) |
|
|
static |
Obtain an atom from an optional string.
- Parameters
-
- Returns
- an atom
Definition at line 82 of file Resource.cpp.
83 return graph ?
IRIAtom::Tabled(graph.value()) : IRIAtom::Tabled(ImportHierarchy::ORIGIN_SESSION);
◆ graph_atom() [2/2]
static AtomPtr knowrob::semweb::Resource::graph_atom |
( |
std::optional< std::string_view > |
graph | ) |
|
|
static |
Obtain an atom from an optional string.
- Parameters
-
- Returns
- an atom
◆ iri() [1/2]
auto knowrob::semweb::Resource::iri |
( |
| ) |
const |
|
inline |
- Returns
- the IRI string of this resource
Definition at line 26 of file Resource.h.
26 {
return iri_->stringForm(); }
◆ iri() [2/2]
auto knowrob::semweb::Resource::iri |
( |
| ) |
const |
|
inline |
- Returns
- the IRI string of this resource
Definition at line 26 of file Resource.h.
26 {
return iri_->stringForm(); }
◆ iri_name() [1/2]
std::string_view Resource::iri_name |
( |
std::string_view |
iri | ) |
|
|
static |
- Parameters
-
- Returns
- the name part of the IRI
Definition at line 57 of file Resource.cpp.
58 auto pos =
iri.find(
'#');
59 if (pos != std::string::npos) {
60 return iri.substr(pos + 1);
◆ iri_name() [2/2]
static std::string_view knowrob::semweb::Resource::iri_name |
( |
std::string_view |
iri | ) |
|
|
static |
- Parameters
-
- Returns
- the name part of the IRI
◆ iri_ns() [1/2]
std::string_view Resource::iri_ns |
( |
std::string_view |
iri, |
|
|
bool |
includeDelimiter = false |
|
) |
| |
|
static |
- Parameters
-
iri | a IRI |
includeDelimiter | if true, the delimiter is included in the result |
- Returns
- the namespace part of the IRI
Definition at line 69 of file Resource.cpp.
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);
◆ iri_ns() [2/2]
static std::string_view knowrob::semweb::Resource::iri_ns |
( |
std::string_view |
iri, |
|
|
bool |
includeDelimiter = false |
|
) |
| |
|
static |
- Parameters
-
iri | a IRI |
includeDelimiter | if true, the delimiter is included in the result |
- Returns
- the namespace part of the IRI
◆ iriAtom() [1/2]
auto knowrob::semweb::Resource::iriAtom |
( |
| ) |
const |
|
inline |
- Returns
- the IRI string of this resource as an atom
Definition at line 31 of file Resource.h.
◆ iriAtom() [2/2]
auto knowrob::semweb::Resource::iriAtom |
( |
| ) |
const |
|
inline |
- Returns
- the IRI string of this resource as an atom
Definition at line 31 of file Resource.h.
◆ name() [1/2]
std::string_view Resource::name |
( |
| ) |
const |
- Returns
- the name of this resource
Definition at line 65 of file Resource.cpp.
static std::string_view iri_name(std::string_view iri)
◆ name() [2/2]
std::string_view knowrob::semweb::Resource::name |
( |
| ) |
const |
- Returns
- the name of this resource
◆ ns() [1/2]
std::string_view Resource::ns |
( |
bool |
includeDelimiter = false | ) |
const |
- Returns
- the namespace of this resource.
Definition at line 78 of file Resource.cpp.
79 return iri_ns(
iri_->stringForm(), includeDelimiter);
static std::string_view iri_ns(std::string_view iri, bool includeDelimiter=false)
◆ ns() [2/2]
std::string_view knowrob::semweb::Resource::ns |
( |
bool |
includeDelimiter = false | ) |
const |
- Returns
- the namespace of this resource.
◆ unique_iri() [1/4]
Generate a unique IRI for a resource.
- Parameters
-
ns | the namespace of the IRI. |
name | the name prefix of the IRI. |
- Returns
- a unique IRI.
Definition at line 38 of file Resource.cpp.
41 if (!
ns.empty() &&
ns.back() !=
'#') {
std::string_view name() const
std::string_view ns(bool includeDelimiter=false) const
void insertUnique(std::ostream &os)
◆ unique_iri() [2/4]
static IRIAtomPtr knowrob::semweb::Resource::unique_iri |
( |
std::string_view |
ns, |
|
|
std::string_view |
name |
|
) |
| |
|
static |
Generate a unique IRI for a resource.
- Parameters
-
ns | the namespace of the IRI. |
name | the name prefix of the IRI. |
- Returns
- a unique IRI.
◆ unique_iri() [3/4]
Generate a unique IRI for a resource.
- Parameters
-
type_iri | the type IRI of the resource used as a prefix. |
- Returns
- a unique IRI.
Definition at line 49 of file Resource.cpp.
◆ unique_iri() [4/4]
static IRIAtomPtr knowrob::semweb::Resource::unique_iri |
( |
std::string_view |
type_iri | ) |
|
|
static |
Generate a unique IRI for a resource.
- Parameters
-
type_iri | the type IRI of the resource used as a prefix. |
- Returns
- a unique IRI.
◆ iri_
The documentation for this class was generated from the following files:
- build/_CPack_Packages/Linux/DEB/knowrob-2.1.0-Linux/usr/include/knowrob/semweb/Resource.h
- src/semweb/Resource.cpp