-
Notifications
You must be signed in to change notification settings - Fork 0
/
db_profile.php
122 lines (91 loc) · 4 KB
/
db_profile.php
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
include_once ("./header.php");
include_once ("./onto_array.php");
include_once ("./appvars.php");
include_once ("./entity_helper.php");
include_once ("./db_helper.php");
function render_class_table($dbc, $db_name, $active_class) {
$query = "select value, count from cls order by count desc";
$result = mysqli_query($dbc, $query) or die('Error querying database1.');
while ($row = mysqli_fetch_array($result)) {
$value = $row[0];
$count = $row[1];
echo '<li ';
if (isset($active_class) && ($active_class == $value)) {
echo 'class = "active"';
}
echo '><a href = "db_profile.php?';
echo 'db_name=' . $db_name . '&active_class=' . $value . '">' . $value . ' <span class="badge">' . $count . '</span>' . '</a></li>';
}
}
if (isset($_GET['active_class'])) {
$active_class = $_GET['active_class'];
}
$num_of_entities = get_num_of_entities($dbc);
$num_of_facts = get_num_of_facts($dbc);
$num_of_relations = get_num_of_relations($dbc);
$num_of_literals = get_num_of_literals($dbc);
?>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-146052-10']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script');
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<div class="container">
<h1><?php echo $db_labels[$db_name]; ?></h1>
<p>
该系统包括<?php echo $num_of_entities; ?>个实体,<?php echo $num_of_facts; ?>条陈述:</p>
<ul class="nav nav-tabs">
<li class="active"><a href="#">实体 <?php echo '<span class="badge">' . $num_of_entities . '</span>' ?></a></li>
<li><a href="db_property_profile.php?db_name=<?php echo $db_name; ?>">语义关系 <?php echo '<span class="badge">' . $num_of_relations . '</span>' ?></a></li>
<li><a href="db_literal_profile.php?db_name=<?php echo $db_name; ?>">文字属性 <?php echo '<span class="badge">' . $num_of_literals . '</span>' ?></a></li>
</ul>
<p></p>
</div>
<div class="container ">
<div class="row">
<div class="col-md-3">
<ul class="well nav nav-pills nav-stacked">
<?php render_class_table($dbc, $db_name, $active_class); ?>
</ul>
</div>
<div class="col-md-9" role="main">
<div>
<?php
if (isset($active_class)) {
//echo '<h2>' . $active_class . '</h2>';
//echo '<div class="well">';
echo '<ul class="nav well nav-pills">';
$query = "select subject from graph where property = '" . ENTITY_TYPE . "' and value = '$active_class' order by subject asc";
/*
if (isset($_GET['limit'])){
$query .= ' limit ' . $_GET['limit'];
} */
$result = mysqli_query($dbc, $query) or die('Error querying database2.');
$n = 0;
while ($row = mysqli_fetch_array($result)) {
echo '<li>' . render_value($dbc, $db_name, $row[subject], false) . "</li>";
$n = $n + 1;
}
/*
if (isset($_GET['limit'])&&($n == $_GET['limit']))
echo '更多>>'; */
echo '</ul>';
} else {
render_warning('<<请在右侧选择类型以查看其实例');
}
?>
</div>
</div>
</div>
</div>
<?php
include_once ("./foot.php");
?>