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 FileType { CSV = 0, PARQUET = 1, ORC = 2, JSON = 3 };
77 enum class AdjListType : uint8_t;
78 
79 template <typename T>
80 class Array;
81 
82 class InfoVersion;
83 
84 class Property;
85 class PropertyGroup;
86 class AdjacentList;
87 class Expression;
88 
89 class VertexInfo;
90 class EdgeInfo;
91 class GraphInfo;
92 
93 using PropertyGroupVector = std::vector<std::shared_ptr<PropertyGroup>>;
94 using AdjacentListVector = std::vector<std::shared_ptr<AdjacentList>>;
95 using VertexInfoVector = std::vector<std::shared_ptr<VertexInfo>>;
96 using EdgeInfoVector = std::vector<std::shared_ptr<EdgeInfo>>;
97 
107 std::shared_ptr<PropertyGroup> CreatePropertyGroup(
108  const std::vector<Property>& properties, FileType file_type,
109  const std::string& prefix = "");
110 
120 std::shared_ptr<AdjacentList> CreateAdjacentList(
121  AdjListType type, FileType file_type, const std::string& prefix = "");
122 
134 std::shared_ptr<VertexInfo> CreateVertexInfo(
135  const std::string& label, IdType chunk_size,
136  const PropertyGroupVector& property_groups, const std::string& prefix = "",
137  std::shared_ptr<const InfoVersion> version = nullptr);
138 
156 std::shared_ptr<EdgeInfo> CreateEdgeInfo(
157  const std::string& src_label, const std::string& edge_label,
158  const std::string& dst_label, IdType chunk_size, IdType src_chunk_size,
159  IdType dst_chunk_size, bool directed,
160  const AdjacentListVector& adjacent_lists,
161  const PropertyGroupVector& property_groups, const std::string& prefix = "",
162  std::shared_ptr<const InfoVersion> version = nullptr);
163 
176 std::shared_ptr<GraphInfo> CreateGraphInfo(
177  const std::string& name, const VertexInfoVector& vertex_infos,
178  const EdgeInfoVector& edge_infos, const std::string& prefix,
179  std::shared_ptr<const InfoVersion> version = nullptr,
180  const std::unordered_map<std::string, std::string>& extra_info = {});
181 
183 const std::shared_ptr<DataType>& boolean();
185 const std::shared_ptr<DataType>& int32();
187 const std::shared_ptr<DataType>& int64();
189 const std::shared_ptr<DataType>& float32();
191 const std::shared_ptr<DataType>& float64();
193 const std::shared_ptr<DataType>& string();
195 const std::shared_ptr<DataType>& date();
197 const std::shared_ptr<DataType>& timestamp();
203 std::shared_ptr<DataType> list(const std::shared_ptr<DataType>& value_type);
204 } // namespace graphar
205 
206 namespace graphar::util {
207 struct FilterOptions;
208 using Filter = std::shared_ptr<Expression>;
209 using ColumnNames =
210  std::optional<std::reference_wrapper<std::vector<std::string>>>;
211 } // namespace graphar::util