owlcpp
v0.3.3~
C++ library for working with OWL ontologies
|
Main namespace of owlcpp library. More...
Namespaces | |
namespace | terms |
Definitions of standard OWL namespaces and terms. | |
namespace | test |
Namespace for unit-tests. |
Classes | |
class | Node_id |
Term identifier. More... | |
class | Ns_id |
struct | Lib_info |
library info More... | |
struct | base_exception |
class | Doc_id |
Document identifier. More... | |
class | Ns_iri |
Namespace IRI. More... | |
class | Node |
Pure virtual interface for RDF nodes. More... | |
struct | any |
class | Map_doc_crtpb |
struct | Doc_meta |
Document metadata. More... | |
struct | Nodes_none |
struct | Nodes_owl |
class | Map_node_blank_crtpb |
class | Node_literal |
Abstract literal node class. More... | |
class | Map_ns_crtpb |
struct | Triple |
RDF triple plus document ID. More... | |
class | Map_std_ns_crtpb |
class | Map_std_node_crtpb |
class | Rdf_list_iter_s |
Iterates over members of RDF list. More... | |
class | Map_ns_prefix |
class | Map_doc |
Store document metadata. More... | |
class | Map_node_crtpb |
class | Map_std |
Immutable static set of namespace IRIs and nodes. More... | |
struct | Crtpb_ns_node_iri |
class | Visitor_node |
class | Node_blank |
class | Map_triple_crtpb |
class | Node_iri |
class | Map_node |
Store polymorphic RDF nodes. More... | |
class | Map_triple |
Store, index, and search RDF triples. More... | |
struct | Rdf_err |
class | Map_node_literal_crtpb |
class | Map_node_iri |
Store RDF IRI nodes. More... | |
class | Triple_store |
Store namespace IRIs, RDF nodes, document infos, and RDF triples. More... | |
class | Map_ns |
Map for namespace IRIs. More... | |
class | Catalog |
Store locations, ontology IRIs, and version IRIs of OWL ontologies. More... | |
struct | Input_err |
class | Raptor_wrapper |
struct | Check_id |
struct | No_check |
class | Check_iri |
class | Check_both |
struct | fact_query_err |
struct | Select_all |
struct | Is_instance |
class | Super_sub |
Subclass/Superclass predicate. More... | |
class | Equivalent |
Test for equivalent concepts. More... | |
class | Is_name |
Test whether node has a certain short name. More... | |
class | Begins_with |
Test whether node short name begins with a certain string. More... | |
class | Can_relate |
Predicate tests whether class X can relate through a given property P to another given class C. More... | |
struct | CE_predicate |
Abstract predicate for selecting FaCT nodes. More... | |
struct | C_predicate |
struct | Logic_err |
Typedefs | |
typedef boost::any_range < Triple, boost::single_pass_traversal_tag, Triple const &, std::ptrdiff_t > | triple_any_range_t |
typedef detail::Node_literal_impl < detail::Datatype_bool > | Node_bool |
typedef detail::Node_literal_impl < detail::Datatype_int > | Node_int |
typedef detail::Node_literal_impl < detail::Datatype_unsigned > | Node_unsigned |
typedef detail::Node_literal_impl < detail::Datatype_real > | Node_double |
typedef detail::Node_literal_impl < detail::Datatype_string > | Node_string |
Functions | |
template<class ChT , class Tr > | |
std::basic_ostream< ChT, Tr > & | operator<< (std::basic_ostream< ChT, Tr > &os, Node_id const &id) |
template<class ChT , class Tr > | |
std::basic_ostream< ChT, Tr > & | operator<< (std::basic_ostream< ChT, Tr > &os, Ns_id const &id) |
template<class ChT , class Tr > | |
std::basic_ostream< ChT, Tr > & | operator<< (std::basic_ostream< ChT, Tr > &os, Doc_id const &id) |
template<class Ch , class Tr > | |
std::basic_ostream< Ch, Tr > & | operator<< (std::basic_ostream< Ch, Tr > &os, Ns_iri const &ns_iri) |
std::size_t | hash_value (Ns_iri const &n) |
Ns_iri | remove_fragment (std::string const &iri, std::size_t &n) |
remove fragment identifier from the rest of IRI string | |
Ns_iri | remove_fragment (std::string const &iri) |
remove fragment identifier from the rest of the IRI | |
std::string | add_fragment (Ns_iri const &nsiri, std::string const &frag) |
OWLCPP_RDF_DECL triple_any_range_t | find_triple (Triple_store const &ts, Node_id const *subj=0, Node_id const *pred=0, Node_id const *obj=0, Doc_id const *doc=0) |
search triples without using templates | |
std::string | to_string (Triple const &t, Triple_store const &ts) |
bool | is_literal (const Node_id nid, Triple_store const &ts) |
Node_literal const & | to_literal (Node const &node) |
template<class Out > | |
Out | value (const Node_id nid, Triple_store const &ts) |
template<class ChT , class Tr > | |
std::basic_ostream< ChT, Tr > & | operator<< (std::basic_ostream< ChT, Tr > &os, Triple const &t) |
OWLCPP_RDF_DECL std::string | to_string (Node const &) |
std::string | to_string (Node_iri const &node) |
OWLCPP_RDF_DECL std::string | to_string (Node_blank const &node) |
OWLCPP_RDF_DECL std::string | to_string (Node_bool const &node) |
OWLCPP_RDF_DECL std::string | to_string_full (Node const &, Triple_store const &) |
OWLCPP_RDF_DECL std::string | to_string_full (const Node_id, Triple_store const &) |
template<class Store > | |
std::string | to_string_full (Node_iri const &node, Store const &store) |
OWLCPP_RDF_DECL std::string | to_string_pref (Node const &, Triple_store const &) |
OWLCPP_RDF_DECL std::string | to_string_pref (const Node_id, Triple_store const &) |
template<class Store > | |
std::string | to_string_pref (Node_iri const &node, Store const &store) |
OWLCPP_RDF_DECL std::string | to_string (Node const &, Triple_store const &) |
OWLCPP_RDF_DECL std::string | to_string (const Node_id, Triple_store const &) |
template<class Store > | |
std::string | to_string (Node_iri const &node, Store const &store) |
template<class Ch , class Tr > | |
std::basic_ostream< Ch, Tr > & | operator<< (std::basic_ostream< Ch, Tr > &os, Node const &node) |
boost::iterator_range < Rdf_list_iter_s > | rdf_list (const Node_id nid, Triple_store const &ts) |
std::string | find_label (const Node_id nid, Triple_store const &store) |
template<class Range , class Src , class Dest > | |
void | copy_triples (Range const &r, Src const &src, Dest &dest) |
copy a range of triples from one store to another | |
template<class Src , class Dest > | |
void | copy_triples (Src const &src, Dest &dest) |
copy all triples from one store to another | |
OWLCPP_RDF_DECL std::string | to_string (const Ns_id) |
OWLCPP_RDF_DECL std::string | to_string (const Node_id) |
OWLCPP_RDF_DECL std::string | to_string (const Doc_id) |
BOOST_concept (Ns_store,(T)) | |
BOOST_concept (Iri_node_store,(T)) | |
BOOST_concept (Doc_store,(T)) | |
BOOST_concept (Node_store,(T)) | |
BOOST_concept (Ns_iri_node_store,(T)) | |
bool | is_empty (const Node_id id) |
bool | is_empty (const Ns_id id) |
bool | is_blank (const Ns_id id) |
bool | is_iri (const Ns_id id) |
OWLCPP_IO_DECL void | load (std::istream &stream, Triple_store &store, std::string const &path="", Check_id const &check=Check_id()) |
Load ontology from input stream ignoring imports. | |
OWLCPP_IO_DECL void | load (std::istream &stream, Triple_store &store, Catalog const &cat, std::string const &path="", Check_id const &check=Check_id()) |
Load ontology from input stream and its imports from the file system. | |
OWLCPP_IO_DECL void | load_file (boost::filesystem::path const &file, Triple_store &store, Check_id const &check=Check_id()) |
Load ontology from file ignoring imports. | |
OWLCPP_IO_DECL void | load_file (boost::filesystem::path const &file, Triple_store &store, Catalog const &cat, Check_id const &check=Check_id()) |
Load ontology from file ignoring imports. | |
OWLCPP_IO_DECL void | load_iri (std::string const &iri, Triple_store &store, Catalog const &cat) |
Load ontology identified by versionIRI or ontologyIRI and its imports. | |
OWLCPP_IO_DECL std::pair < std::string, std::string > | read_ontology_iri (std::istream &is, const std::size_t search_depth=std::numeric_limits< std::size_t >::max()) |
Find ontologyIRI and versionIRI declarations in a stream containing ontology document. | |
OWLCPP_IO_DECL std::pair < std::string, std::string > | read_ontology_iri (boost::filesystem::path const &file, const std::size_t search_depth=std::numeric_limits< std::size_t >::max()) |
find ontologyIRI and versionIRI declarations in ontology document | |
OWLCPP_IO_DECL std::size_t | add (Catalog &cat, boost::filesystem::path const &path, const bool recurse=false, const std::size_t search_depth=std::numeric_limits< std::size_t >::max()) |
determine OntologyIRI and VersionIRI of ontology document(s) and add them to the catalog | |
OWLCPP_LOGIC_DECL TDLConceptExpression * | concept (const Node_id nid, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLConceptExpression * | concept (const std::string &uri, const std::string &class_term, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLConceptExpression * | concept (const std::string &iri, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLIndividualExpression * | instance (const Node_id nid, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLIndividualExpression * | instance (const std::string &uri, const std::string &instance_term, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLObjectRoleExpression * | property (const Node_id nid, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLObjectRoleExpression * | property (const std::string &uri, const std::string &property_term, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL TDLObjectRoleExpression * | property (const std::string &iri, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL bool | is_subclass (const std::string &sub, const std::string &super, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL bool | can_relate (const std::string &c1, const std::string &p, const std::string &c2, const Triple_store &store, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL bool | can_relate (const TDLConceptExpression *c1e, const TDLObjectRoleExpression *pe, const TDLConceptExpression *c2e, ReasoningKernel &kernel) |
OWLCPP_LOGIC_DECL void | get_sub_super (const CE_predicate &pred, std::vector< std::string > &cv, const TDLConceptExpression *ce, const bool super, ReasoningKernel &kernel, const bool direct=false) |
OWLCPP_LOGIC_DECL void | get_sub_super (const std::vector< const CE_predicate * > &pred, std::vector< std::string > &cv, const TDLConceptExpression *ce, const bool super, ReasoningKernel &kernel, const bool direct=false) |
OWLCPP_LOGIC_DECL void | set_top_bottom (ReasoningKernel &) |
set top/bottom property names as short OWL names | |
template<class Range > | |
std::size_t | submit (Range r, Triple_store const &ts, ReasoningKernel &kernel, const bool strict=true, const bool diagnose=false) |
OWLCPP_LOGIC_DECL TDLAxiom * | submit (Triple const &t, Triple_store const &ts, ReasoningKernel &kernel, const bool strict=true, const bool diagnose=false) |
OWLCPP_LOGIC_DECL TDLAxiom * | submit_check (Triple const &t, Triple_store const &ts, ReasoningKernel &kernel, const bool strict=true) |
OWLCPP_LOGIC_DECL std::size_t | submit (Triple_store const &ts, ReasoningKernel &kernel, const bool strict=true, const bool diagnose=false) |
OWLCPP_LOGIC_DECL std::size_t | submit_check (Triple_store const &ts, ReasoningKernel &kernel, const bool strict=true) |
Variables | |
class OWLCPP_IO_DECL | Triple_store |
class OWLCPP_IO_DECL | Catalog |
Main namespace of owlcpp library.
OWLCPP_IO_DECL std::size_t owlcpp::add | ( | Catalog & | cat, |
boost::filesystem::path const & | path, | ||
const bool | recurse = false , |
||
const std::size_t | search_depth = std::numeric_limits< std::size_t >::max() |
||
) |
determine OntologyIRI and VersionIRI of ontology document(s) and add them to the catalog
cat | catalog; |
path | symbolic path pointing to local file or directory; any type implicitly convertible to boost::path can be used, e.g., std::string, const char* |
recurse | if true add to catalog files located in sub-directories |
search_depth | once ontologyIRI declaration is found, stop searching for versionIRI declaration after search_depth triples |
If path is a directory, an attempt will be made to parse and determine OntologyIRI and VersionIRI of every file located in it. The files that fail to parse will be ignored.
owlcpp::BOOST_concept | ( | Ns_store | , |
(T) | |||
) |
Namespace IRI store concept
owlcpp::BOOST_concept | ( | Iri_node_store | , |
(T) | |||
) |
IRI node store concept
owlcpp::BOOST_concept | ( | Doc_store | , |
(T) | |||
) |
Document info store concept
owlcpp::BOOST_concept | ( | Node_store | , |
(T) | |||
) |
IRI, blank and literal node store concept
owlcpp::BOOST_concept | ( | Ns_iri_node_store | , |
(T) | |||
) |
Namespace IRI and node IRI store concept
OWLCPP_LOGIC_DECL bool owlcpp::can_relate | ( | const std::string & | c1, |
const std::string & | p, | ||
const std::string & | c2, | ||
const Triple_store & | store, | ||
ReasoningKernel & | kernel | ||
) |
Given individuals c1i->c1 and c2i->c2,
determine if relationship c1i.p(c2i) is satisfiable
OWLCPP_LOGIC_DECL TDLConceptExpression* owlcpp::concept | ( | const Node_id | nid, |
const Triple_store & | store, | ||
ReasoningKernel & | kernel | ||
) |
nid | |
store | |
kernel |
Logic_err | if the node does not represent a concept |
OWLCPP_LOGIC_DECL TDLConceptExpression* owlcpp::concept | ( | const std::string & | iri, |
const Triple_store & | store, | ||
ReasoningKernel & | kernel | ||
) |
exception | if not present in store |
|
inline |
copy a range of triples from one store to another
IRIs, nodes, document info-s are also copied
r | source range of triples |
src | source triple store |
dest | destination triple store |
base_exception | if ts1 contains document already present in ts2 |
|
inline |
copy all triples from one store to another
IRIs, nodes, document info-s are also copied
src | source of triples |
dest | destination |
base_exception | if ts1 contains document already present in ts2 |
OWLCPP_LOGIC_DECL void owlcpp::get_sub_super | ( | const std::vector< const CE_predicate * > & | pred, |
std::vector< std::string > & | cv, | ||
const TDLConceptExpression * | ce, | ||
const bool | super, | ||
ReasoningKernel & | kernel, | ||
const bool | direct = false |
||
) |
Find sub/super classes of @a ce that satisfy all conditions in @a pred
pred | vector of predicates | |
[out] | cv | names of discovered class will be inserted |
ce | search for ancestors/descendants of this class | |
super | search for super-classes if true | |
kernel | reasoning kernel | |
direct | search for direct ancestors/descendants if true |
|
inline |
OWLCPP_IO_DECL void owlcpp::load | ( | std::istream & | stream, |
Triple_store & | store, | ||
std::string const & | path = "" , |
||
Check_id const & | check = Check_id() |
||
) |
Load ontology from input stream ignoring imports.
stream | STL input stream |
store | triple store |
path | optional path to ontology document, used for identification only |
check | reference to a polymorphic class that checks that the input ontology has the expected ontologyIRI and versionIRI. |
Input_err | if input ontology contains an error or an ontology with the same ID has already been loaded into the triple store. If an exception is thrown, the destination triple store SHOULD remain unchanged. |
OWLCPP_IO_DECL void owlcpp::load | ( | std::istream & | stream, |
Triple_store & | store, | ||
Catalog const & | cat, | ||
std::string const & | path = "" , |
||
Check_id const & | check = Check_id() |
||
) |
Load ontology from input stream and its imports from the file system.
stream | STL input stream |
store | triple store |
cat | catalog of ontology documents used for locating imports |
path | optional path to ontology document, used for identification only |
check | reference to a polymorphic class that checks that the input ontology has the expected ontologyIRI and versionIRI. |
Input_err | if input ontology contains an error or an ontology with the same ID has already been loaded into the triple store. If an exception is thrown, the destination triple store SHOULD remain unchanged. |
OWLCPP_IO_DECL void owlcpp::load_file | ( | boost::filesystem::path const & | file, |
Triple_store & | store, | ||
Check_id const & | check = Check_id() |
||
) |
Load ontology from file ignoring imports.
file | filesystem path to ontology document |
store | triple store |
check | reference to a polymorphic class that checks that the input ontology has the expected ontologyIRI and versionIRI. |
Input_err | if input ontology contains an error or an ontology with the same ID has already been loaded into the triple store. If an exception is thrown, the destination triple store SHOULD remain unchanged. |
OWLCPP_IO_DECL void owlcpp::load_file | ( | boost::filesystem::path const & | file, |
Triple_store & | store, | ||
Catalog const & | cat, | ||
Check_id const & | check = Check_id() |
||
) |
Load ontology from file ignoring imports.
file | filesystem path to ontology document |
store | triple store |
cat | catalog of ontology documents used for locating imports |
check | reference to a polymorphic class that checks that the input ontology has the expected ontologyIRI and versionIRI. |
Input_err | if input ontology contains an error or an ontology with the same ID has already been loaded into the triple store. If an exception is thrown, the destination triple store SHOULD remain unchanged. |
OWLCPP_IO_DECL void owlcpp::load_iri | ( | std::string const & | iri, |
Triple_store & | store, | ||
Catalog const & | cat | ||
) |
Load ontology identified by versionIRI or ontologyIRI and its imports.
iri | ontology versionIRI or ontologyIRI |
store | triple store |
cat | catalog of ontology documents used for locating imports |
Input_err | if input ontology contains an error or an ontology with the same ID has already been loaded into the triple store. If an exception is thrown, the destination triple store SHOULD remain unchanged. |
|
inline |
nid | node ID of the subject of the first triple of RDF list |
ts | triple store |
Example of a list:
OWLCPP_IO_DECL std::pair<std::string,std::string> owlcpp::read_ontology_iri | ( | std::istream & | is, |
const std::size_t | search_depth = std::numeric_limits< std::size_t >::max() |
||
) |
Find ontologyIRI and versionIRI declarations in a stream containing ontology document.
is | input stream containing ontology document |
search_depth | once ontologyIRI declaration is found, stop searching for versionIRI declaration after search_depth triples |
OWLCPP_IO_DECL std::pair<std::string,std::string> owlcpp::read_ontology_iri | ( | boost::filesystem::path const & | file, |
const std::size_t | search_depth = std::numeric_limits< std::size_t >::max() |
||
) |
find ontologyIRI and versionIRI declarations in ontology document
file | filesystem path to ontology document |
search_depth | once ontologyIRI declaration is found, stop searching for versionIRI declaration after search_depth triples |
|
inline |
remove fragment identifier from the rest of IRI string
[in] | iri | IRI string |
[out] | n | position of the first character in fragment identifier or iri.size() if fragment not found |
|
inline |
remove fragment identifier from the rest of the IRI
[in] | iri | IRI string |
|
inline |
Convert a range of RDF triples to axioms and submit them to reasoning kernel
r | iterator range of triples |
ts | triple store |
kernel | FaCT++ reasoning kernel |
strict | if true (default), all requirements specified in http://www.w3.org/TR/2009/REC-owl2-mapping-to-rdf-20091027/ are enforced |
diagnose | if true, perform classification after each submitted axiom |
OWLCPP_LOGIC_DECL TDLAxiom* owlcpp::submit | ( | Triple const & | t, |
Triple_store const & | ts, | ||
ReasoningKernel & | kernel, | ||
const bool | strict = true , |
||
const bool | diagnose = false |
||
) |
If triple produces axiom, submit axiom to reasoning kernel
t | triple |
ts | triple store |
kernel | FaCT++ reasoning kernel |
strict | if true (default), all requirements specified in http://www.w3.org/TR/2009/REC-owl2-mapping-to-rdf-20091027/ are enforced |
diagnose | use submit_check(Triple const&, Triple_store const&, ReasoningKernel&, const bool) method, if true |
OWLCPP_LOGIC_DECL std::size_t owlcpp::submit | ( | Triple_store const & | ts, |
ReasoningKernel & | kernel, | ||
const bool | strict = true , |
||
const bool | diagnose = false |
||
) |
Convert all stored RDF triples to axioms and submit them to reasoning kernel
ts | triple store |
kernel | FaCT++ reasoning kernel |
strict | if true (default), all requirements specified in http://www.w3.org/TR/2009/REC-owl2-mapping-to-rdf-20091027/ are enforced |
diagnose | use submit_check(Triple_store const&, ReasoningKernel&, const bool) method, if true |
OWLCPP_LOGIC_DECL TDLAxiom* owlcpp::submit_check | ( | Triple const & | t, |
Triple_store const & | ts, | ||
ReasoningKernel & | kernel, | ||
const bool | strict = true |
||
) |
If triple produces axiom, submit axiom to reasoning kernel and
perform classification. Use this method to test whether triple/axiom produces reasoning error.
t | triple |
ts | triple store |
kernel | FaCT++ reasoning kernel |
strict | if true (default), all requirements specified in http://www.w3.org/TR/2009/REC-owl2-mapping-to-rdf-20091027/ are enforced |
OWLCPP_LOGIC_DECL std::size_t owlcpp::submit_check | ( | Triple_store const & | ts, |
ReasoningKernel & | kernel, | ||
const bool | strict = true |
||
) |
Convert all stored RDF triples to axioms and submit them to reasoning kernel
performing classification after each submitted axiom. Use this method to find which triple/axiom produces reasoning error.
ts | triple store |
kernel | FaCT++ reasoning kernel |
strict | if true (default), all requirements specified in http://www.w3.org/TR/2009/REC-owl2-mapping-to-rdf-20091027/ are enforced |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | const Ns_id | ) |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | Node const & | ) |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | const Node_id | ) |
|
inline |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | const Doc_id | ) |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | Node_blank const & | node | ) |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | Node_bool const & | node | ) |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | Node const & | , |
Triple_store const & | |||
) |
OWLCPP_RDF_DECL std::string owlcpp::to_string | ( | const Node_id | , |
Triple_store const & | |||
) |
|
inline |
OWLCPP_RDF_DECL std::string owlcpp::to_string_full | ( | Node const & | , |
Triple_store const & | |||
) |
OWLCPP_RDF_DECL std::string owlcpp::to_string_full | ( | const Node_id | , |
Triple_store const & | |||
) |
|
inline |
OWLCPP_RDF_DECL std::string owlcpp::to_string_pref | ( | Node const & | , |
Triple_store const & | |||
) |
OWLCPP_RDF_DECL std::string owlcpp::to_string_pref | ( | const Node_id | , |
Triple_store const & | |||
) |
|
inline |