Browse files

first push on the massive refactoring of Gremlin into Gremlin-Groovy …

…and Gremlin-Scala. It is still noisy but the structure is there.
  • Loading branch information...
1 parent 466c8dd commit 17861012d73a97c274727c82c4176c776d5fd0f7 @okram okram committed Sep 26, 2011
Showing with 1,173 additions and 235 deletions.
  1. +1 −1 .gitignore
  2. +183 −0 gremlin-core/pom.xml
  3. +1 −1 { → gremlin-core}/src/assembly/distribution.xml
  4. +231 −0 gremlin-groovy/pom.xml
  5. +34 −0 gremlin-groovy/src/assembly/distribution.xml
  6. 0 { → gremlin-groovy}/src/assembly/standalone.xml
  7. 0 { → gremlin-groovy}/src/main/bin/gremlin.bat
  8. 0 { → gremlin-groovy}/src/main/bin/gremlin.sh
  9. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/Gremlin.groovy
  10. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/ElementLoader.groovy
  11. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/FilterPipeLoader.groovy
  12. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/GraphLoader.groovy
  13. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/IndexLoader.groovy
  14. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/ObjectLoader.groovy
  15. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/PipeLoader.groovy
  16. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/SailGraphLoader.groovy
  17. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/SideEffectPipeLoader.groovy
  18. 0 { → gremlin-groovy}/src/main/groovy/com/tinkerpop/gremlin/loaders/TransformPipeLoader.groovy
  19. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/GremlinTokens.java
  20. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/GroovyPipeFunction.java
  21. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/Imports.java
  22. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/Version.java
  23. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/console/ArrayIterator.java
  24. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/console/Console.java
  25. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/console/ErrorHookClosure.java
  26. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/console/NullResultHookClosure.java
  27. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/console/PromptClosure.java
  28. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/console/ResultHookClosure.java
  29. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/jsr223/GremlinScriptEngine.java
  30. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/jsr223/GremlinScriptEngineFactory.java
  31. 0 { → gremlin-groovy}/src/main/java/com/tinkerpop/gremlin/jsr223/ScriptExecutor.java
  32. 0 { → gremlin-groovy}/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
  33. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/GremlinTest.groovy
  34. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/loaders/ElementLoaderTest.groovy
  35. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/loaders/GraphLoaderTest.groovy
  36. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/loaders/IndexLoaderTest.groovy
  37. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/loaders/ObjectLoaderTest.groovy
  38. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/loaders/PipeLoaderTest.groovy
  39. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/loaders/SailGraphLoaderTest.groovy
  40. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/pipes/TablePipeTest.groovy
  41. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/AggregateStepTest.groovy
  42. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/AsStepTest.groovy
  43. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/BackFilterStepTest.groovy
  44. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/ClosureStepTest.groovy
  45. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/CopySplitStepTest.groovy
  46. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/ExceptStepTest.groovy
  47. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/FilterClosureStepTest.groovy
  48. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/GatherStepTest.groovy
  49. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/GroupCountClosureStepTest.groovy
  50. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/IfThenElseStepTest.groovy
  51. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/LoopStepTest.groovy
  52. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/MapStepTest.groovy
  53. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/MemoizeStepTest.groovy
  54. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/PathClosureStepTest.groovy
  55. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/RangeFilterStepTest.groovy
  56. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/RetainStepTest.groovy
  57. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/SideEffectClosureStepTest.groovy
  58. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/TransformClosureStepTest.groovy
  59. 0 { → gremlin-groovy}/src/test/groovy/com/tinkerpop/gremlin/steps/UniqueObjectStepTest.groovy
  60. 0 { → gremlin-groovy}/src/test/java/com/tinkerpop/gremlin/BaseTest.java
  61. 0 { → gremlin-groovy}/src/test/java/com/tinkerpop/gremlin/jsr223/GremlinScriptEngineTest.java
  62. 0 { → gremlin-groovy}/src/test/java/com/tinkerpop/gremlin/jsr223/ScriptExecutorTest.java
  63. 0 { → gremlin-groovy}/src/test/resources/com/tinkerpop/gremlin/jsr223/gremlin-script.grm
  64. +168 −0 gremlin-scala/pom.xml
  65. +34 −0 gremlin-scala/src/assembly/distribution.xml
  66. +32 −0 gremlin-scala/src/assembly/standalone.xml
  67. +61 −0 gremlin-scala/src/main/java/com/tinkerpop/gremlin/GremlinTokens.java
  68. +48 −0 gremlin-scala/src/main/java/com/tinkerpop/gremlin/Imports.java
  69. +15 −0 gremlin-scala/src/main/java/com/tinkerpop/gremlin/Version.java
  70. +1 −0 gremlin-scala/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
  71. +27 −0 gremlin-scala/src/main/scala/package.scala
  72. +97 −0 gremlin-scala/src/main/scala/wrappers.scala
  73. +15 −0 gremlin-scala/src/test/scala/GremlinScalaTest.scala
  74. +28 −0 gremlin-scala/src/test/scala/ScalaPipeFunctionTest.scala
  75. +117 −0 gremlin-scala/src/test/scala/ScalaWrapperTest.scala
  76. +1 −1 gremlin.sh
  77. +79 −232 pom.xml
View
2 .gitignore
@@ -2,4 +2,4 @@
.gremlin_history
target/
.idea/
-gremlin.iml
+*.iml
View
183 gremlin-core/pom.xml
@@ -0,0 +1,183 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.tinkerpop.gremlin</groupId>
+ <artifactId>gremlin</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>gremlin-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Gremlin-Core: The Core of the Gremlin Language</name>
+ <developers>
+ <developer>
+ <name>Marko A. Rodriguez</name>
+ <email>marko@markorodriguez.com</email>
+ <url>http://markorodriguez.com</url>
+ </developer>
+ </developers>
+ <mailingLists>
+ <mailingList>
+ <name>Gremlin Users</name>
+ <subscribe>http://groups.google.com/group/gremlin-users</subscribe>
+ <unsubscribe>http://groups.google.com/group/gremlin-users</unsubscribe>
+ <archive>http://groups.google.com/group/gremlin-users/topics</archive>
+ </mailingList>
+ </mailingLists>
+ <inceptionYear>2009</inceptionYear>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-core</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ </dependency>
+ <!-- PROVIDED DEPENDENCIES -->
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-graph-jung</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-graph-sail</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-neo4j-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-orient-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-dex-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-sail-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-rexster-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- PROVIDED DEPENDENCIES -->
+ <dependency>
+ <groupId>com.tinkerpop</groupId>
+ <artifactId>pipes</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </dependency>
+ <!-- CONSOLE -->
+ <dependency>
+ <groupId>org.fusesource.jansi</groupId>
+ <artifactId>jansi</artifactId>
+ <version>1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.94</version>
+ </dependency>
+ <!-- TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>http://tinkerpop.com/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <build>
+ <directory>${basedir}/target</directory>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources
+ </directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/distribution.xml</descriptor>
+ </descriptors>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <outputDirectory>target</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ <tarLongFileMode>warn</tarLongFileMode>
+ <archive>
+ <manifest>
+ <mainClass>com.tinkerpop.gremlin.console.Console</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.5</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ftp</artifactId>
+ <version>1.0-alpha-6</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <distributionManagement>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
+ </repository>
+ </distributionManagement>
+</project>
View
2 src/assembly/distribution.xml → gremlin-core/src/assembly/distribution.xml
@@ -28,7 +28,7 @@
<directory>target/site</directory>
</fileSet>
<fileSet>
- <directory>target/gremlin-${project.version}-standalone</directory>
+ <directory>target/gremlin-core-${project.version}-standalone</directory>
</fileSet>
</fileSets>
</assembly>
View
231 gremlin-groovy/pom.xml
@@ -0,0 +1,231 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.tinkerpop.gremlin</groupId>
+ <artifactId>gremlin</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>gremlin-groovy</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Gremlin-Groovy: Gremlin for the Groovy Language</name>
+ <developers>
+ <developer>
+ <name>Marko A. Rodriguez</name>
+ <email>marko@markorodriguez.com</email>
+ <url>http://markorodriguez.com</url>
+ </developer>
+ </developers>
+ <contributors>
+ <contributor>
+ <name>Pavel Yaskevich</name>
+ <email>povel.y@gmail.com</email>
+ <url>http://github.com/xedin</url>
+ </contributor>
+ <contributor>
+ <name>Darrick Wiebe</name>
+ <email>darrick@innatesoftware.com</email>
+ <url>http://github.com/pangloss</url>
+ </contributor>
+ <contributor>
+ <name>Peter Neubauer</name>
+ <email>peter.neubauer@neotechnology.com</email>
+ <url>http://www.linkedin.com/in/neubauer</url>
+ </contributor>
+ </contributors>
+ <mailingLists>
+ <mailingList>
+ <name>Gremlin Users</name>
+ <subscribe>http://groups.google.com/group/gremlin-users</subscribe>
+ <unsubscribe>http://groups.google.com/group/gremlin-users</unsubscribe>
+ <archive>http://groups.google.com/group/gremlin-users/topics</archive>
+ </mailingList>
+ </mailingLists>
+ <inceptionYear>2009</inceptionYear>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>com.tinkerpop.gremlin</groupId>
+ <artifactId>gremlin-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <!-- PROVIDED DEPENDENCIES -->
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-graph-jung</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-graph-sail</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-neo4j-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-orient-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-dex-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-sail-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop.blueprints</groupId>
+ <artifactId>blueprints-rexster-graph</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- PROVIDED DEPENDENCIES -->
+ <dependency>
+ <groupId>com.tinkerpop</groupId>
+ <artifactId>pipes</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy</artifactId>
+ <version>1.8.2</version>
+ </dependency>
+ <!-- CONSOLE -->
+ <dependency>
+ <groupId>org.fusesource.jansi</groupId>
+ <artifactId>jansi</artifactId>
+ <version>1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.94</version>
+ </dependency>
+ <!-- GROOVY/JAVA CONNECTIVITY -->
+ <dependency>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.3</version>
+ <scope>provided</scope>
+ </dependency>
+ <!-- TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>http://tinkerpop.com/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <build>
+ <directory>${basedir}/target</directory>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources
+ </directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/standalone.xml</descriptor>
+ <descriptor>src/assembly/distribution.xml</descriptor>
+ </descriptors>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <outputDirectory>target</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ <tarLongFileMode>warn</tarLongFileMode>
+ <archive>
+ <manifest>
+ <mainClass>com.tinkerpop.gremlin.console.Console</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.codehaus.gmaven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.3</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>generateStubs</goal>
+ <goal>compile</goal>
+ <goal>generateTestStubs</goal>
+ <goal>testCompile</goal>
+ </goals>
+ <configuration>
+ <providerSelection>1.7</providerSelection>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.5</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ftp</artifactId>
+ <version>1.0-alpha-6</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <distributionManagement>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
+ </repository>
+ </distributionManagement>
+</project>
View
34 gremlin-groovy/src/assembly/distribution.xml
@@ -0,0 +1,34 @@
+<assembly>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <fileMode>0775</fileMode>
+ <includes>
+ <include>gremlin.sh</include>
+ <include>gremlin.bat</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src</directory>
+ </fileSet>
+ <fileSet>
+ <directory>data</directory>
+ </fileSet>
+ <fileSet>
+ <directory>target/apidocs</directory>
+ </fileSet>
+ <fileSet>
+ <directory>target/site</directory>
+ </fileSet>
+ <fileSet>
+ <directory>target/gremlin-groovy-${project.version}-standalone</directory>
+ </fileSet>
+ </fileSets>
+</assembly>
View
0 src/assembly/standalone.xml → gremlin-groovy/src/assembly/standalone.xml
File renamed without changes.
View
0 src/main/bin/gremlin.bat → gremlin-groovy/src/main/bin/gremlin.bat
File renamed without changes.
View
0 src/main/bin/gremlin.sh → gremlin-groovy/src/main/bin/gremlin.sh
File renamed without changes.
View
0 ...oovy/com/tinkerpop/gremlin/Gremlin.groovy → ...oovy/com/tinkerpop/gremlin/Gremlin.groovy
File renamed without changes.
View
0 ...rpop/gremlin/loaders/ElementLoader.groovy → ...rpop/gremlin/loaders/ElementLoader.groovy
File renamed without changes.
View
0 ...p/gremlin/loaders/FilterPipeLoader.groovy → ...p/gremlin/loaders/FilterPipeLoader.groovy
File renamed without changes.
View
0 ...kerpop/gremlin/loaders/GraphLoader.groovy → ...kerpop/gremlin/loaders/GraphLoader.groovy
File renamed without changes.
View
0 ...kerpop/gremlin/loaders/IndexLoader.groovy → ...kerpop/gremlin/loaders/IndexLoader.groovy
File renamed without changes.
View
0 ...erpop/gremlin/loaders/ObjectLoader.groovy → ...erpop/gremlin/loaders/ObjectLoader.groovy
File renamed without changes.
View
0 ...nkerpop/gremlin/loaders/PipeLoader.groovy → ...nkerpop/gremlin/loaders/PipeLoader.groovy
File renamed without changes.
View
0 ...op/gremlin/loaders/SailGraphLoader.groovy → ...op/gremlin/loaders/SailGraphLoader.groovy
File renamed without changes.
View
0 ...emlin/loaders/SideEffectPipeLoader.groovy → ...emlin/loaders/SideEffectPipeLoader.groovy
File renamed without changes.
View
0 ...remlin/loaders/TransformPipeLoader.groovy → ...remlin/loaders/TransformPipeLoader.groovy
File renamed without changes.
View
0 .../com/tinkerpop/gremlin/GremlinTokens.java → .../com/tinkerpop/gremlin/GremlinTokens.java
File renamed without changes.
View
0 ...tinkerpop/gremlin/GroovyPipeFunction.java → ...tinkerpop/gremlin/GroovyPipeFunction.java
File renamed without changes.
View
0 ...n/java/com/tinkerpop/gremlin/Imports.java → ...n/java/com/tinkerpop/gremlin/Imports.java
File renamed without changes.
View
0 ...n/java/com/tinkerpop/gremlin/Version.java → ...n/java/com/tinkerpop/gremlin/Version.java
File renamed without changes.
View
0 ...kerpop/gremlin/console/ArrayIterator.java → ...kerpop/gremlin/console/ArrayIterator.java
File renamed without changes.
View
0 ...om/tinkerpop/gremlin/console/Console.java → ...om/tinkerpop/gremlin/console/Console.java
File renamed without changes.
View
0 ...pop/gremlin/console/ErrorHookClosure.java → ...pop/gremlin/console/ErrorHookClosure.java
File renamed without changes.
View
0 ...remlin/console/NullResultHookClosure.java → ...remlin/console/NullResultHookClosure.java
File renamed without changes.
View
0 ...kerpop/gremlin/console/PromptClosure.java → ...kerpop/gremlin/console/PromptClosure.java
File renamed without changes.
View
0 ...op/gremlin/console/ResultHookClosure.java → ...op/gremlin/console/ResultHookClosure.java
File renamed without changes.
View
0 ...p/gremlin/jsr223/GremlinScriptEngine.java → ...p/gremlin/jsr223/GremlinScriptEngine.java
File renamed without changes.
View
0 ...in/jsr223/GremlinScriptEngineFactory.java → ...in/jsr223/GremlinScriptEngineFactory.java
File renamed without changes.
View
0 ...kerpop/gremlin/jsr223/ScriptExecutor.java → ...kerpop/gremlin/jsr223/ScriptExecutor.java
File renamed without changes.
View
0 ...services/javax.script.ScriptEngineFactory → ...services/javax.script.ScriptEngineFactory
File renamed without changes.
View
0 .../com/tinkerpop/gremlin/GremlinTest.groovy → .../com/tinkerpop/gremlin/GremlinTest.groovy
File renamed without changes.
View
0 .../gremlin/loaders/ElementLoaderTest.groovy → .../gremlin/loaders/ElementLoaderTest.groovy
File renamed without changes.
View
0 ...op/gremlin/loaders/GraphLoaderTest.groovy → ...op/gremlin/loaders/GraphLoaderTest.groovy
File renamed without changes.
View
0 ...op/gremlin/loaders/IndexLoaderTest.groovy → ...op/gremlin/loaders/IndexLoaderTest.groovy
File renamed without changes.
View
0 ...p/gremlin/loaders/ObjectLoaderTest.groovy → ...p/gremlin/loaders/ObjectLoaderTest.groovy
File renamed without changes.
View
0 ...pop/gremlin/loaders/PipeLoaderTest.groovy → ...pop/gremlin/loaders/PipeLoaderTest.groovy
File renamed without changes.
View
0 ...remlin/loaders/SailGraphLoaderTest.groovy → ...remlin/loaders/SailGraphLoaderTest.groovy
File renamed without changes.
View
0 ...kerpop/gremlin/pipes/TablePipeTest.groovy → ...kerpop/gremlin/pipes/TablePipeTest.groovy
File renamed without changes.
View
0 ...op/gremlin/steps/AggregateStepTest.groovy → ...op/gremlin/steps/AggregateStepTest.groovy
File renamed without changes.
View
0 ...tinkerpop/gremlin/steps/AsStepTest.groovy → ...tinkerpop/gremlin/steps/AsStepTest.groovy
File renamed without changes.
View
0 ...p/gremlin/steps/BackFilterStepTest.groovy → ...p/gremlin/steps/BackFilterStepTest.groovy
File renamed without changes.
View
0 ...rpop/gremlin/steps/ClosureStepTest.groovy → ...rpop/gremlin/steps/ClosureStepTest.groovy
File renamed without changes.
View
0 ...op/gremlin/steps/CopySplitStepTest.groovy → ...op/gremlin/steps/CopySplitStepTest.groovy
File renamed without changes.
View
0 ...erpop/gremlin/steps/ExceptStepTest.groovy → ...erpop/gremlin/steps/ExceptStepTest.groovy
File renamed without changes.
View
0 ...remlin/steps/FilterClosureStepTest.groovy → ...remlin/steps/FilterClosureStepTest.groovy
File renamed without changes.
View
0 ...erpop/gremlin/steps/GatherStepTest.groovy → ...erpop/gremlin/steps/GatherStepTest.groovy
File renamed without changes.
View
0 ...in/steps/GroupCountClosureStepTest.groovy → ...in/steps/GroupCountClosureStepTest.groovy
File renamed without changes.
View
0 ...p/gremlin/steps/IfThenElseStepTest.groovy → ...p/gremlin/steps/IfThenElseStepTest.groovy
File renamed without changes.
View
0 ...nkerpop/gremlin/steps/LoopStepTest.groovy → ...nkerpop/gremlin/steps/LoopStepTest.groovy
File renamed without changes.
View
0 ...inkerpop/gremlin/steps/MapStepTest.groovy → ...inkerpop/gremlin/steps/MapStepTest.groovy
File renamed without changes.
View
0 ...rpop/gremlin/steps/MemoizeStepTest.groovy → ...rpop/gremlin/steps/MemoizeStepTest.groovy
File renamed without changes.
View
0 .../gremlin/steps/PathClosureStepTest.groovy → .../gremlin/steps/PathClosureStepTest.groovy
File renamed without changes.
View
0 .../gremlin/steps/RangeFilterStepTest.groovy → .../gremlin/steps/RangeFilterStepTest.groovy
File renamed without changes.
View
0 ...erpop/gremlin/steps/RetainStepTest.groovy → ...erpop/gremlin/steps/RetainStepTest.groovy
File renamed without changes.
View
0 ...in/steps/SideEffectClosureStepTest.groovy → ...in/steps/SideEffectClosureStepTest.groovy
File renamed without changes.
View
0 ...lin/steps/TransformClosureStepTest.groovy → ...lin/steps/TransformClosureStepTest.groovy
File renamed without changes.
View
0 ...gremlin/steps/UniqueObjectStepTest.groovy → ...gremlin/steps/UniqueObjectStepTest.groovy
File renamed without changes.
View
0 .../java/com/tinkerpop/gremlin/BaseTest.java → .../java/com/tinkerpop/gremlin/BaseTest.java
File renamed without changes.
View
0 ...emlin/jsr223/GremlinScriptEngineTest.java → ...emlin/jsr223/GremlinScriptEngineTest.java
File renamed without changes.
View
0 ...op/gremlin/jsr223/ScriptExecutorTest.java → ...op/gremlin/jsr223/ScriptExecutorTest.java
File renamed without changes.
View
0 ...nkerpop/gremlin/jsr223/gremlin-script.grm → ...nkerpop/gremlin/jsr223/gremlin-script.grm
File renamed without changes.
View
168 gremlin-scala/pom.xml
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>com.tinkerpop.gremlin</groupId>
+ <artifactId>gremlin</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+ <artifactId>gremlin-scala</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>jar</packaging>
+ <name>Gremlin-Scala: Gremlin for the Scala Language</name>
+ <developers>
+ <developer>
+ <name>Zach Cox</name>
+ </developer>
+ </developers>
+ <mailingLists>
+ <mailingList>
+ <name>Gremlin Users</name>
+ <subscribe>http://groups.google.com/group/gremlin-users</subscribe>
+ <unsubscribe>http://groups.google.com/group/gremlin-users</unsubscribe>
+ <archive>http://groups.google.com/group/gremlin-users/topics</archive>
+ </mailingList>
+ </mailingLists>
+ <inceptionYear>2011</inceptionYear>
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+ <dependencies>
+ <dependency>
+ <groupId>com.tinkerpop.gremlin</groupId>
+ <artifactId>gremlin-core</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>com.tinkerpop</groupId>
+ <artifactId>pipes</artifactId>
+ <version>0.9-SNAPSHOT</version>
+ </dependency>
+ <dependency>
+ <groupId>org.scala-lang</groupId>
+ <artifactId>scala-library</artifactId>
+ <version>2.9.1</version>
+ </dependency>
+ <!-- CONSOLE -->
+ <dependency>
+ <groupId>org.fusesource.jansi</groupId>
+ <artifactId>jansi</artifactId>
+ <version>1.5</version>
+ </dependency>
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>0.9.94</version>
+ </dependency>
+ <!-- TESTING -->
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.specs2</groupId>
+ <artifactId>specs2_2.9.1</artifactId>
+ <version>1.6.1</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.specs2</groupId>
+ <artifactId>specs2-scalaz-core_2.9.1</artifactId>
+ <version>6.0.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ <repositories>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>http://tinkerpop.com/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+ <build>
+ <directory>${basedir}/target</directory>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources
+ </directory>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>2.3.2</version>
+ <configuration>
+ <source>1.6</source>
+ <target>1.6</target>
+ </configuration>
+ </plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2-beta-4</version>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>assembly</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <descriptors>
+ <descriptor>src/assembly/standalone.xml</descriptor>
+ <descriptor>src/assembly/distribution.xml</descriptor>
+ </descriptors>
+ <finalName>${project.artifactId}-${project.version}</finalName>
+ <outputDirectory>target</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ <tarLongFileMode>warn</tarLongFileMode>
+ <archive>
+ <manifest>
+ <mainClass>com.tinkerpop.gremlin.console.Console</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.scala-tools</groupId>
+ <artifactId>maven-scala-plugin</artifactId>
+ <version>2.9.1</version>
+ <executions>
+ <execution>
+ <goals>
+ <goal>compile</goal>
+ <goal>testCompile</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.5</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ftp</artifactId>
+ <version>1.0-alpha-6</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+ <distributionManagement>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
+ </repository>
+ </distributionManagement>
+</project>
View
34 gremlin-scala/src/assembly/distribution.xml
@@ -0,0 +1,34 @@
+<assembly>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <fileSets>
+ <fileSet>
+ <includes>
+ <include>pom.xml</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <fileMode>0775</fileMode>
+ <includes>
+ <include>gremlin.sh</include>
+ <include>gremlin.bat</include>
+ </includes>
+ </fileSet>
+ <fileSet>
+ <directory>src</directory>
+ </fileSet>
+ <fileSet>
+ <directory>data</directory>
+ </fileSet>
+ <fileSet>
+ <directory>target/apidocs</directory>
+ </fileSet>
+ <fileSet>
+ <directory>target/site</directory>
+ </fileSet>
+ <fileSet>
+ <directory>target/gremlin-scala-${project.version}-standalone</directory>
+ </fileSet>
+ </fileSets>
+</assembly>
View
32 gremlin-scala/src/assembly/standalone.xml
@@ -0,0 +1,32 @@
+<assembly>
+ <id>standalone</id>
+ <formats>
+ <format>dir</format>
+ </formats>
+ <includeBaseDirectory>false</includeBaseDirectory>
+
+ <fileSets>
+ <fileSet>
+ <directory>src/main/bin</directory>
+ <outputDirectory>/bin</outputDirectory>
+ <fileMode>0755</fileMode>
+ </fileSet>
+ <fileSet>
+ <directory>target/*.jar</directory>
+ <outputDirectory>/lib</outputDirectory>
+ </fileSet>
+ </fileSets>
+
+ <dependencySets>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>compile</scope>
+ </dependencySet>
+ <dependencySet>
+ <outputDirectory>/lib</outputDirectory>
+ <unpack>false</unpack>
+ <scope>provided</scope>
+ </dependencySet>
+ </dependencySets>
+</assembly>
View
61 gremlin-scala/src/main/java/com/tinkerpop/gremlin/GremlinTokens.java
@@ -0,0 +1,61 @@
+package com.tinkerpop.gremlin;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class GremlinTokens {
+
+ public static final String VERSION = "1.3-SNAPSHOT";
+ public static final String LABEL = "label";
+ public static final String ID = "id";
+
+ public enum T {
+ eq, neq, lt, lte, gt, gte, v, e
+ }
+
+ public static final String OUT = "out";
+ public static final String OUTV = "outV";
+ public static final String IN = "in";
+ public static final String INV = "inV";
+ public static final String BOTH = "both";
+ public static final String BOTHV = "bothV";
+ public static final String OUTE = "outE";
+ public static final String INE = "inE";
+ public static final String BOTHE = "bothE";
+ public static final String V = "V";
+ public static final String E = "E";
+
+
+ public static final String _ = "_";
+ public static final String AGGREGATE = "aggregate";
+ public static final String ANDFILTER = "andFilter";
+ public static final String AS = "as";
+ public static final String BACK = "back";
+ public static final String CAP = "cap";
+ public static final String COPYSPLIT = "copySplit";
+ public static final String EXCEPT = "except";
+ public static final String EXHAUSTMERGE = "exhaustMerge";
+ public static final String FAIRMERGE = "fairMerge";
+ public static final String SIDEEFFECT = "sideEffect";
+ public static final String TRANSFORM = "transform";
+ public static final String FILTER = "filter";
+ public static final String GATHER = "gather";
+ public static final String GROUPCOUNT = "groupCount";
+ public static final String IFTHENELSE = "ifThenElse";
+ public static final String LOOP = "loop";
+ public static final String MAP = "map";
+ public static final String MEMOIZE = "memoize";
+ public static final String OPTIONAL = "optional";
+ public static final String ORFILTER = "orFilter";
+ public static final String PATHS = "paths";
+ public static final String PROPERTYFILTER = "propertyFilter";
+ public static final String RANDOM = "random";
+ public static final String RETAIN = "retain";
+ public static final String SCATTER = "scatter";
+ public static final String STEP = "step";
+ public static final String TABLE = "table";
+ public static final String UNIQUEOBJECT = "uniqueObject";
+ public static final String UNIQUEPATH = "uniquePath";
+
+
+}
View
48 gremlin-scala/src/main/java/com/tinkerpop/gremlin/Imports.java
@@ -0,0 +1,48 @@
+package com.tinkerpop.gremlin;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class Imports {
+
+ private static final List<String> imports = new ArrayList<String>();
+
+ static {
+ // gremlin
+ imports.add("com.tinkerpop.gremlin.*");
+ imports.add("com.tinkerpop.gremlin.GremlinTokens.T");
+
+ // blueprints
+ imports.add("com.tinkerpop.blueprints.pgm.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.tg.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.neo4j.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.orientdb.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.dex.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.rexster.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.event.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.readonly.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.sail.*");
+ imports.add("com.tinkerpop.blueprints.pgm.impls.sail.impls.*");
+ imports.add("com.tinkerpop.blueprints.pgm.util.*");
+ imports.add("com.tinkerpop.blueprints.pgm.util.graphml.*");
+ imports.add("com.tinkerpop.blueprints.pgm.oupls.sail.*");
+ imports.add("com.tinkerpop.blueprints.pgm.oupls.jung.*");
+ imports.add("com.tinkerpop.blueprints.pgm.oupls.jung.util.*");
+
+ // pipes
+ imports.add("com.tinkerpop.pipes.*");
+ imports.add("com.tinkerpop.pipes.branch.*");
+ imports.add("com.tinkerpop.pipes.filter.*");
+ imports.add("com.tinkerpop.pipes.sideeffect.*");
+ imports.add("com.tinkerpop.pipes.transform.*");
+ imports.add("com.tinkerpop.pipes.util.*");
+ }
+
+ public static List<String> getImports() {
+ return Imports.imports;
+ }
+}
View
15 gremlin-scala/src/main/java/com/tinkerpop/gremlin/Version.java
@@ -0,0 +1,15 @@
+package com.tinkerpop.gremlin;
+
+import java.io.IOException;
+
+/**
+ * @author Marko A. Rodriguez (http://markorodriguez.com)
+ */
+public class Version {
+
+ public static void main(final String[] arguments) throws IOException {
+ System.out.println("gremlin " + GremlinTokens.VERSION);
+ }
+}
+
+
View
1 gremlin-scala/src/main/resources/META-INF/services/javax.script.ScriptEngineFactory
@@ -0,0 +1 @@
+com.tinkerpop.gremlin.jsr223.GremlinScriptEngineFactory
View
27 gremlin-scala/src/main/scala/package.scala
@@ -0,0 +1,27 @@
+package com.tinkerpop.gremlin
+
+import com.tinkerpop.pipes.PipeFunction
+import com.tinkerpop.pipes.util.FluentPipeline
+import java.lang.{Boolean => JBoolean}
+
+/** Implicit conversions that make PipeFunction easier to use in Scala. Users can just `import com.tinkerpop.gremlin.scala._` */
+package object scala {
+ /** Most generic conversion: A => B to PipeFunction[A, B]. */
+ implicit def functionToPipeFunction[A, B](f: Function1[A, B]) =
+ new PipeFunction[A, B] {
+ def compute(a: A): B = f(a)
+ }
+
+ /** Mainly for FluentPipeline.filter, to convert A => scala.Boolean to PipeFunction[A, java.lang.Boolean]. */
+ implicit def booleanFunctionToPipeFunction[A](f: Function1[A, Boolean]) =
+ new PipeFunction[A, JBoolean] {
+ def compute(a: A): JBoolean = Boolean box f(a)
+ }
+
+ /** Bring the wrap implicits into scope. The compiler will check the unwrap implicits on its own. */
+ implicit val wrapScalaVertex = ScalaVertex.wrap _
+ implicit val wrapScalaEdge = ScalaEdge.wrap _
+ implicit val wrapScalaGraph = ScalaGraph.wrap _
+ implicit def wrapScalaFluentPipeline[A, B] = ScalaFluentPipeline.wrap[A, B] _ //this implicit has type parameters so it must be a def instead of a val
+}
+
View
97 gremlin-scala/src/main/scala/wrappers.scala
@@ -0,0 +1,97 @@
+package com.tinkerpop.gremlin.scala
+
+import com.tinkerpop.blueprints.pgm.{Vertex, Edge, Graph}
+import com.tinkerpop.pipes.util.FluentPipeline
+
+/** Adds convenience methods to [[com.tinkerpop.blueprints.pgm.Vertex]]. */
+class ScalaVertex(val vertex: Vertex) {
+ def out = new FluentPipeline(vertex).out()
+ def out(labels: String*) = new FluentPipeline(vertex).out(labels: _*)
+
+ def outE = new FluentPipeline(vertex).outE()
+ def outE(labels: String*) = new FluentPipeline(vertex).outE(labels: _*)
+
+ def in = new FluentPipeline(vertex).in()
+ def in(labels: String*) = new FluentPipeline(vertex).in(labels: _*)
+
+ def inE = new FluentPipeline(vertex).inE()
+ def inE(labels: String*) = new FluentPipeline(vertex).inE(labels: _*)
+
+ def both = new FluentPipeline(vertex).both()
+ def both(labels: String*) = new FluentPipeline(vertex).both(labels: _*)
+
+ def bothE = new FluentPipeline(vertex).bothE()
+ def bothE(labels: String*) = new FluentPipeline(vertex).bothE(labels: _*)
+}
+
+/** Implicit conversions between [[com.tinkerpop.blueprints.pgm.Vertex]] and [[com.tinkerpop.gremlin.scala.ScalaVertex]]. */
+object ScalaVertex {
+ implicit def wrap(vertex: Vertex) = new ScalaVertex(vertex)
+ implicit def unwrap(wrapper: ScalaVertex) = wrapper.vertex
+}
+
+/** Adds convenience methods to [[com.tinkerpop.blueprints.pgm.Edge]]. */
+class ScalaEdge(val edge: Edge) {
+ def inV = new FluentPipeline(edge).inV()
+ def outV = new FluentPipeline(edge).outV()
+ def bothV = new FluentPipeline(edge).bothV()
+}
+
+/** Implicit conversions between [[com.tinkerpop.blueprints.pgm.Edge]] and [[com.tinkerpop.gremlin.scala.ScalaEdge]]. */
+object ScalaEdge {
+ implicit def wrap(edge: Edge) = new ScalaEdge(edge)
+ implicit def unwrap(wrapper: ScalaEdge) = wrapper.edge
+}
+
+/** Adds convenience methods to [[com.tinkerpop.blueprints.pgm.Graph]]. */
+class ScalaGraph(val graph: Graph) {
+ def V = new FluentPipeline(graph).V()
+ def E = new FluentPipeline(graph).E()
+
+ //in Groovy, Graph.v appears to return a vertex if called with one ID, or a list of vertices if called with multiple IDs...
+ /*def v(id: Object): Vertex = graph getVertex id
+ def v(id: Object, ids: Object*): Iterable[Vertex] = {
+ val v1 = graph getVertex id
+ val vs = ids.map(graph.getVertex(_))
+ Iterable(v1, vs: _*)
+ }*/
+ def v(ids: Object*): Iterable[Vertex] = ids.map(graph.getVertex(_))
+
+ //def += for addVertex and addEdge?
+}
+
+/** Implicit conversions between [[com.tinkerpop.blueprints.pgm.Graph]] and [[com.tinkerpop.gremlin.scala.ScalaGraph]]. */
+object ScalaGraph {
+ implicit def wrap(graph: Graph) = new ScalaGraph(graph)
+ implicit def unwrap(wrapper: ScalaGraph) = wrapper.graph
+}
+
+/** Adds convenience methods to [[com.tinkerpop.pipes.util.FluentPipeline]]. */
+class ScalaFluentPipeline[A, B](val pipeline: FluentPipeline[A, B]) extends Iterator[B] {
+ //Pipe<S,E> is both:
+ // - Iterator<E> = iterate over elements in collection, defines hasNext(), next() and remove() methods
+ // - Iterable<E> = can be target of foreach statement, defines iterator() method
+ // => so you can use Pipe<S,E> as a raw Iterator<E> or in for(E e : pipe), the key point is that you iterate over the Es
+
+ //Scala's Iterator[A] trait provides much more than just hasNext, next & foreach; like map/flatMap/filter/fold/toX/etc
+ // - thus an Iterator can be used in for-comprehensions
+ // - scala.collection.JavaConversions.JIteratorWrapper is a Scala Iterator that wraps a Java Iterator
+
+ //Scala's Iterable[A] trait provides a lot of what Iterator provides, but also the ability to create new collections of the same type
+ // - Iterable is really meant to be implemented by actual collection data structures
+ // - Iterator is probably better for things that just provide a way to iterate over some contained elements
+ // => If ScalaFluentPipeline[S,E] extends Iterator[E], then it should act like Pipe in all the right Scala ways,
+ // and the hasNext & next methods can delegate to hasNext() & next() in FluentPipeline
+
+ def hasNext: Boolean = pipeline.hasNext
+ def next(): B = pipeline.next()
+
+ def loop[T](numberedStep: Int)(whileFunction: Function1[T, Boolean]) = pipeline.loop(numberedStep, whileFunction)
+}
+
+/** Implicit conversions between [[com.tinkerpop.pipes.util.FluentPipeline]] and [[com.tinkerpop.gremlin.scala.ScalaFluentPipeline]]. */
+object ScalaFluentPipeline {
+ implicit def wrap[A, B](fp: FluentPipeline[A, B]) = new ScalaFluentPipeline(fp)
+ implicit def unwrap[A, B](wrapper: ScalaFluentPipeline[A, B]) = wrapper.pipeline
+}
+
View
15 gremlin-scala/src/test/scala/GremlinScalaTest.scala
@@ -0,0 +1,15 @@
+package com.tinkerpop.gremlin
+
+import com.tinkerpop.blueprints.pgm.Vertex
+import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory
+import com.tinkerpop.pipes.util.FluentPipeline
+import _root_.scala.collection.JavaConversions
+import junit.framework.TestCase
+
+class GremlinScalaTest extends TestCase {
+ def testGremlin() {
+ val g = TinkerGraphFactory.createTinkerGraph();
+ val pipe = new FluentPipeline[Vertex, Vertex];
+ JavaConversions.asScalaIterator[Vertex](pipe.start(g.getVertex(1)).out("knows").asInstanceOf[java.util.Iterator[Vertex]]);
+ }
+}
View
28 gremlin-scala/src/test/scala/ScalaPipeFunctionTest.scala
@@ -0,0 +1,28 @@
+package com.tinkerpop.gremlin
+
+import org.specs2.mutable._
+import com.tinkerpop.blueprints.pgm.Vertex
+import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory
+import com.tinkerpop.pipes.PipeFunction
+import com.tinkerpop.pipes.util.FluentPipeline
+import com.tinkerpop.gremlin.scala._
+
+class ScalaPipeFunctionTest extends SpecificationWithJUnit {
+ "The scala PipeFunction implicits" should {
+ "properly wrap any function literal" in {
+ val f: String => Int = s => s.length
+ val pf: PipeFunction[String, Int] = f
+
+ pf.compute("abcd") must_== f("abcd")
+ }
+
+ "properly wrap a String => Boolean function literal" in {
+ val graph = TinkerGraphFactory.createTinkerGraph()
+ val fp = new FluentPipeline(graph getVertex 1) out "knows" property "name" filter { s: String => s startsWith "j" }
+
+ fp.hasNext() must_== true
+ fp.next() must_== "josh"
+ fp.hasNext() must_== false
+ }
+ }
+}
View
117 gremlin-scala/src/test/scala/ScalaWrapperTest.scala
@@ -0,0 +1,117 @@
+package com.tinkerpop.gremlin
+
+import org.specs2.mutable._
+import com.tinkerpop.blueprints.pgm.{Graph, Vertex}
+import com.tinkerpop.blueprints.pgm.impls.tg.TinkerGraphFactory
+import com.tinkerpop.pipes.PipeFunction
+import com.tinkerpop.pipes.util.FluentPipeline
+import com.tinkerpop.gremlin.scala._
+
+class ScalaWrapperTest extends SpecificationWithJUnit {
+ "The ScalaFluentPipeline wrapper" should {
+ "be a Scala Iterator" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val i: Iterator[Any] = new ScalaFluentPipeline(new FluentPipeline(g).V())
+
+ //TODO assert that the proper values come out of the next() calls
+ i.hasNext must beTrue
+ i.next() must_!= null
+ i.hasNext must beTrue
+ i.next() must_!= null
+ i.hasNext must beTrue
+ i.next() must_!= null
+ i.hasNext must beTrue
+ i.next() must_!= null
+ i.hasNext must beTrue
+ i.next() must_!= null
+ i.hasNext must beTrue
+ i.next() must_!= null
+ i.hasNext must beFalse
+ }
+
+ "implicitly wrap a FluentPipeline" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val sfp: ScalaFluentPipeline[_,_] = new FluentPipeline(g).V()
+
+ //sfp must_!= null // <===== weird compiler errors on this line...
+ sfp.isInstanceOf[ScalaFluentPipeline[_,_]] must beTrue
+ }
+
+ "implicitly wrap a FluentPipeline when calling an Iterable method" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val i: Iterable[Any] = new FluentPipeline(g).V().toIterable
+
+ i must_!= null
+ }
+
+ "unwrap ScalaFluentPipeline => FluentPipeline" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val fp: FluentPipeline[_,_] = new FluentPipeline(g)
+ val sfp: ScalaFluentPipeline[_,_] = fp
+ def toString(p: FluentPipeline[_,_]) = p.toString
+
+ toString(fp) must_== toString(sfp) //sfp must be unwrapped when passed to print
+ }
+ }
+
+ "The ScalaGraph wrapper" should {
+ "return all vertices using V" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val vs = g.V.toIterable
+
+ vs must have size(6)
+ vs must contain(g getVertex 1)
+ vs must contain(g getVertex 2)
+ vs must contain(g getVertex 3)
+ vs must contain(g getVertex 4)
+ vs must contain(g getVertex 5)
+ vs must contain(g getVertex 6)
+ }
+
+ //TODO graph.E
+ //TODO graph.v(id)
+ //TODO unwrap ScalaGraph => Graph
+ }
+
+ "The ScalaVertex wrapper" should {
+ "return all out vertices using out" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val vs = g.getVertex(1).out.toIterable
+
+ vs must have size(3)
+ vs must contain(g getVertex 2)
+ vs must contain(g getVertex 3)
+ vs must contain(g getVertex 4)
+ }
+
+ "return proper out vertices using out with label" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val vs = g.getVertex(1).out("knows").toIterable
+
+ vs must have size(2)
+ vs must contain(g getVertex 2)
+ vs must contain(g getVertex 4)
+ }
+
+ //TODO vertex.outE and vertex.outE()
+ //TODO vertex.in and vertex.in(label)
+ //TODO vertex.inE and vertex.inE(label)
+ //TODO vertex.both and vertex.bothE(label)
+
+ "get unwrapped by the implicit" in {
+ val g = TinkerGraphFactory.createTinkerGraph()
+ val v1: Vertex = g getVertex 1
+ val v2: ScalaVertex = v1
+ def toString(v: Vertex) = v.toString
+
+ toString(v1) must_== toString(v2) //v2 must be unwrapped when passed to toString
+ }
+ }
+
+ /*"The ScalaEdge wrapper" should {
+ //TODO edge.inV
+ //TODO edge.outV
+ //TODO edge.bothV
+ //TODO unwrap ScalaEdge => Edge
+ }*/
+}
View
2 gremlin.sh
@@ -1,3 +1,3 @@
#!/bin/bash
-`dirname $0`/target/gremlin-*-standalone/bin/gremlin.sh $@
+`dirname $0`/gremlin-groovy/target/gremlin-*-standalone/bin/gremlin.sh $@
View
311 pom.xml
@@ -1,232 +1,79 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <groupId>com.tinkerpop</groupId>
- <artifactId>gremlin</artifactId>
- <version>1.4-SNAPSHOT</version>
- <!-- DON'T FORGET TO UPDATE GremlinTokens.VERSION AT RELEASE -->
- <packaging>jar</packaging>
- <url>http://gremlin.tinkerpop.com</url>
- <name>Gremlin: A Graph Traversal Language</name>
- <description>Gremlin is a domain specific language for traversing property graphs.
- Gremlin makes use of a path-based syntax written in Groovy to support complex graph traversals.
- This language has application in the areas of graph query, analysis, and manipulation.
- </description>
- <developers>
- <developer>
- <name>Marko A. Rodriguez</name>
- <email>marko@markorodriguez.com</email>
- <url>http://markorodriguez.com</url>
- </developer>
- </developers>
- <contributors>
- <contributor>
- <name>Pavel Yaskevich</name>
- <email>povel.y@gmail.com</email>
- <url>http://github.com/xedin</url>
- </contributor>
- <contributor>
- <name>Darrick Wiebe</name>
- <email>darrick@innatesoftware.com</email>
- <url>http://github.com/pangloss</url>
- </contributor>
- <contributor>
- <name>Peter Neubauer</name>
- <email>peter.neubauer@neotechnology.com</email>
- <url>http://www.linkedin.com/in/neubauer</url>
- </contributor>
- </contributors>
- <mailingLists>
- <mailingList>
- <name>Gremlin Users</name>
- <subscribe>http://groups.google.com/group/gremlin-users</subscribe>
- <unsubscribe>http://groups.google.com/group/gremlin-users</unsubscribe>
- <archive>http://groups.google.com/group/gremlin-users/topics</archive>
- </mailingList>
- </mailingLists>
- <inceptionYear>2009</inceptionYear>
- <properties>
- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
- </properties>
- <dependencies>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-core</artifactId>
- <version>1.1-SNAPSHOT</version>
- </dependency>
- <!-- PROVIDED DEPENDENCIES -->
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-graph-jung</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-graph-sail</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-neo4j-graph</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-orient-graph</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-dex-graph</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-sail-graph</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <dependency>
- <groupId>com.tinkerpop.blueprints</groupId>
- <artifactId>blueprints-rexster-graph</artifactId>
- <version>1.1-SNAPSHOT</version>
- <scope>provided</scope>
- </dependency>
- <!-- PROVIDED DEPENDENCIES -->
- <dependency>
- <groupId>com.tinkerpop</groupId>
- <artifactId>pipes</artifactId>
- <version>0.9-SNAPSHOT</version>
- </dependency>
- <dependency>
- <groupId>org.codehaus.groovy</groupId>
- <artifactId>groovy</artifactId>
- <version>1.8.2</version>
- </dependency>
- <!-- CONSOLE -->
- <dependency>
- <groupId>org.fusesource.jansi</groupId>
- <artifactId>jansi</artifactId>
- <version>1.5</version>
- </dependency>
- <dependency>
- <groupId>jline</groupId>
- <artifactId>jline</artifactId>
- <version>0.9.94</version>
- </dependency>
- <!-- GROOVY/JAVA CONNECTIVITY -->
- <dependency>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.3</version>
- <scope>provided</scope>
- </dependency>
- <!-- TESTING -->
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <repositories>
- <repository>
- <id>tinkerpop-repository</id>
- <name>TinkerPop Maven2 Repository</name>
- <url>http://tinkerpop.com/maven2</url>
- <snapshots>
- <enabled>true</enabled>
- <updatePolicy>always</updatePolicy>
- </snapshots>
- </repository>
- </repositories>
- <build>
- <directory>${basedir}/target</directory>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <resources>
- <resource>
- <directory>${basedir}/src/main/resources
- </directory>
- </resource>
- </resources>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- <configuration>
- <source>1.6</source>
- <target>1.6</target>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2-beta-4</version>
- <executions>
- <execution>
- <phase>package</phase>
- <goals>
- <goal>assembly</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <descriptors>
- <descriptor>src/assembly/standalone.xml</descriptor>
- <descriptor>src/assembly/distribution.xml</descriptor>
- </descriptors>
- <finalName>${project.artifactId}-${project.version}</finalName>
- <outputDirectory>target</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
- <tarLongFileMode>warn</tarLongFileMode>
- <archive>
- <manifest>
- <mainClass>com.tinkerpop.gremlin.console.Console</mainClass>
- </manifest>
- </archive>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.gmaven</groupId>
- <artifactId>gmaven-plugin</artifactId>
- <version>1.3</version>
- <executions>
- <execution>
- <goals>
- <goal>generateStubs</goal>
- <goal>compile</goal>
- <goal>generateTestStubs</goal>
- <goal>testCompile</goal>
- </goals>
- <configuration>
- <providerSelection>1.7</providerSelection>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <artifactId>maven-deploy-plugin</artifactId>
- <version>2.5</version>
- <dependencies>
- <dependency>
- <groupId>org.apache.maven.wagon</groupId>
- <artifactId>wagon-ftp</artifactId>
- <version>1.0-alpha-6</version>
- </dependency>
- </dependencies>
- </plugin>
- </plugins>
- </build>
- <distributionManagement>
- <repository>
- <id>tinkerpop-repository</id>
- <name>TinkerPop Maven2 Repository</name>
- <url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
- </repository>
- </distributionManagement>
-</project>
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.tinkerpop.gremlin</groupId>
+ <artifactId>gremlin</artifactId>
+ <version>1.4-SNAPSHOT</version>
+ <packaging>pom</packaging>
+ <url>http://gremlin.tinkerpop.com</url>
+ <name>Gremlin: A Graph Traversal Language</name>
+ <description>Gremlin is a domain specific language for traversing property graphs.
+ Gremlin makes use of a path-based syntax to support complex graph traversals.
+ This language has application in the areas of graph query, analysis, and manipulation.
+ </description>
+ <inceptionYear>2011</inceptionYear>
+ <contributors>
+ <contributor>
+ <name>Marko A. Rodriguez</name>
+ <email>marko@markorodriguez.com</email>
+ <url>http://markorodriguez.com</url>
+ </contributor>
+ </contributors>
+
+ <modules>
+ <module>gremlin-core</module>
+ <module>gremlin-groovy</module>
+ <module>gremlin-scala</module>
+ </modules>
+
+ <repositories>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>http://tinkerpop.com/maven2</url>
+ <snapshots>
+ <enabled>true</enabled>
+ <updatePolicy>always</updatePolicy>
+ </snapshots>
+ </repository>
+ </repositories>
+
+ <build>
+ <directory>${basedir}/target</directory>
+ <plugins>
+ <plugin>
+ <artifactId>maven-deploy-plugin</artifactId>
+ <version>2.5</version>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.wagon</groupId>
+ <artifactId>wagon-ftp</artifactId>
+ <version>1.0-alpha-6</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ </plugins>
+ </build>
+
+ <distributionManagement>
+ <repository>
+ <id>tinkerpop-repository</id>
+ <name>TinkerPop Maven2 Repository</name>
+ <url>ftp://ftp.tinkerpop.com:21/public/maven2/</url>
+ </repository>
+ </distributionManagement>
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <version>2.8</version>
+ <configuration>
+ <aggregate>true</aggregate>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+</project>

0 comments on commit 1786101

Please sign in to comment.