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

[Spark] Refine the GraphWriter to automatically generate graph info and improve the Neo4j case #196

Merged
merged 27 commits into from
Jul 18, 2023
Merged
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
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ on:
- docs
- dev/docs

concurrency:
group: ${{ github.repository }}-${{ github.event.number || github.head_ref || github.sha }}-${{ github.workflow }}
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
Expand Down
28 changes: 28 additions & 0 deletions .github/workflows/spark.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,31 @@ jobs:
pushd spark
mvn test
popd

- name: Run Neo4j2GraphAr example
run: |
export JAVA_HOME=${JAVA_HOME_11_X64}
pushd spark
scripts/get-spark-to-home.sh
export SPARK_HOME="${HOME}/spark-3.2.2-bin-hadoop3.2"
export PATH="${SPARK_HOME}/bin":"${PATH}"

scripts/get-neo4j-to-home.sh
export NEO4J_HOME="${HOME}/neo4j-community-4.4.23"
export PATH="${NEO4J_HOME}/bin":"${PATH}"
neo4j-admin set-initial-password neo4j

scripts/deploy-neo4j-movie-data.sh

scripts/build.sh

export NEO4J_USR="neo4j"
export NEO4J_PWD="neo4j"
scripts/run-neo4j2graphar.sh

# clean the movie data and import from GraphAr
echo "match (a) -[r] -> () delete a, r;match (a) delete a;" | cypher-shell -u ${NEO4J_USR} -p ${NEO4J_PWD} -d neo4j --format plain
scripts/run-graphar2neo4j.sh

# stop and clean
popd
77 changes: 34 additions & 43 deletions cpp/README.rst → cpp/README.md
Original file line number Diff line number Diff line change
@@ -1,126 +1,117 @@
GraphAr C++
============
# GraphAr C++

This directory contains the code and build system for the GraphAr C++ library.


Building GraphAr C++
--------------------
## Building GraphAr C++

System setup
^^^^^^^^^^^^
### System setup

GraphAr C++ uses CMake as a build configuration system. We recommend building
out-of-source. If you are not familiar with this terminology:

* **In-source build**: ``cmake`` is invoked directly from the ``cpp``
- **In-source build**: ``cmake`` is invoked directly from the ``cpp``
directory. This can be inflexible when you wish to maintain multiple build
environments (e.g. one for debug builds and another for release builds)
* **Out-of-source build**: ``cmake`` is invoked from another directory,
- **Out-of-source build**: ``cmake`` is invoked from another directory,
creating an isolated build environment that does not interact with any other
build environment. For example, you could create ``cpp/build-debug`` and
invoke ``cmake $CMAKE_ARGS ..`` from this directory

Building requires:

* A C++17-enabled compiler. On Linux, gcc 7.1 and higher should be
- A C++17-enabled compiler. On Linux, gcc 7.1 and higher should be
sufficient. For MacOS, at least clang 5 is required
* CMake 3.5 or higher
* On Linux and macOS, ``make`` build utilities
* curl-devel with SSL (Linux) or curl (macOS), for s3 filesystem support
- CMake 3.5 or higher
- On Linux and macOS, ``make`` build utilities
- curl-devel with SSL (Linux) or curl (macOS), for s3 filesystem support

Dependencies for optional features:

* `Doxygen <https://www.doxygen.nl/index.html>`_ (>= 1.8) for generating documentation
- [Doxygen](https://www.doxygen.nl/index.html) (>= 1.8) for generating documentation

Extra dependencies are required by examples:

* `BGL <https://www.boost.org/doc/libs/1_80_0/libs/graph/doc/index.html>`_ (>= 1.58)

- [BGL](https://www.boost.org/doc/libs/1_80_0/libs/graph/doc/index.html) (>= 1.58)

Building
^^^^^^^^^
### Building

All the instructions below assume that you have cloned the GraphAr git
repository and navigated to the ``cpp`` subdirectory:

.. code-block:: shell

```bash
$ git clone https://github.com/alibaba/GraphAr.git
$ cd GraphAr
$ git submodule update --init
$ cd cpp
```

Release build:

.. code-block:: shell

```bash
$ mkdir build-release
$ cd build-release
$ cmake ..
$ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores
```

Build with a custom namespace:

The :code:`namespace` is configurable. By default,
it is defined in :code:`namespace GraphArchive`; however this can be toggled by
setting :code:`NAMESPACE` option with cmake:

.. code:: shell
The `namespace` is configurable. By default,
it is defined in `namespace GraphArchive`; however this can be toggled by
setting `NAMESPACE` option with cmake:

```bash
$ mkdir build
$ cd build
$ cmake -DNAMESPACE=MyNamespace ..
$ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores
```

Debug build with unit tests:

.. code-block:: shell

```bash
$ export GAR_TEST_DATA=$PWD/../testing/
$ mkdir build-debug
$ cd build-debug
$ cmake -DCMAKE_BUILD_TYPE=Debug -DBUILD_TESTS=ON ..
$ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores
$ make test # to run the tests
```

Build with examples:

.. code-block:: shell

```bash
$ export GAR_TEST_DATA=$PWD/../testing/
$ mkdir build-examples
$ cd build-examples
$ cmake -DBUILD_EXAMPLES=ON ..
$ make -j8 # if you have 8 CPU cores, otherwise adjust, use -j`nproc` for all cores
$ ./bgl_example # run the BGL example
```

Install
^^^^^^^^^
### Install

After the building, you can install the GraphAr C++ library with:

.. code-block:: shell

```bash
$ sudo make install # run in directory you build, like build-release, build and so on
```

Generate API document
^^^^^^^^^^^^^^^^^^^^^
### Generate API document

Building the API document with Doxygen:

.. code-block:: shell

```bash
$ cd GraphAr/cpp
$ pushd apidoc
$ doxgen
$ popd
```

The API document is generated in the directory ``cpp/apidoc/html``.

## How to use

How to use
-----------

Please refer to our `GraphAr C++ API Reference`_.
Please refer to our [GraphAr C++ API Reference](https://alibaba.github.io/GraphAr/reference/api-reference-cpp.html).

.. _GraphAr C++ API Reference: https://alibaba.github.io/GraphAr/reference/api-reference-cpp.html
Loading