-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathnamespaces.cpp
More file actions
32 lines (25 loc) · 913 Bytes
/
namespaces.cpp
File metadata and controls
32 lines (25 loc) · 913 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <rdf4cpp.hpp>
#include <iostream>
int main() {
using namespace rdf4cpp;
Namespace ex("http://example.com/");
IRI ex_A = ex + "A";
std::cout << ex_A << std::endl;
assert(ex_A.identifier() == "http://example.com/A");
ex.clear();
ex_A = ex + "A";
std::cout << ex_A << std::endl;
assert(ex_A.identifier() == "http://example.com/A");
auto rdf = namespaces::RDF();
auto rdf_Property = rdf + "Property";
std::cout << rdf_Property << std::endl;
assert(rdf_Property.identifier() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#Property");
auto rdf_15 = rdf + "_15";
std::cout << rdf_15 << std::endl;
assert(rdf_15.identifier() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#_15");
try {
[[maybe_unused]] auto random = rdf + "random";
} catch (std::runtime_error const &ex) {
std::cerr << ex.what() << std::endl;
}
}