Skip to content

Commit

Permalink
tugraph iso gql
Browse files Browse the repository at this point in the history
  • Loading branch information
spasserby authored and tugraph committed Sep 2, 2023
1 parent d61a089 commit c183b48
Show file tree
Hide file tree
Showing 118 changed files with 9,189 additions and 730 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ logs/
*artifacts
.DS_Store
.cache
*.real

# docs
doc/en-US/build
Expand Down
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.13)
project(TuGraph C CXX)

message("Community version.")
Expand Down Expand Up @@ -29,7 +29,23 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/output)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/output)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/output)

# third-party
if(NOT DEFINED TUGRAPH_THIRD_PARTY_DIR)
set(TUGRAPH_THIRD_PARTY_DIR "/usr/local;/usr")
endif()
if (NOT DEFINED GEAX_THIRD_PARTY_DIR)
set(GEAX_THIRD_PARTY_DIR ${TUGRAPH_THIRD_PARTY_DIR})
endif()

# modules
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
find_package(OpenSSL REQUIRED)
# boost
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.68 REQUIRED COMPONENTS log system filesystem)

# target
add_subdirectory(deps/geax-front-end)
add_subdirectory(src)
add_subdirectory(test)
add_subdirectory(toolkits)
Expand Down
3 changes: 3 additions & 0 deletions Options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ else (ENABLE_LGRAPH_LOG)
message("Use native fma log.")
endif (ENABLE_LGRAPH_LOG)

# disable krb5
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DOPENSSL_NO_KRB5=1")

# Detect build type, fallback to release and throw a warning if use didn't specify any
if (NOT CMAKE_BUILD_TYPE)
message(WARNING "Build type not set, falling back to RelWithDebInfo mode.
Expand Down
10 changes: 5 additions & 5 deletions ci/it.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ cd $MY_WORKSPACE

# integrate tests
cd build/output
cp ../../src/client/python/TuGraphClient/TuGraphClient.py .
cp ../../src/client/python/TuGraphClient/TuGraphRestClient.py .
cp -r ../../test/integration/* ./
cp -r ../../learn/examples/* ./
cp -r ../../demo/movie .
ln -s ../../src/client/python/TuGraphClient/TuGraphClient.py .
ln -s ../../src/client/python/TuGraphClient/TuGraphRestClient.py .
ln -s ../../test/integration/* ./
ln -s ../../learn/examples/* ./
ln -s ../../demo/movie .
pytest ./

# codecov
Expand Down
41 changes: 41 additions & 0 deletions cmake/FindOpenSSL.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
include(FindPackageHandleStandardArgs)

if ("$ENV{OpenSSL_DIR}" STREQUAL "")
set(OpenSSL_ROOT ${TUGRAPH_THIRD_PARTY_DIR})
else()
set(OpenSSL_ROOT "$ENV{OpenSSL_DIR}")
endif()

foreach(component ssl crypto)
find_path(OpenSSL_${component}_INCLUDE_DIR openssl/ssl.h
PATHS ${OpenSSL_ROOT}
PATH_SUFFIXES include
NO_DEFAULT_PATH)

find_library(OpenSSL_${component}_LIBRARY
NAMES lib${component}.a
PATHS ${OpenSSL_ROOT}
PATH_SUFFIXES lib
NO_DEFAULT_PATH)
endforeach()

find_package_handle_standard_args(OpenSSL
DEFAULT_MSG
OpenSSL_ssl_INCLUDE_DIR
OpenSSL_ssl_LIBRARY
OpenSSL_crypto_INCLUDE_DIR
OpenSSL_crypto_LIBRARY)

if(OpenSSL_FOUND)
add_library(OpenSSL::crypto STATIC IMPORTED)
set_target_properties(OpenSSL::crypto
PROPERTIES
IMPORTED_LOCATION ${OpenSSL_crypto_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OpenSSL_crypto_INCLUDE_DIR})
add_library(OpenSSL::ssl STATIC IMPORTED)
set_target_properties(OpenSSL::ssl
PROPERTIES
IMPORTED_LOCATION ${OpenSSL_ssl_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${OpenSSL_ssl_INCLUDE_DIR}
INTERFACE_LINK_LIBRARIES "OpenSSL::crypto")
endif()
2 changes: 1 addition & 1 deletion demo/CppRpcClientDemo/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.13)
PROJECT(CLIENTDEMO)

SET(SRC_LIST client_demo.cpp)
Expand Down
2 changes: 1 addition & 1 deletion demo/MultithreadClient/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.13)
PROJECT(CLIENTDEMO)

SET(SRC_LIST multi_thread_client.cpp
Expand Down
6 changes: 3 additions & 3 deletions include/lgraph/lgraph_rpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ namespace lgraph {

class LGraphRequest;
class LGraphResponse;
class CypherResult;
class CypherResponse;
class GraphQueryResult;
class GraphQueryResponse;
class BackupLogEntry;

enum ClientType {
Expand Down Expand Up @@ -254,7 +254,7 @@ class RpcClient {

std::string CypherResultExtractor(const CypherResult cypher);
#endif
std::string CypherResponseExtractor(const CypherResponse& cypher);
std::string CypherResponseExtractor(const GraphQueryResponse& cypher);

std::string url;
std::string user;
Expand Down
13 changes: 13 additions & 0 deletions include/lgraph/lgraph_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,19 @@ inline static std::string to_string(const FieldAccessLevel& v) {
}
}

enum class GraphQueryType {
CYPHER = 0,
GQL = 1
};

inline static std::string to_string(const GraphQueryType& v) {
switch (v) {
case GraphQueryType::CYPHER: return "CYPHER";
case GraphQueryType::GQL: return "GQL";
default: throw std::runtime_error("Unknown GraphQueryType");
}
}

/**
* @brief Edge constraints type define
*/
Expand Down
2 changes: 1 addition & 1 deletion learn/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(TuGraph C CXX)

function(add_extension2 APP)
Expand Down
6 changes: 1 addition & 5 deletions plugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
cmake_minimum_required(VERSION 3.2)
cmake_minimum_required(VERSION 3.13)
project(TuGraph C CXX)

# boost
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.68 REQUIRED COMPONENTS log system filesystem)

