Apache GraphAr C++ Library
The C++ Library for Apache GraphAr
fwd.h
1 /*
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  */
19 
20 #pragma once
21 
22 #include <memory>
23 #include <optional>
24 #include <string>
25 #include <unordered_map>
26 #include <vector>
27 
28 #include "result/result.hpp"
29 
30 #include "graphar/macros.h"
31 #include "graphar/status.h"
32 
33 namespace graphar {
34 
35 class Status;
36 
64 template <typename T>
65 using Result = cpp::result<T, Status>;
66 
67 struct GeneralParams;
68 class Yaml;
69 class FileSystem;
70 
72 using IdType = int64_t;
73 class DataType;
75 enum Cardinality : int32_t { SINGLE, LIST, SET };
77 enum FileType : int32_t { CSV = 0, PARQUET = 1, ORC = 2, JSON = 3 };
78 enum SelectType : int32_t { PROPERTIES = 0, LABELS = 1 };
80 enum GetChunkVersion : int32_t { AUTO = 0, V1 = 1, V2 = 2 };
81 enum class AdjListType : int32_t;
82 
83 template <typename T>
84 class Array;
85 
86 class InfoVersion;
87 
88 class Property;
89 class PropertyGroup;
90 class AdjacentList;
91 class Expression;
92 
93 class VertexInfo;
94 class EdgeInfo;
95 class GraphInfo;
96 
97 using PropertyGroupVector = std::vector<std::shared_ptr<PropertyGroup>>;
98 using AdjacentListVector = std::vector<std::shared_ptr<AdjacentList>>;
99 using VertexInfoVector = std::vector<std::shared_ptr<VertexInfo>>;
100 using EdgeInfoVector = std::vector<std::shared_ptr<EdgeInfo>>;
101 
111 std::shared_ptr<PropertyGroup> CreatePropertyGroup(
112  const std::vector<Property>& properties, FileType file_type,
113  const std::string& prefix = "");
114 
124 std::shared_ptr<AdjacentList> CreateAdjacentList(
125  AdjListType type, FileType file_type, const std::string& prefix = "");
126 
139 std::shared_ptr<VertexInfo> CreateVertexInfo(
140  const std::string& type, IdType chunk_size,
141  const PropertyGroupVector& property_groups,
142  const std::vector<std::string>& labels = {}, const std::string& prefix = "",
143  std::shared_ptr<const InfoVersion> version = nullptr);
144 
162 std::shared_ptr<EdgeInfo> CreateEdgeInfo(
163  const std::string& src_type, const std::string& edge_type,
164  const std::string& dst_type, IdType chunk_size, IdType src_chunk_size,
165  IdType dst_chunk_size, bool directed,
166  const AdjacentListVector& adjacent_lists,
167  const PropertyGroupVector& property_groups, const std::string& prefix = "",
168  std::shared_ptr<const InfoVersion> version = nullptr);
169 
183 std::shared_ptr<GraphInfo> CreateGraphInfo(
184  const std::string& name, const VertexInfoVector& vertex_infos,
185  const EdgeInfoVector& edge_infos, const std::vector<std::string>& labels,
186  const std::string& prefix,
187  std::shared_ptr<const InfoVersion> version = nullptr,
188  const std::unordered_map<std::string, std::string>& extra_info = {});
189 
191 const std::shared_ptr<DataType>& boolean();
193 const std::shared_ptr<DataType>& int32();
195 const std::shared_ptr<DataType>& int64();
197 const std::shared_ptr<DataType>& float32();
199 const std::shared_ptr<DataType>& float64();
201 const std::shared_ptr<DataType>& string();
203 const std::shared_ptr<DataType>& date();
205 const std::shared_ptr<DataType>& timestamp();
211 std::shared_ptr<DataType> list(const std::shared_ptr<DataType>& value_type);
212 } // namespace graphar
213 
214 namespace graphar::util {
215 struct FilterOptions;
216 using Filter = std::shared_ptr<Expression>;
217 using ColumnNames =
218  std::optional<std::reference_wrapper<std::vector<std::string>>>;
219 } // namespace graphar::util