-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtttp.php
More file actions
55 lines (41 loc) · 1.31 KB
/
tttp.php
File metadata and controls
55 lines (41 loc) · 1.31 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
49
50
51
52
53
54
<?php
/**
* User: Hans-Gert Gräbe
* Last Update: 2019-10-09
* Dislaying the result of the TRIZ Trainer Translation Project
*/
require_once 'lib/EasyRdf.php';
require_once 'helper.php';
// output settings
//=========================
ini_set('default_charset', 'utf-8');
function displayTranslations($s) {
EasyRdf_Namespace::set('tt', 'http://triztrainer.ru/rdf/Model#');
EasyRdf_Namespace::set('ttr', 'http://triztrainer.ru/rdf/Record/');
$graph = new EasyRdf_Graph("http://triztrainer.ru/rdf/Records/");
$graph->parseFile($s);
$res = $graph->allOfType('tt:Entry');
$a=array();
foreach ($res as $v) {
$uri=str_replace('http://triztrainer.ru/rdf/Record/','',$v->getURI());
$de=$v->getLiteral('tt:text','de');
$ru=$v->getLiteral('tt:text','ru');
// $a[]="$uri|$ru|$de";
$a[]="<tr><td>$uri</td><td>$ru</td><td>$de</td><tr>";
}
return join("\n",$a);
}
function main() {
$src="rdf/tt-texts.rdf";
$out='<h2> The TRIZ Trainer Translation Project</h2>
<p>This is an experimental setting only. </p>
<p><a href="rdf/tt-texts.csv">Translation as CSV</a></p>
<table align="center" border="2" width="90%">
<tr><th> ID </th><th> Russian </th><th> German </th></tr>
'.displayTranslations($src).'
</table>
';
return htmlEnv($out);
}
echo main();
?>