set(LGRAPH_API_SRC
${CMAKE_SOURCE_DIR}/src/lgraph_api/olap_base.cpp
${CMAKE_SOURCE_DIR}/src/lgraph_api/lgraph_utils.cpp
Expand Down
13 changes: 6 additions & 7 deletions src/BuildClients.cmake
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# brpc
set(BRPC_LIB libbrpc.a)

# boost
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.68 REQUIRED COMPONENTS log system filesystem)

if (ENABLE_FULLTEXT_INDEX)
# jni
find_package(JNI REQUIRED)
Expand Down Expand Up @@ -61,9 +57,9 @@ if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
-static-libstdc++
-static-libgcc
libstdc++fs.a
OpenSSL::ssl
OpenSSL::crypto
-Wl,-Bdynamic
ssl
crypto
rt
dl
z
Expand Down Expand Up @@ -92,7 +88,7 @@ else ()
profiler
snappy
pthread
ssl
OpenSSL::ssl
z
)
endif ()
Expand All @@ -112,6 +108,9 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
boost_system
boost_filesystem
${JAVA_JVM_LIBRARY})
else()
target_link_libraries(${TARGET_CPP_CLIENT_REST} PUBLIC
geax_isogql)
endif()

target_include_directories(${TARGET_CPP_CLIENT_REST} PRIVATE
Expand Down
8 changes: 7 additions & 1 deletion src/BuildCypherLib.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@ find_package(PythonInterp 3)
find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT REQUIRED)
#antlr4-runtime
find_package(antlr4-runtime REQUIRED)
include_directories( ${ANTLR4_INCLUDE_DIR} )
set(ANTRL4_LIBRARY antlr4-runtime.a)

set(TARGET_LGRAPH_CYPHER_LIB lgraph_cypher_lib)

