This is an automated email from the ASF dual-hosted git repository.
spica pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-graphar.git
The following commit(s) were added to refs/heads/main by this push:
new 734f615 [java-info] Add basic architecture java-info into main (#481)
734f615 is described below
commit 734f61538edce6d1cdbb4643ff5b21923ad3e245
Author: John <[email protected]>
AuthorDate: Tue May 14 22:44:31 2024 +0800
[java-info] Add basic architecture java-info into main (#481)
* Add basic architecture java-info into main
* Rename java-info to info
---
maven-projects/info/.scalafmt.conf | 8 +
maven-projects/info/README.md | 1 +
maven-projects/info/pom.xml | 66 +++++++++
.../org/apache/graphar/info/type/AdjListType.java | 50 +++++++
.../org/apache/graphar/info/type/DataType.java | 69 +++++++++
.../org/apache/graphar/info/type/FileType.java | 42 ++++++
.../graphar/info/yaml/AdjacentListYamlParser.java | 75 ++++++++++
.../apache/graphar/info/yaml/EdgeYamlParser.java | 161 +++++++++++++++++++++
.../apache/graphar/info/yaml/GraphYamlParser.java | 109 ++++++++++++++
.../graphar/info/yaml/PropertyGroupYamlParser.java | 70 +++++++++
.../graphar/info/yaml/PropertyYamlParser.java | 76 ++++++++++
.../apache/graphar/info/yaml/VertexYamlParser.java | 92 ++++++++++++
.../org/apache/graphar/util/GeneralParams.java | 38 +++++
maven-projects/pom.xml | 1 +
14 files changed, 858 insertions(+)
diff --git a/maven-projects/info/.scalafmt.conf
b/maven-projects/info/.scalafmt.conf
new file mode 100644
index 0000000..a79ab29
--- /dev/null
+++ b/maven-projects/info/.scalafmt.conf
@@ -0,0 +1,8 @@
+version = "3.0.6"
+
+align.preset = some
+runner.dialect = scala212
+maxColumn = 80
+docstrings.style = Asterisk
+docstrings.removeEmpty = true
+project.git = true
diff --git a/maven-projects/info/README.md b/maven-projects/info/README.md
new file mode 100644
index 0000000..75aad17
--- /dev/null
+++ b/maven-projects/info/README.md
@@ -0,0 +1 @@
+This module is under development
\ No newline at end of file
diff --git a/maven-projects/info/pom.xml b/maven-projects/info/pom.xml
new file mode 100644
index 0000000..79d4119
--- /dev/null
+++ b/maven-projects/info/pom.xml
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements. See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership. The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the
+ specific language governing permissions and limitations
+ under the License.
+
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.graphar</groupId>
+ <artifactId>graphar-root</artifactId>
+ <version>${graphar.version}</version>
+ <relativePath>../pom.xml</relativePath>
+ </parent>
+
+ <artifactId>info</artifactId>
+ <packaging>jar</packaging>
+
+ <name>info</name>
+
+ <properties>
+ <maven.compiler.source>11</maven.compiler.source>
+ <maven.compiler.target>11</maven.compiler.target>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.13.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.yaml</groupId>
+ <artifactId>snakeyaml</artifactId>
+ <version>2.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.hadoop</groupId>
+ <artifactId>hadoop-common</artifactId>
+ <version>3.4.0</version>
+ </dependency>
+ </dependencies>
+
+
+</project>
\ No newline at end of file
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/type/AdjListType.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/type/AdjListType.java
new file mode 100644
index 0000000..a077d87
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/type/AdjListType.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.type;
+
+public enum AdjListType {
+ /** collection of edges by source, but unordered, can represent COO format
*/
+ unordered_by_source,
+ /** collection of edges by destination, but unordered, can represent COO */
+ unordered_by_dest,
+ /** collection of edges by source, ordered by source, can represent CSR
format */
+ ordered_by_source,
+ /** collection of edges by destination, ordered by destination, can
represent CSC format */
+ ordered_by_dest;
+
+ public static AdjListType fromOrderedAndAlignedBy(boolean ordered, String
alignedBy) {
+ switch (alignedBy) {
+ case "src":
+ return ordered ? ordered_by_source : unordered_by_source;
+ case "dst":
+ return ordered ? ordered_by_dest : unordered_by_dest;
+ default:
+ throw new IllegalArgumentException("Invalid alignedBy: " +
alignedBy);
+ }
+ }
+
+ public boolean isOrdered() {
+ return this == ordered_by_source || this == ordered_by_dest;
+ }
+
+ public String getAlignedBy() {
+ return this == ordered_by_source || this == unordered_by_source ?
"src" : "dst";
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/type/DataType.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/type/DataType.java
new file mode 100644
index 0000000..83c31ae
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/type/DataType.java
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.type;
+
+public enum DataType {
+ /** Boolean */
+ BOOL,
+
+ /** Signed 32-bit integer */
+ INT32,
+
+ /** Signed 64-bit integer */
+ INT64,
+
+ /** 4-byte floating point value */
+ FLOAT,
+
+ /** 8-byte floating point value */
+ DOUBLE,
+
+ /** UTF8 variable-length string */
+ STRING,
+
+ /** List of same type */
+ LIST;
+
+ public static DataType fromString(String s) {
+ switch (s) {
+ case "bool":
+ return BOOL;
+ case "int32":
+ return INT32;
+ case "int64":
+ return INT64;
+ case "float":
+ return FLOAT;
+ case "double":
+ return DOUBLE;
+ case "string":
+ return STRING;
+ case "list":
+ return LIST;
+ default:
+ throw new IllegalArgumentException("Unknown data type: " + s);
+ }
+ }
+
+ @Override
+ public String toString() {
+ return name().toLowerCase();
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/type/FileType.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/type/FileType.java
new file mode 100644
index 0000000..b45038b
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/type/FileType.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.type;
+
+public enum FileType {
+ CSV,
+ PARQUET,
+ ORC;
+
+ public static FileType fromString(String fileType) {
+ if (fileType == null) {
+ return null;
+ }
+ switch (fileType) {
+ case "csv":
+ return CSV;
+ case "parquet":
+ return PARQUET;
+ case "orc":
+ return ORC;
+ default:
+ throw new IllegalArgumentException("Unknown file type: " +
fileType);
+ }
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/AdjacentListYamlParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/AdjacentListYamlParser.java
new file mode 100644
index 0000000..a971c03
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/AdjacentListYamlParser.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.yaml;
+
+import org.apache.graphar.info.AdjacentList;
+
+public class AdjacentListYamlParser {
+ private boolean ordered;
+ private String aligned_by;
+ private String file_type;
+ private String prefix;
+
+ public AdjacentListYamlParser() {
+ this.ordered = false;
+ this.aligned_by = "";
+ this.file_type = "";
+ this.prefix = "";
+ }
+
+ public AdjacentListYamlParser(AdjacentList adjacentList) {
+ this.ordered = adjacentList.getType().isOrdered();
+ this.aligned_by = adjacentList.getType().getAlignedBy();
+ this.file_type = adjacentList.getFileType().toString();
+ this.prefix = adjacentList.getPrefix();
+ }
+
+ public boolean isOrdered() {
+ return ordered;
+ }
+
+ public void setOrdered(boolean ordered) {
+ this.ordered = ordered;
+ }
+
+ public String isAligned_by() {
+ return aligned_by;
+ }
+
+ public void setAligned_by(String aligned_by) {
+ this.aligned_by = aligned_by;
+ }
+
+ public String getFile_type() {
+ return file_type;
+ }
+
+ public void setFile_type(String file_type) {
+ this.file_type = file_type;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYamlParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYamlParser.java
new file mode 100644
index 0000000..0d8813c
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/EdgeYamlParser.java
@@ -0,0 +1,161 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.yaml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.graphar.info.EdgeInfo;
+
+public class EdgeYamlParser {
+ private String src_label;
+ private String edge_label;
+ private String dst_label;
+ private long chunk_size;
+ private long src_chunk_size;
+ private long dst_chunk_size;
+ private boolean directed;
+ private String prefix;
+ private List<AdjacentListYamlParser> adjacent_lists;
+ private List<PropertyGroupYamlParser> property_groups;
+ private String version;
+
+ public EdgeYamlParser() {
+ this.src_label = "";
+ this.edge_label = "";
+ this.dst_label = "";
+ this.chunk_size = 0;
+ this.src_chunk_size = 0;
+ this.dst_chunk_size = 0;
+ this.directed = false;
+ this.prefix = "";
+ this.adjacent_lists = new ArrayList<>();
+ this.property_groups = new ArrayList<>();
+ this.version = "";
+ }
+
+ public EdgeYamlParser(EdgeInfo edgeInfo) {
+ this.src_label = edgeInfo.getSrcLabel();
+ this.edge_label = edgeInfo.getEdgeLabel();
+ this.dst_label = edgeInfo.getDstLabel();
+ this.chunk_size = edgeInfo.getChunkSize();
+ this.src_chunk_size = edgeInfo.getSrcChunkSize();
+ this.dst_chunk_size = edgeInfo.getDstChunkSize();
+ this.directed = edgeInfo.isDirected();
+ this.prefix = edgeInfo.getPrefix();
+ this.adjacent_lists =
+ edgeInfo.getAdjacentLists().values().stream()
+ .map(AdjacentListYamlParser::new)
+ .collect(Collectors.toList());
+ this.property_groups =
+ edgeInfo.getPropertyGroups().stream()
+ .map(PropertyGroupYamlParser::new)
+ .collect(Collectors.toList());
+ this.version = edgeInfo.getVersion();
+ }
+
+ public String getSrc_label() {
+ return src_label;
+ }
+
+ public void setSrc_label(String src_label) {
+ this.src_label = src_label;
+ }
+
+ public String getEdge_label() {
+ return edge_label;
+ }
+
+ public void setEdge_label(String edge_label) {
+ this.edge_label = edge_label;
+ }
+
+ public String getDst_label() {
+ return dst_label;
+ }
+
+ public void setDst_label(String dst_label) {
+ this.dst_label = dst_label;
+ }
+
+ public boolean isDirected() {
+ return directed;
+ }
+
+ public void setDirected(boolean directed) {
+ this.directed = directed;
+ }
+
+ public long getChunk_size() {
+ return chunk_size;
+ }
+
+ public void setChunk_size(long chunk_size) {
+ this.chunk_size = chunk_size;
+ }
+
+ public long getSrc_chunk_size() {
+ return src_chunk_size;
+ }
+
+ public void setSrc_chunk_size(long src_chunk_size) {
+ this.src_chunk_size = src_chunk_size;
+ }
+
+ public long getDst_chunk_size() {
+ return dst_chunk_size;
+ }
+
+ public void setDst_chunk_size(long dst_chunk_size) {
+ this.dst_chunk_size = dst_chunk_size;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public List<AdjacentListYamlParser> getAdjacent_lists() {
+ return adjacent_lists;
+ }
+
+ public void setAdjacent_lists(List<AdjacentListYamlParser> adjacent_lists)
{
+ this.adjacent_lists = adjacent_lists;
+ }
+
+ public List<PropertyGroupYamlParser> getProperty_groups() {
+ return property_groups;
+ }
+
+ public void setProperty_groups(List<PropertyGroupYamlParser>
property_groups) {
+ this.property_groups = property_groups;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYamlParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYamlParser.java
new file mode 100644
index 0000000..85fe697
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/GraphYamlParser.java
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.yaml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.graphar.info.GraphInfo;
+import org.yaml.snakeyaml.DumperOptions;
+
+public class GraphYamlParser {
+ private String name;
+ private String prefix;
+ private List<String> vertices;
+ private List<String> edges;
+ private String version;
+ private static final DumperOptions dumperOption;
+
+ static {
+ dumperOption = new DumperOptions();
+ dumperOption.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
+ dumperOption.setIndent(4);
+ dumperOption.setIndicatorIndent(2);
+ dumperOption.setPrettyFlow(true);
+ }
+
+ public GraphYamlParser() {
+ this.name = "";
+ this.prefix = "";
+ this.vertices = new ArrayList<>();
+ this.edges = new ArrayList<>();
+ this.version = "";
+ }
+
+ public GraphYamlParser(GraphInfo graphInfo) {
+ this.name = graphInfo.getName();
+ this.prefix = graphInfo.getPrefix();
+ this.vertices =
+ graphInfo.getVertexInfos().stream()
+ .map(vertexInfo -> vertexInfo.getLabel() +
".vertex.yaml")
+ .collect(Collectors.toList());
+ this.edges =
+ graphInfo.getEdgeInfos().stream()
+ .map(edgeInfo -> edgeInfo.getConcat() + ".edge.yaml")
+ .collect(Collectors.toList());
+ this.version = graphInfo.getVersion();
+ }
+
+ public static DumperOptions getDumperOptions() {
+ return dumperOption;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public List<String> getVertices() {
+ return vertices;
+ }
+
+ public void setVertices(List<String> vertices) {
+ this.vertices = vertices;
+ }
+
+ public List<String> getEdges() {
+ return edges;
+ }
+
+ public void setEdges(List<String> edges) {
+ this.edges = edges;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyGroupYamlParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyGroupYamlParser.java
new file mode 100644
index 0000000..43609df
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyGroupYamlParser.java
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.yaml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.graphar.info.PropertyGroup;
+
+public class PropertyGroupYamlParser {
+ private List<PropertyYamlParser> properties;
+ private String file_type;
+ private String prefix;
+
+ public PropertyGroupYamlParser() {
+ this.properties = new ArrayList<>();
+ this.file_type = "";
+ this.prefix = "";
+ }
+
+ public PropertyGroupYamlParser(PropertyGroup propertyGroup) {
+ this.properties =
+ propertyGroup.getPropertyList().stream()
+ .map(PropertyYamlParser::new)
+ .collect(Collectors.toList());
+ this.file_type = propertyGroup.getFileType().toString();
+ this.prefix = propertyGroup.getPrefix();
+ }
+
+ public List<PropertyYamlParser> getProperties() {
+ return properties;
+ }
+
+ public void setProperties(List<PropertyYamlParser> properties) {
+ this.properties = properties;
+ }
+
+ public String getFile_type() {
+ return file_type;
+ }
+
+ public void setFile_type(String file_type) {
+ this.file_type = file_type;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyYamlParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyYamlParser.java
new file mode 100644
index 0000000..c511ada
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/PropertyYamlParser.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.yaml;
+
+import java.util.Optional;
+import org.apache.graphar.info.Property;
+
+public class PropertyYamlParser {
+ private String name;
+ private String data_type;
+ private boolean is_primary;
+ private Optional<Boolean> is_nullable;
+
+ public PropertyYamlParser() {
+ this.name = "";
+ this.data_type = "";
+ this.is_primary = false;
+ this.is_nullable = Optional.empty();
+ }
+
+ public PropertyYamlParser(Property property) {
+ this.name = property.getName();
+ this.data_type = property.getDataType().toString();
+ this.is_primary = property.isPrimary();
+ this.is_nullable = Optional.of(property.isNullable());
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getData_type() {
+ return data_type;
+ }
+
+ public void setData_type(String data_type) {
+ this.data_type = data_type;
+ }
+
+ public boolean getIs_primary() {
+ return is_primary;
+ }
+
+ public void setIs_primary(boolean is_primary) {
+ this.is_primary = is_primary;
+ }
+
+ public boolean getIs_nullable() {
+ return is_nullable.orElseGet(() -> !is_primary);
+ }
+
+ public void setIs_nullable(boolean is_nullable) {
+ this.is_nullable = Optional.of(is_nullable);
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYamlParser.java
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYamlParser.java
new file mode 100644
index 0000000..01c0984
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/info/yaml/VertexYamlParser.java
@@ -0,0 +1,92 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.info.yaml;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.graphar.info.VertexInfo;
+
+public class VertexYamlParser {
+ private String label;
+ private long chunk_size;
+ private List<PropertyGroupYamlParser> property_groups;
+ private String prefix;
+ private String version;
+
+ public VertexYamlParser() {
+ this.label = "";
+ this.chunk_size = 0;
+ this.property_groups = new ArrayList<>();
+ this.prefix = "";
+ this.version = "";
+ }
+
+ public VertexYamlParser(VertexInfo vertexInfo) {
+ this.label = vertexInfo.getLabel();
+ this.chunk_size = vertexInfo.getChunkSize();
+ this.property_groups =
+ vertexInfo.getPropertyGroups().stream()
+ .map(PropertyGroupYamlParser::new)
+ .collect(Collectors.toList());
+ this.prefix = vertexInfo.getPrefix();
+ this.version = vertexInfo.getVersion();
+ }
+
+ public String getLabel() {
+ return label;
+ }
+
+ public void setLabel(String label) {
+ this.label = label;
+ }
+
+ public long getChunk_size() {
+ return chunk_size;
+ }
+
+ public void setChunk_size(long chunk_size) {
+ this.chunk_size = chunk_size;
+ }
+
+ public List<PropertyGroupYamlParser> getProperty_groups() {
+ return property_groups;
+ }
+
+ public void setProperty_groups(List<PropertyGroupYamlParser>
property_groups) {
+ this.property_groups = property_groups;
+ }
+
+ public String getPrefix() {
+ return prefix;
+ }
+
+ public void setPrefix(String prefix) {
+ this.prefix = prefix;
+ }
+
+ public String getVersion() {
+ return version;
+ }
+
+ public void setVersion(String version) {
+ this.version = version;
+ }
+}
diff --git
a/maven-projects/info/src/main/java/org/apache/graphar/util/GeneralParams.java
b/maven-projects/info/src/main/java/org/apache/graphar/util/GeneralParams.java
new file mode 100644
index 0000000..a384e0d
--- /dev/null
+++
b/maven-projects/info/src/main/java/org/apache/graphar/util/GeneralParams.java
@@ -0,0 +1,38 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.graphar.util;
+
+public class GeneralParams {
+ // column name
+ public static final String vertexIndexCol = "_graphArVertexIndex";
+ public static final String srcIndexCol = "_graphArSrcIndex";
+ public static final String dstIndexCol = "_graphArDstIndex";
+ public static final String offsetCol = "_graphArOffset";
+ public static final String primaryCol = "_graphArPrimary";
+ public static final String vertexChunkIndexCol =
"_graphArVertexChunkIndex";
+ public static final String edgeIndexCol = "_graphArEdgeIndex";
+ public static final String regularSeparator = "_";
+ public static final String offsetStartChunkIndexKey =
"_graphar_offset_start_chunk_index";
+ public static final String aggNumListOfEdgeChunkKey =
"_graphar_agg_num_list_of_edge_chunk";
+ public static final Long defaultVertexChunkSize = 262144L; // 2^18
+ public static final Long defaultEdgeChunkSize = 4194304L; // 2^22
+ public static final String defaultFileType = "parquet";
+ public static final String defaultVersion = "v1";
+}
diff --git a/maven-projects/pom.xml b/maven-projects/pom.xml
index 03f3a28..c776396 100644
--- a/maven-projects/pom.xml
+++ b/maven-projects/pom.xml
@@ -32,6 +32,7 @@
<modules>
<module>java</module>
<module>spark</module>
+ <module>info</module>
</modules>
<properties>
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]