Skip to content

Commit 9f81eda

Browse files
authored
add in graph database support (#654)
1 parent 162378f commit 9f81eda

File tree

7 files changed

+228
-23
lines changed

7 files changed

+228
-23
lines changed

LANGUAGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ Crystal (cr)
7272
CSS (css)
7373
CSV (csv)
7474
Cuda (cu)
75+
Cypher (cypher,cql)
7576
Cython (pyx,pxi,pxd)
7677
D (d)
7778
DAML (daml)
@@ -122,6 +123,7 @@ Go+ (gop)
122123
Godot Scene (tscn)
123124
Gradle (gradle)
124125
GraphQL (graphql)
126+
Gremlin (gremlin)
125127
Groovy (groovy,grt,gtpl,gvy)
126128
Gwion (gw)
127129
HAML (haml)

SCC-OUTPUT-REPORT.html

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@
1313
<tbody><tr>
1414
<th>Go</th>
1515
<th>27</th>
16-
<th>23414</th>
16+
<th>23501</th>
1717
<th>1456</th>
1818
<th>439</th>
19-
<th>21519</th>
19+
<th>21606</th>
2020
<th>1423</th>
21-
<th>456460</th>
22-
<th>6380</th>
21+
<th>457896</th>
22+
<th>6406</th>
2323
</tr><tr>
2424
<td>processor/constants.go</td>
2525
<td></td>
26-
<td>13480</td>
26+
<td>13567</td>
2727
<td>1</td>
2828
<td>2</td>
29-
<td>13477</td>
29+
<td>13564</td>
3030
<td>0</td>
31-
<td>211234</td>
32-
<td>2066</td>
31+
<td>212670</td>
32+
<td>2092</td>
3333
</tr><tr>
3434
<td>processor/formatters_test.go</td>
3535
<td></td>
@@ -250,16 +250,6 @@
250250
<td>0</td>
251251
<td>2209</td>
252252
<td>35</td>
253-
</tr><tr>
254-
<td>processor/bloom.go</td>
255-
<td></td>
256-
<td>37</td>
257-
<td>7</td>
258-
<td>12</td>
259-
<td>18</td>
260-
<td>2</td>
261-
<td>1062</td>
262-
<td>29</td>
263253
</tr><tr>
264254
<td>processor/cocomo_test.go</td>
265255
<td></td>
@@ -270,6 +260,16 @@
270260
<td>6</td>
271261
<td>686</td>
272262
<td>23</td>
263+
</tr><tr>
264+
<td>processor/bloom.go</td>
265+
<td></td>
266+
<td>37</td>
267+
<td>7</td>
268+
<td>12</td>
269+
<td>18</td>
270+
<td>2</td>
271+
<td>1062</td>
272+
<td>29</td>
273273
</tr><tr>
274274
<td>processor/helpers_test.go</td>
275275
<td></td>
@@ -294,15 +294,15 @@
294294
<tfoot><tr>
295295
<th>Total</th>
296296
<th>27</th>
297-
<th>23414</th>
297+
<th>23501</th>
298298
<th>1456</th>
299299
<th>439</th>
300-
<th>21519</th>
300+
<th>21606</th>
301301
<th>1423</th>
302-
<th>456460</th>
303-
<th>6380</th>
302+
<th>457896</th>
303+
<th>6406</th>
304304
</tr>
305305
<tr>
306-
<th colspan="9">Estimated Cost to Develop (organic) $677,732<br>Estimated Schedule Effort (organic) 11.86 months<br>Estimated People Required (organic) 5.08<br></th>
306+
<th colspan="9">Estimated Cost to Develop (organic) $680,610<br>Estimated Schedule Effort (organic) 11.88 months<br>Estimated People Required (organic) 5.09<br></th>
307307
</tr></tfoot>
308308
</table></body></html>

examples/language/cypher.cypher

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// movies.cypher
2+
// Example query to test scc complexity definitions for Cypher.
3+
4+
/*
5+
This multi-line block explains the query's purpose.
6+
It finds actors who co-starred with "Tom Hanks" and then
7+
looks for paths of up to 5 steps to "Kevin Bacon".
8+
*/
9+
10+
// Find Tom Hanks' co-actors
11+
MATCH (tom:Actor {name: 'Tom Hanks'})-[:ACTED_IN]->(m:Movie)<-[:ACTED_IN]-(coActor:Actor)
12+
WHERE coActor.name <> "Tom Hanks"
13+
14+
// Now, check for a connection to Kevin Bacon
15+
WITH coActor
16+
MATCH (bacon:Actor {name: "Kevin Bacon"})
17+
// This is a variable-length path, indicating higher complexity
18+
MATCH p = shortestPath((coActor)-[*..5]-(bacon))
19+
20+
// UNION is another complexity check
21+
UNION
22+
23+
// An optional match for actors born after 1960
24+
MATCH (youngActor:Actor)
25+
WHERE youngActor.born > 1960
26+
OPTIONAL MATCH (youngActor)-[:DIRECTED]->(anyMovie:Movie)
27+
28+
RETURN youngActor.name, anyMovie.title;

examples/language/gremlin.gremlin

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// social_graph.gremlin
2+
// Example traversal to test scc complexity definitions for Gremlin.
3+
4+
// Find a person named "Marko" and get his age
5+
marko = g.V().has('person','name','marko').values('age')
6+
7+
// This traversal finds Marko's friends and their friends,
8+
// but emits the path along the way, which adds complexity.
9+
g.V().has('person', 'name', 'marko').
10+
repeat(out('knows')).
11+
emit().
12+
path().by('name')
13+
14+
// A more complex query to find people Marko knows who are over 30
15+
// and also know someone who created software.
16+
// The .where() and .and() steps increase complexity.
17+
g.V().has('person','name','marko').out('knows').as('friend').
18+
where(
19+
values('age').is(gt(30))
20+
).
21+
and(
22+
out('created').has('name', 'lop')
23+
).
24+
values('name')
25+
26+
// Using .union() to combine two different traversal paths
27+
g.V().has('person','name','josh').
28+
union(
29+
out('created').values('name'), // what he created
30+
in('created').values('name') // who created things with him
31+
)

languages.json

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2856,6 +2856,61 @@
28562856
"multi_line": [["{{/*", "*/}}"]],
28572857
"quotes": []
28582858
},
2859+
"Cypher": {
2860+
"complexitychecks": [
2861+
"MATCH",
2862+
"OPTIONAL MATCH",
2863+
"WHERE",
2864+
"UNION",
2865+
"CALL",
2866+
"UNWIND",
2867+
"STARTS WITH",
2868+
"ENDS WITH",
2869+
"CONTAINS",
2870+
"shortestPath",
2871+
"allShortestPaths",
2872+
"-[*..]->"
2873+
],
2874+
"extensions": ["cypher", "cql"],
2875+
"line_comment": ["//"],
2876+
"multi_line": [["/*", "*/"]],
2877+
"quotes": [
2878+
{
2879+
"end": "'",
2880+
"start": "'"
2881+
},
2882+
{
2883+
"end": "\"",
2884+
"start": "\""
2885+
}
2886+
]
2887+
},
2888+
"Gremlin": {
2889+
"complexitychecks": [
2890+
".where(",
2891+
".union(",
2892+
".repeat(",
2893+
".emit(",
2894+
".and(",
2895+
".or(",
2896+
".not(",
2897+
".as(",
2898+
".by("
2899+
],
2900+
"extensions": ["gremlin"],
2901+
"line_comment": ["//"],
2902+
"multi_line": [],
2903+
"quotes": [
2904+
{
2905+
"end": "'",
2906+
"start": "'"
2907+
},
2908+
{
2909+
"end": "\"",
2910+
"start": "\""
2911+
}
2912+
]
2913+
},
28592914
"Godot Scene": {
28602915
"complexitychecks": [],
28612916
"extensions": ["tscn"],

processor/constants.go

Lines changed: 87 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test-all.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -879,6 +879,7 @@ specificLanguages=(
879879
'Clojure '
880880
'CMake '
881881
'Cuda '
882+
'Cypher'
882883
'DAML '
883884
'DM '
884885
'Docker ignore '
@@ -899,6 +900,7 @@ specificLanguages=(
899900
'Go+ '
900901
'Godot Scene '
901902
'GraphQL '
903+
'Gremlin '
902904
'Gwion '
903905
'HAML '
904906
'Hare '

0 commit comments

Comments
 (0)