diff --git a/jena/path2.qry b/jena/path2.qry new file mode 100644 index 0000000000000000000000000000000000000000..13a3252c6dd5775af20ce21e39a662cd64e38939 --- /dev/null +++ b/jena/path2.qry @@ -0,0 +1,2 @@ +prefix : <http://example.org/stuff/1.0/> +SELECT (count(*) as ?resultcount) WHERE {?a :par / :par ?b} diff --git a/neo4j/path2.qry b/neo4j/path2.qry new file mode 100644 index 0000000000000000000000000000000000000000..f9d243365881dc04691d154a65ba1de75d934bd2 --- /dev/null +++ b/neo4j/path2.qry @@ -0,0 +1,10 @@ +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]); diff --git a/souffle/path2.dl b/souffle/path2.dl new file mode 100644 index 0000000000000000000000000000000000000000..0b07c6ae0117bcf655564cd535b280e9e3cb7ae0 --- /dev/null +++ b/souffle/path2.dl @@ -0,0 +1,15 @@ + +// +// 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). diff --git a/sql/path2.sql b/sql/path2.sql new file mode 100644 index 0000000000000000000000000000000000000000..8d9a59997914908ee893eba7fb0fed6eda283c1d --- /dev/null +++ b/sql/path2.sql @@ -0,0 +1,4 @@ + +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;