File: rdf_storage.vspx

package info (click to toggle)
virtuoso-opensource 7.2.5.1%2Bdfsg1-0.3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 285,240 kB
  • sloc: ansic: 641,220; sql: 490,413; xml: 269,570; java: 83,893; javascript: 79,900; cpp: 36,927; sh: 31,653; cs: 25,702; php: 12,690; yacc: 10,227; lex: 7,601; makefile: 7,129; jsp: 4,523; awk: 1,697; perl: 1,013; ruby: 1,003; python: 326
file content (220 lines) | stat: -rw-r--r-- 6,800 bytes parent folder | download | duplicates (2)
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<?xml version="1.0" encoding="UTF-8"?>
<!--
 -
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -
 -  Copyright (C) 1998-2018 OpenLink Software
 -
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -
-->
<v:page name="blog-home-page"
        xmlns:vm="http://www.openlinksw.com/vspx/ods/"
        xmlns:v="http://www.openlinksw.com/vspx/"
        style="index.xsl"
        doctype="-//W3C//DTD XHTML 1.0 Transitional//EN"
        doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <vm:page>
    <vm:header>
      <vm:title>RDF Data Administration</vm:title>
    </vm:header>
    <v:on-init>
      if(wa_user_is_dba (connection_get('vspx_user'),null)=0)
         signal('22024', 'You have no DBA privileges!');
    </v:on-init>

    <vm:pagewrapper>
      <vm:variable name="confirm" type="integer" default="0" persist="0" param-name="cnf"/>
      <vm:variable name="what" type="varchar" default="null" persist="0"/>
      <vm:variable name="doit" type="varchar" default="null" persist="0"/>

      <vm:navigation on="settings"/>
      <vm:navigation1 on="admin"/>
      <vm:navigation2 on="endpoint"/>
      <vm:rawheader caption="RDF Data Administration"/>
      <vm:body>
	  <script type="text/javascript"><![CDATA[
function UpdateTab()
{
    var cnt = document.getElementById('message');
    var xmlhttp = null;
    try
    {
	xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e) { }

    if (xmlhttp == null)
    {
	try
	{
	    xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
	}
	catch (e) { }
    }
    if (xmlhttp == null)
	xmlhttp = new XMLHttpRequest();

    xmlhttp.open("GET", "rdf_storage_state.vsp", false);
    xmlhttp.setRequestHeader("Pragma", "no-cache");
    xmlhttp.send("");
    cnt.innerHTML = xmlhttp.responseText;
    if (xmlhttp.status != 201)
      timer = setTimeout("UpdateTab()", 3000);

}
	      ]]></script>
	  <v:on-init>
	      <![CDATA[
  declare reqs, ct any;
  reqs := http_pending_req ();
  ct := 0;
  foreach (any x in reqs) do
    {
      if (x[1] = http_path ())
        ct := ct + 1;
    }

  -- no more than one thread must run the time wait queue
  if (ct > 1)
    {
      self.confirm := -1;
    }
  ]]>
</v:on-init>
        <vm:login redirect="index.vspx"/>
        <div class="box">
          <div>
	    <v:template name="tmpl1" type="simple" condition="self.confirm = 0">
		<div class="fm">
		    <p>
			The "Rebuild RDF Data" function will clean the persisted ODS RDF data and will re-load it.<br />
			The "Rebuild RDF View" function will re-generate the ODS RDF view. <br/>
			The "Rebuild User RDF View" function will re-generate the ODS RDF view defining graph per each ODS user. <br/>
			Warning: Depending of the data volume of this ODS installation the above may take a very long time, please be patient.
		    </p>
		    <v:form name="build_f" method="POST" type="simple">
			<fieldset>
			    <span class="fm_ctl_btn">
				<v:button action="simple" name="rdf_data" value="Rebuild RDF Data">
				    <v:on-post>
					self.confirm := 1;
					self.what := 'data';
				    </v:on-post>
				</v:button>
				<v:button action="simple" name="rdf_view" value="Rebuild RDF View">
				    <v:on-post>
					self.confirm := 1;
					self.what := 'view';
				    </v:on-post>
				</v:button>
				<v:button action="simple" name="rdf_user_view" value="Rebuild User RDF View">
				    <v:on-post>
					self.confirm := 1;
					self.what := 'uview';
				    </v:on-post>
				</v:button>
			    </span>
			</fieldset>
		    </v:form>
		</div>
            </v:template>
	    <v:template name="tmpl2" type="simple" condition="self.confirm = 1">
		<div class="fm">
		    <p>
			Do you really want to rebuild the <?V case when self.what = 'view' then 'ODS RDF View' when self.what = 'uview' then 'ODS User RDF View' else 'ODS RDF Data' end ?>?
		    </p>
		    <v:form name="conf_f" method="POST" type="simple">
			<fieldset>
			    <span class="fm_ctl_btn">
				<v:button name="cancel_btn" value="No" action="simple">
				    <v:on-post>
					self.vc_redirect ('rdf_storage.vspx');
				    </v:on-post>
				</v:button>
				<v:button name="save_btn" action="submit" value="Yes">
				    <v:on-post>
					self.doit := self.what;
					self.vc_redirect ('rdf_storage.vspx?cnf=-1');
				    </v:on-post>
				</v:button>
			    </span>
			</fieldset>
		    </v:form>
		</div>
            </v:template>
	    <v:template name="tmpl3" type="simple" condition="self.confirm = -1">
		<div id="message">The ODS RDF update process is already running.</div>
	  <script type="text/javascript"><![CDATA[
setTimeout("UpdateTab()", 1000);
]]></script>
		<div class="fm">
		    <span class="fm_ctl_btn">
			<v:button name="back_btn" value="Go back to admin pages" action="simple">
			    <v:on-post>
				self.vc_redirect ('site_settings.vspx');
			    </v:on-post>
			</v:button>
		    </span>
		</div>
	    </v:template>
          </div>
        </div>
      </vm:body>
    </vm:pagewrapper>
  </vm:page>
  <?vsp
  {
    if (self.doit = 'view' or self.doit = 'data' or self.doit = 'uview')
      {
        http_flush ();
      }

    declare exit handler for sqlstate '*'
    {
      registry_set ('ods_rdf_state', sprintf ('Error: %s', regexp_match ('[^\r\n]*', __SQL_MESSAGE)));
      goto endup;
    };

    commit work;
    if (self.doit = 'view')
      {
	-- run the rdf_view composition
	registry_set ('ods_rdf_state', 'ODS RDF view update started');
	connection_set ('iri_result', 2);
	ODS_RDF_VIEW_INIT_1 (0);
	registry_set ('ods_rdf_state', 'ODS RDF view update finished');
      }
    else if (self.doit = 'uview')
      {
	-- run the rdf_view composition
	registry_set ('ods_rdf_state', 'ODS User RDF view update started');
	connection_set ('iri_result', 2);
	ODS_RDF_USER_VIEW_INIT (0);
	registry_set ('ods_rdf_state', 'ODS User RDF view update finished');
      }
    else if (self.doit = 'data')
      {
	-- run the data collecting
	registry_set ('ods_rdf_state', 'ODS RDF data update started');
	sioc..fill_ods_sioc_online (1, 2);
	registry_set ('ods_rdf_state', 'ODS RDF data update finished');
      }
    endup:;
   }
  ?>
</v:page>