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 enum class Type;
74 class DataType;
76 enum Cardinality { SINGLE, LIST, SET };
78 enum FileType { CSV = 0, PARQUET = 1, ORC = 2, JSON = 3 };
79 enum SelectType { PROPERTIES = 0, LABELS = 1 };
81 enum GetChunkVersion { AUTO = 0, V1 = 1, V2 = 2 };
82 enum class AdjListType : uint8_t;
83 
84 template <typename T>
85 class Array;
86 
87 class InfoVersion;
88 
89 class Property;
90 class PropertyGroup;
91 class AdjacentList;
92 class Expression;
93 
94 class VertexInfo;
95 class EdgeInfo;
96 class GraphInfo;
97 
98 using PropertyGroupVector = std::vector<std::shared_ptr<PropertyGroup>>;
99 using AdjacentListVector = std::vector<std::shared_ptr<AdjacentList>>;
100 using VertexInfoVector = std::vector<std::shared_ptr<VertexInfo>>;
101 using EdgeInfoVector = std::vector<std::shared_ptr<EdgeInfo>>;
102 
112 std::shared_ptr<PropertyGroup> CreatePropertyGroup(
113  const std::vector<Property>& properties, FileType file_type,
114  const std::string& prefix = "");
115 
125 std::shared_ptr<AdjacentList> CreateAdjacentList(
126  AdjListType type, FileType file_type, const std::string& prefix = "");
127 
140 std::shared_ptr<VertexInfo> CreateVertexInfo(
141  const std::string& type, IdType chunk_size,
142  const PropertyGroupVector& property_groups,
143  const std::vector<std::string>& labels = {}, const std::string& prefix = "",
144  std::shared_ptr<const InfoVersion> version = nullptr);
145 
163 std::shared_ptr<EdgeInfo> CreateEdgeInfo(
164  const std::string& src_type, const std::string& edge_type,
165  const std::string& dst_type, IdType chunk_size, IdType src_chunk_size,
166  IdType dst_chunk_size, bool directed,
167  const AdjacentListVector& adjacent_lists,
168  const PropertyGroupVector& property_groups, const std::string& prefix = "",
169  std::shared_ptr<const InfoVersion> version = nullptr);
170 
184 std::shared_ptr<GraphInfo> CreateGraphInfo(
185  const std::string& name, const VertexInfoVector& vertex_infos,
186  const EdgeInfoVector& edge_infos, const std::vector<std::string>& labels,
187  const std::string& prefix,
188  std::shared_ptr<const InfoVersion> version = nullptr,
189  const std::unordered_map<std::string, std::string>& extra_info = {});
190 
192 const std::shared_ptr<DataType>& boolean();
194 const std::shared_ptr<DataType>& int32();
196 const std::shared_ptr<DataType>& int64();
198 const std::shared_ptr<DataType>& float32();
200 const std::shared_ptr<DataType>& float64();
202 const std::shared_ptr<DataType>& string();
204 const std::shared_ptr<DataType>& date();
206 const std::shared_ptr<DataType>& timestamp();
212 std::shared_ptr<DataType> list(const std::shared_ptr<DataType>& value_type);
213 } // namespace graphar
214 
215 namespace graphar::util {
216 struct FilterOptions;
217 using Filter = std::shared_ptr<Expression>;
218 using ColumnNames =
219  std::optional<std::reference_wrapper<std::vector<std::string>>>;
220 } // namespace graphar::util