#include <OntologyParser.h>
A parser for RDF data.
Definition at line 22 of file OntologyParser.h.
◆ OntologyParser() [1/2]
- Parameters
-
fileURI | the URI of the file to parse. |
format | the format of the file. |
Definition at line 60 of file OntologyParser.cpp.
64 raptor_parser_set_namespace_handler(
parser_,
nullptr, procesNamespace);
66 if (fs::exists(fileURI)) {
68 auto escapedString = raptor_uri_filename_to_uri_string(fileURI.data());
69 uri_ = raptor_new_uri(
world_, (
unsigned char *) escapedString);
73 raptor_free_memory(escapedString);
76 uri_ = raptor_new_uri(
world_, (
const unsigned char *) fileURI.data());
raptor_parser * createParser(knowrob::semweb::TripleFormat format)
std::function< int()> doParse_
static raptor_world * createWorld()
◆ ~OntologyParser() [1/2]
OntologyParser::~OntologyParser |
( |
| ) |
|
◆ OntologyParser() [2/2]
knowrob::OntologyParser::OntologyParser |
( |
const std::string_view & |
fileURI, |
|
|
semweb::TripleFormat |
format |
|
) |
| |
- Parameters
-
fileURI | the URI of the file to parse. |
format | the format of the file. |
◆ ~OntologyParser() [2/2]
knowrob::OntologyParser::~OntologyParser |
( |
| ) |
|
◆ add() [1/2]
void OntologyParser::add |
( |
raptor_statement * |
statement, |
|
|
const TripleHandler & |
callback |
|
) |
| |
- Parameters
-
statement | a raptor statement |
callback | the callback to use for handling triples. |
Definition at line 129 of file OntologyParser.cpp.
133 KB_WARN(
"No origin set for ontology parser, falling back to \"user\" origin.");
147 if (triple &&
owl::imports->stringForm() == triple->predicate()) {
148 imports_.emplace_back(triple->valueAsString());
static uint32_t batchSize()
static constexpr std::string_view ORIGIN_USER
void flush(const TripleHandler &callback)
std::vector< std::string > imports_
void applyFrame(Triple *triple)
std::shared_ptr< RaptorContainer > currentBatch_
◆ add() [2/2]
void knowrob::OntologyParser::add |
( |
raptor_statement * |
statement, |
|
|
const TripleHandler & |
callback |
|
) |
| |
- Parameters
-
statement | a raptor statement |
callback | the callback to use for handling triples. |
◆ applyFrame() [1/2]
void OntologyParser::applyFrame |
( |
Triple * |
triple | ) |
|
|
protected |
Definition at line 105 of file OntologyParser.cpp.
107 if (
frame_->confidence.has_value()) {
111 if (
frame_->perspective) {
120 if (
frame_->begin.has_value()) {
123 if (
frame_->end.has_value()) {
void setConfidence(double confidence)
virtual void setPerspective(std::string_view perspective)=0
void setIsUncertain(bool isUncertain)
void setIsOccasional(bool isOccasional)
void setBegin(double begin)
◆ applyFrame() [2/2]
void knowrob::OntologyParser::applyFrame |
( |
Triple * |
triple | ) |
|
|
protected |
◆ createParser() [1/2]
Definition at line 101 of file OntologyParser.cpp.
std::string_view tripleFormatMimeType(TripleFormat format)
◆ createParser() [2/2]
◆ createWorld() [1/2]
raptor_world * OntologyParser::createWorld |
( |
| ) |
|
|
staticprotected |
Definition at line 91 of file OntologyParser.cpp.
92 auto world = raptor_new_world();
94 raptor_world_set_log_handler(world,
nullptr, raptor_log);
95 if (raptor_world_open(world) != 0) {
◆ createWorld() [2/2]
static raptor_world* knowrob::OntologyParser::createWorld |
( |
| ) |
|
|
staticprotected |
◆ flush() [1/2]
Flush the parser, pushing all remaining triples to the callback.
Definition at line 156 of file OntologyParser.cpp.
◆ flush() [2/2]
void knowrob::OntologyParser::flush |
( |
const TripleHandler & |
callback | ) |
|
Flush the parser, pushing all remaining triples to the callback.
◆ imports() [1/2]
auto& knowrob::OntologyParser::imports |
( |
| ) |
const |
|
inline |
- Returns
- the list of directly imported ontologies.
Definition at line 72 of file OntologyParser.h.
◆ imports() [2/2]
auto& knowrob::OntologyParser::imports |
( |
| ) |
const |
|
inline |
- Returns
- the list of directly imported ontologies.
Definition at line 72 of file OntologyParser.h.
◆ run() [1/2]
- Parameters
-
callback | the callback to use for handling triples. |
- Returns
- true if the parsing was successful, false otherwise.
Definition at line 168 of file OntologyParser.cpp.
170 RaptorUserData userData = {
const_cast<OntologyParser *
>(
this), callback};
171 raptor_parser_set_statement_handler(
parser_, &userData, processTriple);
174 raptor_world_set_generate_bnodeid_parameters(
175 raptor_parser_get_world(
parser_),
179 if (exit_status == 0) {
184 return (exit_status == 0);
◆ run() [2/2]
bool knowrob::OntologyParser::run |
( |
const TripleHandler & |
callback | ) |
|
- Parameters
-
callback | the callback to use for handling triples. |
- Returns
- true if the parsing was successful, false otherwise.
◆ setBlankPrefix() [1/2]
void knowrob::OntologyParser::setBlankPrefix |
( |
const std::string_view & |
blankPrefix | ) |
|
|
inline |
- Parameters
-
blankPrefix | the prefix to use for blank nodes. |
Definition at line 45 of file OntologyParser.h.
◆ setBlankPrefix() [2/2]
void knowrob::OntologyParser::setBlankPrefix |
( |
const std::string_view & |
blankPrefix | ) |
|
|
inline |
- Parameters
-
blankPrefix | the prefix to use for blank nodes. |
Definition at line 45 of file OntologyParser.h.
◆ setFilter() [1/2]
void knowrob::OntologyParser::setFilter |
( |
const TripleFilter & |
filter | ) |
|
|
inline |
- Parameters
-
filter | the filter to use for filtering triples. |
Definition at line 50 of file OntologyParser.h.
◆ setFilter() [2/2]
void knowrob::OntologyParser::setFilter |
( |
const TripleFilter & |
filter | ) |
|
|
inline |
- Parameters
-
filter | the filter to use for filtering triples. |
Definition at line 50 of file OntologyParser.h.
◆ setFrame() [1/2]
- Parameters
-
frame | the graph selector to use for filtering triples. |
Definition at line 35 of file OntologyParser.h.
◆ setFrame() [2/2]
- Parameters
-
frame | the graph selector to use for filtering triples. |
Definition at line 35 of file OntologyParser.h.
◆ setOrigin() [1/2]
void knowrob::OntologyParser::setOrigin |
( |
std::string_view |
origin | ) |
|
|
inline |
- Parameters
-
origin | the origin to use for triples. |
Definition at line 40 of file OntologyParser.h.
◆ setOrigin() [2/2]
void knowrob::OntologyParser::setOrigin |
( |
std::string_view |
origin | ) |
|
|
inline |
- Parameters
-
origin | the origin to use for triples. |
Definition at line 40 of file OntologyParser.h.
◆ blankPrefix_
std::string knowrob::OntologyParser::blankPrefix_ |
|
protected |
◆ currentBatch_
◆ doParse_
std::function< int()> knowrob::OntologyParser::doParse_ |
|
protected |
◆ filter_
◆ frame_
◆ imports_
std::vector< std::string > knowrob::OntologyParser::imports_ |
|
protected |
◆ origin_
std::string knowrob::OntologyParser::origin_ |
|
protected |
◆ parser_
raptor_parser * knowrob::OntologyParser::parser_ |
|
protected |
◆ uri_
raptor_uri * knowrob::OntologyParser::uri_ |
|
protected |
◆ uriBase_
raptor_uri * knowrob::OntologyParser::uriBase_ |
|
protected |
◆ world_
raptor_world * knowrob::OntologyParser::world_ |
|
protected |
The documentation for this class was generated from the following files: