Skip to content
Snippets Groups Projects
Commit 0301f743 authored by Mario Wenzel's avatar Mario Wenzel
Browse files

added path2 scripts

parent cda12829
No related branches found
No related tags found
No related merge requests found
prefix : <http://example.org/stuff/1.0/>
SELECT (count(*) as ?resultcount) WHERE {?a :par / :par ?b}
MATCH (n)
DETACH DELETE n;
LOAD CSV FROM 'file://INSTANCE' AS line
MERGE (a:Node {n: toInteger(line[0])})
MERGE (b:Node {n: toInteger(trim(line[1]))})
CREATE (a)-[:PAR]->(b);
MATCH (a)-[:PAR]->(t)-[:PAR]->(b)
RETURN COUNT(DISTINCT [a,b]);
//
// par - "parent"/"edge" relation
//
.decl par (n:number, m:number)
.input par(IO=file, filename="INSTANCE")
// par(1,2).
// par(2,3).
//.decl path2 (n:number, m:number) output
.decl path2 (n:number, m:number)
//.output path2(IO=stdout)
.printsize path2
path2(X, Y) :- par(X, Z), par(Z, Y).
WITH path2(a,b) AS (
SELECT p1.a, p2.b from par p1 JOIN par p2c ON p1.b = p2.a
) SELECT Count(*) FROM path2;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment