Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] GraphAr Cli #575

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions maven-projects/spark/graphar-cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# GraphAr Cli Tool

This is a project that depends on the GraphAr spark library.

## Building

To build this project, we need to use `Maven` to enable the
`datasource` and `graphar-cli` profiles in the `spark`
directory (that is, the parent directory of the current path).

```bash
$ git clone https://github.com/apache/incubator-graphar.git
$ cd incubator-graphar
$ cd mavens-projects/spark
```


Build the package:

```bash
$ mvn clean install -DskipTests -P datasources-32,graphar-cli
```

## Running

The build produces a shaded Jar that can be run using the `spark-submit` command:

```bash
$ cd graphar-cli/target
$ spark-submit --class org.apache.graphar.cli.Main graphar-cli-0.12.0-SNAPSHOT-shaded.jar
```

For a shorter command-line invocation, add an alias to your shell like this:

```
alias graphar="spark-submit --class org.apache.graphar.cli.Main /path/to/graphar-cli-0.12.0-SNAPSHOT-shaded.jar"
```
102 changes: 102 additions & 0 deletions maven-projects/spark/graphar-cli/import.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
{
"graphar": {
"path": "/tmp/graphar/movie",
"name": "MovieGraph",
"vertexChunkSize": 100,
"edgeChunkSize": 1024,
"fileType": "parquet"
},
"sourceType": "csv",
"neo4j": {
"url": "bolt://localhost:7687",
"username": "neo4j",
"password": "neo4j"
},
"schema": {
"vertices": [
{
"label": "Person",
"primary": "name",
"properties": [
{
"name": "name",
"type": "string"
},
{
"name": "born",
"type": "int",
"nullable": true
}
],
"propertyGroups": [
[
"name",
"born"
]
],
"source": {
"path": "/tmp/graphar/movie/Person.csv",
"delimiter": ",",
"columns": [
"name",
"born"
]
}
},
{
"label": "Movie",
"primary": "title",
"properties": [
{
"name": "title",
"type": "string"
},
{
"name": "tagline",
"type": "string",
"nullable": true
}
],
"propertyGroups": [
[
"title",
"tagline"
]
],
"source": {
"path": "/tmp/graphar/movie/Movie.csv",
"delimiter": ","
}
}
],
"edges": [
{
"label": "PRODUCED",
"adjListType": "",
"srcLabel": "Person",
"srcProp": "name",
"dstLabel": "Movie",
"dstProp": "title",
"source": {
"path": "/tmp/graphar/movie/Produced.csv",
"delimiter": ","
}
},
{
"label": "REVIEWED",
"srcLabel": "Person",
"srcProp": "name",
"dstLabel": "Movie",
"dstProp": "title",
"properties": [
"rating",
"summary"
],
"source": {
"path": "/tmp/graphar/movie/Reviewed.csv",
"delimiter": ","
}
}
]
}
}
234 changes: 234 additions & 0 deletions maven-projects/spark/graphar-cli/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,234 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--

Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.

-->

<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.apache.graphar</groupId>
<artifactId>spark</artifactId>
<version>${graphar.version}</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>graphar-cli</artifactId>
<version>${graphar.version}</version>
<packaging>jar</packaging>

<properties>
<slf4j.version>1.7.30</slf4j.version>
</properties>

<dependencies>
<dependency>
<groupId>info.picocli</groupId>
<artifactId>picocli</artifactId>
<version>4.7.6</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
<scope>${deps.scope}</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>${deps.scope}</scope>
</dependency>
<dependency>
<groupId>org.apache.graphar</groupId>
<artifactId>graphar-commons</artifactId>
<version>${graphar.version}</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_${scala.binary.version}</artifactId>
<version>${spark.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
<args>
<arg>-target:jvm-1.8</arg>
</args>
<jvmArgs>
<jvmArg>-Xss4096K</jvmArg>
</jvmArgs>
</configuration>
<executions>
<execution>
<id>scala-compile</id>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</configuration>
</execution>
<execution>
<id>scala-test-compile</id>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>2.0.0</version>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
<shadedArtifactAttached>true</shadedArtifactAttached>
<artifactSet>
<includes>
<!-- Include here the dependencies you
want to be packed in your fat jar -->
<include>*:*</include>
</includes>
</artifactSet>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
<exclude>**/log4j.properties</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>reference.conf</resource>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>4.8.0</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<jvmArgs>
<jvmArg>-Xms64m</jvmArg>
<jvmArg>-Xmx1024m</jvmArg>
</jvmArgs>
<args>
<arg>-Ywarn-unused</arg>
</args>
<compilerPlugins>
<compilerPlugin>
<groupId>org.scalameta</groupId>
<artifactId>semanticdb-scalac_2.12.10</artifactId>
<version>4.3.24</version>
</compilerPlugin>
</compilerPlugins>
</configuration>
</plugin>
<plugin>
<groupId>io.github.evis</groupId>
<artifactId>scalafix-maven-plugin_2.13</artifactId>
<version>0.1.8_0.11.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
</plugins>
</build>
</project>
Loading
Loading