diff --git a/code/infrastructure/eval/query/memgraph/queries/queries.txt b/code/infrastructure/eval/query/memgraph/queries/queries.txt index 4d0b8950e14721a99b7598ca0cbdf2a22bb6cd6e..b07ff75145b9fe19988c5a1da33b04d7db8899b6 100644 --- a/code/infrastructure/eval/query/memgraph/queries/queries.txt +++ b/code/infrastructure/eval/query/memgraph/queries/queries.txt @@ -1,4 +1,4 @@ -count|MATCH (n) return count(n); +count|MATCH (n) return n; anc|MATCH path=(node:Host)-[*]->(ancestor) RETURN ancestor, size(path) AS distance_upstream ORDER BY distance_upstream; desc|MATCH path=(node:Host)<-[*]-(descendant) RETURN descendant, size(path) AS distance_downstream ORDER BY distance_downstream; path|MATCH path = ((a {_uuid: 'A6A7C956-0132-5506-96D1-2A7DE97CB400'})-[*ALLSHORTEST(r,n|1)]->(b {_uuid:'8DA367BF-36C2-11E8-BF66-D9AA8AFF4A69'})) RETURN path; diff --git a/code/infrastructure/eval/query/neo4j/queries/queries.txt b/code/infrastructure/eval/query/neo4j/queries/queries.txt index d93ecc1212bf8d3b59a085d0fe78ac4d0cfd90f8..d07bb80fd8d316aa07da10fac40cf6159ae714e8 100644 --- a/code/infrastructure/eval/query/neo4j/queries/queries.txt +++ b/code/infrastructure/eval/query/neo4j/queries/queries.txt @@ -1,5 +1,5 @@ -count|MATCH (n) return count(n); +count|MATCH (n) return n; anc|MATCH path=(node:Host)-[*]->(ancestor) RETURN ancestor, length(path) AS distance_upstream ORDER BY distance_upstream; desc|MATCH path=(node:Host)<-[*]-(descendant) RETURN descendant, length(path) AS distance_downstream ORDER BY distance_downstream; -path|MATCH path = shortestPath((a:Subject WHERE a._uuid='0CF2BB3E-36B8-11E8-BF66-D9AA8AFF4A69') -[*]- (b:FileObject WHERE b._uuid = '586C56DA-CB56-745E-96CB-52069E742598')) RETURN path; +path|MATCH path = shortestPath((a WHERE a._uuid='A6A7C956-0132-5506-96D1-2A7DE97CB400') -[*]-> (b:FileObject WHERE b._uuid = '8DA367BF-36C2-11E8-BF66-D9AA8AFF4A69')) RETURN path; 2-hop|MATCH (startNode WHERE startNode._uuid = '9FF334BB-9072-D756-B290-556656D73728')-[*1..2]-(neighborhood) RETURN neighborhood; diff --git a/code/infrastructure/eval/query/ongdb/queries/queries.txt b/code/infrastructure/eval/query/ongdb/queries/queries.txt index 629bfb380e12763106374fb07306f1c54fd4e4ed..fab926190662c371c4096f7b39fcedb894001350 100644 --- a/code/infrastructure/eval/query/ongdb/queries/queries.txt +++ b/code/infrastructure/eval/query/ongdb/queries/queries.txt @@ -1,5 +1,5 @@ -count|MATCH (n) return count(n); +count|MATCH (n) return n; anc|MATCH path=(node:Host)-[*]->(ancestor) RETURN ancestor, length(path) AS distance_upstream ORDER BY distance_upstream; desc|MATCH path=(node:Host)<-[*]-(descendant) RETURN descendant, length(path) AS distance_downstream ORDER BY distance_downstream; -path|MATCH (a:Subject) WHERE a._uuid = '0CF2BB3E-36B8-11E8-BF66-D9AA8AFF4A69' MATCH (b:FileObject) where b._uuid='586C56DA-CB56-745E-96CB-52069E742598' WITH a, b MATCH path = shortestPath((a)-[*]-(b)) RETURN path +path|MATCH (a) WHERE a._uuid = 'A6A7C956-0132-5506-96D1-2A7DE97CB400' MATCH (b:FileObject) where b._uuid='8DA367BF-36C2-11E8-BF66-D9AA8AFF4A69' WITH a, b MATCH path = shortestPath((a)-[*]->(b)) RETURN path 2-hop|MATCH (startNode) -[*1..2]-(neighborhood) WHERE startNode._uuid = '9FF334BB-9072-D756-B290-556656D73728' RETURN neighborhood \ No newline at end of file diff --git a/code/infrastructure/eval/query/pg/queries/queries.txt b/code/infrastructure/eval/query/pg/queries/queries.txt index 10b02a9c29e57ce1d709d3c3deb7d331f701d42e..13e7a8deff2006904363f1bcee40e6d84c3807ad 100644 --- a/code/infrastructure/eval/query/pg/queries/queries.txt +++ b/code/infrastructure/eval/query/pg/queries/queries.txt @@ -1,4 +1,6 @@ -ancestors|WITH RECURSIVE AncestorCTE AS ( +count|select * from node_list; +--- +anc|WITH RECURSIVE AncestorCTE AS ( SELECT n.node_no, e.dest, n.type, 1 AS Level FROM node_list n JOIN edge_list e ON n.uuid = e.source @@ -14,21 +16,36 @@ ancestors|WITH RECURSIVE AncestorCTE AS ( ) SELECT DISTINCT node_no, dest, type, Level FROM AncestorCTE; --- -descendant|WITH RECURSIVE DescendantCTE AS ( - SELECT n.node_no, e.source, 1 AS Level - FROM node_list n - JOIN edge_list e ON n.uuid = e.dest - WHERE n.node_no = 1 -- Replace with the desired starting node_no - - UNION ALL - - SELECT n.node_no, e.source, a.Level + 1 - FROM node_list n - JOIN edge_list e ON n.uuid = e.dest - JOIN DescendantCTE a ON e.source = n.uuid - WHERE a.Level < 3 -- Replace with the desired level +desc|WITH RECURSIVE NodeCTE AS ( + -- Initial selection + SELECT + n.node_no, + e.source, + e.dest, + 1 AS Level + FROM + node_list n + JOIN + edge_list e ON n.uuid = e.dest + WHERE + n.node_no = 1 -- Replace with the desired starting node_no + + UNION ALL + + -- Recursive selection + SELECT + n.node_no, + e.source, + e.dest, + c.Level + 1 AS Level + FROM + edge_list e + JOIN + NodeCTE c ON e.dest = c.source + JOIN + node_list n ON e.dest = n.uuid ) -SELECT DISTINCT node_no, source, Level FROM DescendantCTE; +SELECT * FROM NodeCTE; --- path|WITH RECURSIVE search_path(edge_no, path, dest, visited, depth) AS ( SELECT @@ -73,7 +90,7 @@ SELECT FROM shortest_paths; --- -k-hop|WITH hop1 AS ( +2-hop|WITH hop1 AS ( SELECT DISTINCT e.source, e.dest FROM edge_list e WHERE e.source = '9FF334BB-9072-D756-B290-556656D73728' @@ -95,4 +112,4 @@ FROM ( UNION ALL SELECT dest FROM hop2 ) AS all_nodes ---WHERE node <> '9FF334BB-9072-D756-B290-556656D73728' +WHERE node <> '9FF334BB-9072-D756-B290-556656D73728'