[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/729 All tests pass with `docker/build.sh -t -n -i` VOTE +1 ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/729 just pushed a fix for the double issueit was easy - pretty much as @FlorianHockmann deduced. re-running docker build now. ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user FlorianHockmann commented on the issue: https://github.com/apache/tinkerpop/pull/729 > The .net build is failing: `Double` seems to be a type that we didn't have in the traversal API until now. It should be simply mapped to `double` in C#. This should only require an addition to the `toCSharpTypeMap` in Gremlin.Net's [`generate.groovy`](https://github.com/apache/tinkerpop/blob/master/gremlin-dotnet/glv/generate.groovy#L29). ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/729 The .net build is failing: ```text Process/Traversal/GraphTraversal.cs(500,36): error CS0246: The type or namespace name 'Double' could not be found (are you missing a using directive or an assembly reference?) [/usr/src/tinkerpop/gremlin-dotnet/src/Gremlin.Net/Gremlin.Net.csproj] Process/Traversal/__.cs(414,46): error CS0246: The type or namespace name 'Double' could not be found (are you missing a using directive or an assembly reference?) [/usr/src/tinkerpop/gremlin-dotnet/src/Gremlin.Net/Gremlin.Net.csproj] ``` ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/729 I just unzipped the jar and the META-INF/ does not contain it. Just a pom.xml in there. ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/729 Does exp4j contain a NOTICE file in its jar (usually in `/META-INF`)? ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user twilmes commented on the issue: https://github.com/apache/tinkerpop/pull/729 This is going to come in super handy. A hearty VOTE: +1 ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user okram commented on the issue: https://github.com/apache/tinkerpop/pull/729 ``` [INFO] [INFO] BUILD SUCCESS [INFO] [INFO] Total time: 02:34 h [INFO] Finished at: 2017-10-04T16:21:53-06:00 [INFO] Final Memory: 165M/1543M [INFO] ``` ---
[GitHub] tinkerpop issue #729: TINKERPOP-1632: Create a set of default functions
Github user dkuppitz commented on the issue: https://github.com/apache/tinkerpop/pull/729 You can add a static compiled regex pattern: ``` private static final Pattern EQUATION_PATTERN = Pattern.compile("\\b(?!abs|acos|asin|atan|cbrt|ceil|cos|cosh|exp|floor|log|log10|log2|sin|sinh|sqrt|tan|tanh|signum)(_|([A-Za-z][A-Za-z0-9]*))\\b"); ``` ...then `getVariables()` can be as simple as: ``` protected static final Set getVariables(final String equation) { final Matcher matcher = EQUATION_PATTERN.matcher(equation); final Set variables = new LinkedHashSet<>(); while (matcher.find()) { variables.add(matcher.group()); } return variables; } ``` And perhaps to increase the readability and maintainability, we should do something like this: ``` private static final String[] FUNCTIONS = new String[] { "abs", "acos", "asin", "atan", "cbrt", "ceil", "cos", "cosh", "exp", "floor", "log", "log10", "log2", "signum", "sin", "sinh", "sqrt", "tan", "tanh" }; private static final Pattern EQUATION_PATTERN = Pattern.compile("\\b(?!" + String.join("|", FUNCTIONS) + ")(_|([A-Za-z][A-Za-z0-9]*))\\b"); ``` ---