aliyun-java-sdk-graphcompute

The Aliyun GraphCompute SDK for Java used for accessing Aliyun GraphCompute Service

License

License

Categories

Categories

Java Languages
GroupId

GroupId

com.aliyun
ArtifactId

ArtifactId

aliyun-java-sdk-graphcompute
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

aliyun-java-sdk-graphcompute
The Aliyun GraphCompute SDK for Java used for accessing Aliyun GraphCompute Service
Project URL

Project URL

http://www.aliyun.com/product/graphcompute
Source Code Management

Source Code Management

https://github.com/aliyun/alibabacloud-graphcompute-java-sdk

Download aliyun-java-sdk-graphcompute

How to add to project

<!-- https://jarcasting.com/artifacts/com.aliyun/aliyun-java-sdk-graphcompute/ -->
<dependency>
    <groupId>com.aliyun</groupId>
    <artifactId>aliyun-java-sdk-graphcompute</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.aliyun/aliyun-java-sdk-graphcompute/
implementation 'com.aliyun:aliyun-java-sdk-graphcompute:1.0.1'
// https://jarcasting.com/artifacts/com.aliyun/aliyun-java-sdk-graphcompute/
implementation ("com.aliyun:aliyun-java-sdk-graphcompute:1.0.1")
'com.aliyun:aliyun-java-sdk-graphcompute:jar:1.0.1'
<dependency org="com.aliyun" name="aliyun-java-sdk-graphcompute" rev="1.0.1">
  <artifact name="aliyun-java-sdk-graphcompute" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.aliyun', module='aliyun-java-sdk-graphcompute', version='1.0.1')
)
libraryDependencies += "com.aliyun" % "aliyun-java-sdk-graphcompute" % "1.0.1"
[com.aliyun/aliyun-java-sdk-graphcompute "1.0.1"]

Dependencies

compile (4)

Group / Artifact Type Version
org.apache.tinkerpop : gremlin-core jar 3.4.2
org.apache.tinkerpop : gremlin-driver jar 3.4.2
com.google.guava : guava jar 23.0
com.alibaba : fastjson jar 1.2.60

Project Modules

There are no modules declared in this project.

GraphCompute SDK for Java

The GraphCompute SDK for Java allows to access GraphCompute Service on Alibaba Cloud. You can access Graph Compute service without the need to generate accesskey-related signature manually. This README document introduces how to obtain and call GraphCompute SDK for Java. If you have any problem while using GraphCompute SDK for Java, please submit an issue.

Requirements

  • To use GraphCompute SDK for Java, you must have an Alibaba Cloud account as well as an AccessKey ID and an AccessKey Secret. Create and view your AccessKey on the RAM console or contact your system administrator.
  • To use GraphCompute SDK for Java to access the APIs of a product, you must first activate the product on the Alibaba Cloud console if required.
  • The GraphCompute SDK for Java requires JDK 1.8 or later.

Installation

If you use Apache Maven to manage Java projects, you need to add following corresponding dependency to the pom.xml files of the projects.

<dependency>
  <groupId>com.aliyun</groupId>
  <artifactId>aliyun-java-sdk-graphcompute</artifactId>
  <version>1.0.1</version>
</dependency>

Examples

The following code example shows several steps to create a Graph Client using GraphCompute SDK for Java :

  1. Prepare your accessKey and accessSecret
  2. Prepare your instance domain and port
  3. Prepare MessageSerializer for serialization
  4. Create Gremlin Cluster and Client
import com.alibaba.maxgraph.credentials.CredentialsManager;
import com.alibaba.maxgraph.io.MaxGraphIORegistry;
import org.apache.tinkerpop.gremlin.driver.*;
import org.apache.tinkerpop.gremlin.driver.MessageSerializer;
import org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0;
import org.apache.tinkerpop.gremlin.structure.io.gryo.GryoMapper;

public class GraphComputeJavaSDKExample {
    public static void main(String[] args) {
        Cluster cluster;
        Client client;
        CredentialsManager credentialsManager;
      
      	String accessKey = "This is your accessKey";
        String accessSecret = "This is your accessSecret";

        String instanceDomain = "This is your instance domain";
        int instanceDomainPort = 80; //This is your port of instance domain
        
        credentialsManager = new CredentialsManager(accessKey, accessSecret);

        GryoMapper.Builder kryo = 
          GryoMapper.build().addRegistry(MaxGraphIORegistry.getInstance());
        MessageSerializer serializer = 
          new GryoMessageSerializerV1d0(kryo);
        try {
            cluster = Cluster.build()
                    .addContactPoint(instanceDomain)
                    .port(instanceDomainPort)
                    .serializer(serializer)
                    .credentials(credentialsManager.getUserName(), 
                                 credentialsManager.getPassword())
                    .create();
        } catch (Exception e) {
            throw new IllegalArgumentException("build credentials fail", e);
        }
        client = cluster.connect();
      	String query="your Gremlin Query";
        ResultSet resultSet = client.submit("g.V()");
      	...
        //don't forget close the connection
        client.close();
        cluster.close();
    }
}

You can find more interesting examples in com.alibaba.maxgraph.examples package. :)

License

Apache-2.0

com.aliyun

Alibaba Cloud

More Than Just Cloud

Versions

Version
1.0.1
1.0.0