-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathjson.php
41 lines (29 loc) · 907 Bytes
/
json.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
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
// Konfig laden
require_once('config.php');
// Funktionen einbinden
require_once('functions.php');
// Skript initialisieren
require_once('init.php');
$c = 0;
$nodes = array();
$results = array();
$literals = array();
$nodesJSON = sparqlQuery($nodeQuery);
if ($linkQuery) {
$linksJSON = sparqlQuery($linkQuery);
}
// Alle Knoten erzeugen
foreach($nodesJSON['results']['bindings'] as $binding) {
createNode($binding['nodeuri']['value'], getTitleByUri($binding['nodetitle']['value']), $binding['shape']['value'], $binding['color']['value']);
}
// Alle Links erzeugen
if ($linkQuery) {
foreach($linksJSON['results']['bindings'] as $binding) {
createLink($binding['source']['value'], $binding['target']['value'], getTitleByUri($binding['linktitle']['value']), 10);
}
}
$results['literals'] = $literals;
echo json_encode($results);