Menu

[r45]: / trunk / libtop_engine / rdf_graph.cpp  Maximize  Restore  History

Download this file

49 lines (34 with data), 1.2 kB

 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "rdf_graph.h"
namespace rdf {
/////////////////////////////////////////////////////////////////////////////////////////
// print_resource_names
//
// utility function
/////////////////////////////////////////////////////////////////////////////////////////
void
print_resource_names(rdf_graph_ptr_type const& graph_p, bool including_literals)
{
rdf_graph::resource_ptr_const_iterator itor = graph_p->get_resources_iterator_begin();
rdf_graph::resource_ptr_const_iterator end = graph_p->get_resources_iterator_end();
typedef std::vector<std::string> v_str;
v_str v;
v.reserve(200);
for(; itor!=end; ++itor) {
if((*itor)->is_resource()) {
v.push_back((*itor)->get_name());
}
}
std::sort(v.begin(), v.end());
v_str::const_iterator vitor = v.begin();
v_str::const_iterator vend = v.end();
for(; vitor!=vend; ++vitor) {
std::string const& name = *vitor;
std::cout << "\t" << name;
if(name.size() < 8) std::cout << "\t";
if(name.size() < 16) std::cout << "\t";
if(name.size() < 24) std::cout << "\t";
if(name.size() < 32) std::cout << "\t";
std::cout << " = resource(\"" << name << "\")\n";
}
};
}; /* rdf namespace */
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.