This repository has been archived by the owner on Mar 3, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
connectSameNames.php
53 lines (43 loc) · 1.63 KB
/
connectSameNames.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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fi" lang="fi">
<head>
<?php session_start(); ?>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Taapeli - samannimiset ehdokkaat</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<?php
include 'inc/checkUserid.php';
include "inc/start.php";
include "inc/dbconnect.php";
/*
* -- Content page starts here -->
*/
echo '<h1>Kytketään kaikki saman nimen omaavat</h1>';
$query_string = "MATCH (n:Person:user0498)-[:HAS_NAME]-(a), "
. "(m:Person:user6321)-[:HAS_NAME]-(b) "
. "WHERE ((a.first_name = b.first_name) AND (a.last_name = b.last_name)) "
. "RETURN n.id, m.id";
$query = new Everyman\Neo4j\Cypher\Query($sukudb, $query_string);
$result = $query->getResultSet();
$id = $id2 = [];
foreach ($result as $rows)
{
$id[] = $rows[0];
$id2[] = $rows[1];
}
$may_be_same = 0;
for ($i=0; $i<sizeof($id); $i++) {
$may_be_same++;
$query_string = "MATCH (n:Person:user0498) WHERE n.id='" .
$id[$i] . "' MATCH (m:Person:user6321) WHERE m.id='" .
$id2[$i] . "' MERGE (n)-[r:MAY_BE_SAME]-(m) SET r.indication2 = 1";
$query = new Everyman\Neo4j\Cypher\Query($sukudb, $query_string);
$result = $query->getResultSet();
}
echo "<p>May be the same connected: " . $may_be_same . "</p>\n";
/*
* --- End of content page ---
*/
include "inc/stop.php";