set(LGRAPH_CYPHER_SRC # find cypher/ -name "*.cpp" | sort
cypher/arithmetic/agg_funcs.cpp
cypher/arithmetic/arithmetic_expression.cpp
cypher/arithmetic/ast_agg_expr_detector.cpp
cypher/arithmetic/ast_expr_evaluator.cpp
cypher/execution_plan/execution_plan.cpp
cypher/execution_plan/execution_plan_v2.cpp
cypher/execution_plan/execution_plan_maker.cpp
cypher/execution_plan/pattern_graph_maker.cpp
cypher/execution_plan/ops/op_aggregate.cpp
cypher/execution_plan/ops/op_all_node_scan.cpp
cypher/execution_plan/ops/op_apply.cpp
Expand Down Expand Up @@ -72,8 +76,10 @@ add_library(${TARGET_LGRAPH_CYPHER_LIB} STATIC
set_target_properties(${TARGET_LGRAPH_CYPHER_LIB} PROPERTIES LINKER_LANGUAGE CXX)

target_include_directories(${TARGET_LGRAPH_CYPHER_LIB} PUBLIC
${ANTLR4_INCLUDE_DIR}
${CMAKE_CURRENT_LIST_DIR}/cypher)

target_link_libraries(${TARGET_LGRAPH_CYPHER_LIB} PUBLIC
${ANTRL4_LIBRARY}
geax_isogql
lgraph)
10 changes: 3 additions & 7 deletions src/BuildLGraphApi.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
cmake_minimum_required(VERSION 3.1)

# boost
set(Boost_USE_STATIC_LIBS ON)
find_package(Boost 1.68 REQUIRED COMPONENTS log system filesystem)

# threads
find_package(Threads REQUIRED)

Expand Down Expand Up @@ -114,7 +110,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
${PROTOBUF_LIBRARY}
-Wl,--no-whole-archive
${JAVA_JVM_LIBRARY}
crypto
OpenSSL::crypto
pthread
rt
z
Expand All @@ -125,7 +121,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
${Boost_LIBRARIES}
omp
pthread
crypto
OpenSSL::crypto
${PROTOBUF_LIBRARY}
${JAVA_JVM_LIBRARY})
else ()
Expand All @@ -138,7 +134,7 @@ elseif (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
-Wl,-Bdynamic
c++experimental
c++fs
crypto
OpenSSL::crypto
-Wl,--whole-archive
${PROTOBUF_LIBRARY}
-Wl,--no-whole-archive
Expand Down
11 changes: 5 additions & 6 deletions src/BuildLGraphServer.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,6 @@ if ((NOT LEVELDB_INCLUDE_PATH) OR (NOT LEVELDB_LIB))
message(FATAL_ERROR "Fail to find leveldb")
endif ()

# openssl for cpprest
find_package(OpenSSL)

# protbuf
include(cmake/GenerateProtobuf.cmake)
GenerateProtobufCpp(${CMAKE_CURRENT_LIST_DIR}/protobuf
Expand Down Expand Up @@ -67,6 +64,7 @@ if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
PUBLIC
lgraph
lgraph_cypher_lib
geax_isogql
# begin static linking
-Wl,-Bstatic
cpprest
Expand All @@ -77,10 +75,10 @@ if (NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin"))
${GPERFTOOLS_LIBRARIES}
${LEVELDB_LIB}
snappy
OpenSSL::ssl
OpenSSL::crypto
# end static linking
-Wl,-Bdynamic
ssl
crypto
dl
c
)
Expand Down Expand Up @@ -109,7 +107,8 @@ else ()
profiler
snappy
pthread
ssl
OpenSSL::ssl
OpenSSL::crypto
z
)
endif ()
Expand Down
7 changes: 6 additions & 1 deletion src/client/cpp/restful/rest_client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@
#include "client/cpp/restful/rest_client.h"
#include "client/cpp/restful/restful_exception.h"
#include "core/lightning_graph.h"
#include "cpprest/http_client.h"
#include "restful/server/json_convert.h"
// The 'U' macro can be used to create a string or character literal of the platform type, i.e.
// utility::char_t. If you are using a library causing conflicts with 'U' macro, it can be turned
// off by defining the macro '_TURN_OFF_PLATFORM_STRING' before including the C++ REST SDK header
// files, and e.g. use '_XPLATSTR' instead.
#define _TURN_OFF_PLATFORM_STRING
#include "cpprest/http_client.h"
#include "cpprest/json.h"

#ifdef _WIN32
Expand Down
5 changes: 5 additions & 0 deletions src/client/cpp/restful/rest_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@

#include "fma-common/logger.h"

// The 'U' macro can be used to create a string or character literal of the platform type, i.e.
// utility::char_t. If you are using a library causing conflicts with 'U' macro, it can be turned
// off by defining the macro '_TURN_OFF_PLATFORM_STRING' before including the C++ REST SDK header
// files, and e.g. use '_XPLATSTR' instead.
#define _TURN_OFF_PLATFORM_STRING
#include "cpprest/json.h"
#include "lgraph/lgraph.h"
#include "plugin/plugin_desc.h"
Expand Down
Loading

0 comments on commit c183b48

Please sign in to comment.