Logo

EasyGraph developer Manual

Contents

Introduction

EasyGraph provides 'Knowledge Graph as a Service' capabilities, reducing the complexity and effort of incorporating a knowledge graph into an existing or new tech stack and thus allowing businesses to focus on adding business value rather than spending time building foundational components.

Once configured through EasyGraph Bootstrap, a simple seven step process, EasyGraph publishes a dynamic API providing GraphQL and HTTP endpoints to interact with the graph. EasyGraph Playground allows you to easily try out your configured API in a zero development environment.

Quick start

The quickest way to get started with EasyGraph is to try it online. You can either sign up or sign in with LinkedIn account.

Go to https://easygraph.graphifi.com

Image

To sign up click on the SIGN UP button and fill the sign up form. Once you have signed up you can can login using your username and password.

If you want to use your LinkedIn account, you must accept the Terms and Conditions. This will enable the button. Click on it to complete the login process.

Once logged in you will see options as below.

Image

We would love to hear your feedback. While trying the application if you find any bug, have any suggestion or feature request you can easily provide your feedback as explained in the steps below.

  • Click on your name or image in the rop right corner of the application. You will see a popup with feedback form as shown in the shot below. Image
  • Enter your feedback in the Feedback field.
  • Click on the Image button to attach image of bug, feature or suggestion. Please note that attachment is optional.
  • Click SEND

Select Create Sandbox option and enter username and password for the root user of your sandbox. Click the Create button to create sandbox. Once your sandbox is ready your screen will look as below.

Image

To login to your sandbox click the sandbox link. You should see sandbox login page as below.

Image

Enter your sandbox root account username, password and click Login button. Once logged in you should see dialog box to create a dataset as below.

Image

Enter name and description and click Add button. You should see applications screen as shown below. Your sandbox setup is now complete. In the next section we will go through the example model and than we will bootstrap with example model.

Image

Example model

In all of our examples below we are going to use an ontology. In our ontology we will model entities for organisations, employees and images and the relationships between them.

Image

You can download the ontology for the above model from https://easygraph.graphifi.com/docs/example-ontology.ttl.

To continue with quickstart follow the Quick Start steps in the Bootstrap section.

Bootstrap

Click on the Bootstrap application in the dashboard.

There are only seven steps to the bootstrap process. It should only take a few minutes to go through a basic set up and if you are eager to do it as quickly as possible simply follow the instructions in the 'Quick start' boxes..

Basics

Use an example base IRI such as http://example.com/ for both fields. Enter 'YES' for 'Enable Data Reset'. For the language option you can leave it at its default for now.

Click the 'Next' button to move to the next step.

The first step of the bootstrap is to enter some basic information that EasyGraph needs.

Image

The base IRIs must be of the form http:// or https:// to be valid. The base IRI for data will be used for all resources created using the generated APIs. The base IRI for schema will be used for any shapes and configuration generated by EasyGraph.

The default language currently only applies to searches made through the APIs.

Data reset allows you to wipe the data with a call to the /reset/data API endpoint. This is useful if you are building an application and want to do integration tests with EasyGraph where, for each test run, you want to reset the data.

Load model

You can download an example ontology file from https://easygraph.graphifi.com/docs/example-ontology.ttl (or if you want to go even faster you can select 'Example Ontology of Organisation Person and Image' to load an example ontology).

Browse for the ontology file from your file system if you are loading the example ontology. Once the file is selected your screen will look as shown below.

Image

If you have selected 'Example Ontology of Organisation Person and Image' your screen will look as below.

Image

Click the 'Next' button to move to the next step.

EasyGraph uses an ontology as its input to define the APIs that it generates. The ontology must be an OWL ontology as defined by the W3C OWL standard. Only a subset of OWL is supported. This subset consists of:

  • Classes
  • Object properties
  • Datatype properties
  • Functional properties
  • Cardinality constraints
  • All values from with owl:unionOf
  • RDFS domain
  • RDFS range
  • RDFS subClassOf

You can select ontologies using the Browse Files button or you can drag and drop files into the window. Files should be .ttl, .xml, .owl, .rdf, .rdfs, .nt or .jsonld and there is a limit of five files.

EasyGraph will do some checks to ensure the validity of the files you are uploading but we recommend that you put them through an ontology checker first.

If you want to set up API for SKOS/SKOS-XL based taxonomy you can choose predefined ontologies. If you developed your taxonomy using Graphologi then you can select Graphologi Model to setup your taxonomy API.

To bootstrap with a schema built using Schema Builder see Bootstrap With Schema

Prefixes

If you have used the example file or test ontology you do not need to do anything.

Click the 'Next' button to move to the next step.

Aliases are short names for properties and a feature of JSON-LD. EasyGraph attempts to automatically generate aliases based on the IRIs of classes and properties in the ontologies.

However, there is always the possibility of conflicts. In that situation EasyGraph will prepend prefixes for property names. Each conflicting Base IRI (namespace) can be given a prefix.

Image

EasyGraph will use prefixes defined in any loaded ontologies as a starting point. If prefixes are not defined in an ontology file then you will need to define them in this step. Every prefix must be unique. There are some reserved prefixes which cannot be altered and these are shown with a Image icon in the prefix field. For example, in the screenshot below you can see that prefix 'ex' can be edited but 'eg', which is a system defined prefix, can not be changed.

Image

Aliases

If you have used the example ontology file or a test ontology you do not need to do anything as EasyGraph will have generated valid aliases.

Click the 'Next' button to move to the next step.

As explained in the previous section, aliases are part of the JSON-LD specification and allow IRIs to be substituted with more friendly short names, which makes for more readable JSON.

If you have used the example file the screen will look as below if you select 'From Ontology'.

Image

Easygraph creates a JSON-LD context file and GraphQL schema automatically based on the ontology and prefixes as explained in the previous step.

Below are the steps which EasyGraph follows to resolve conflict in aliases

  • Generate aliases using local names from IRIs.
  • If there is a conflict use a prefix in the alias name for conflicting aliases only.
  • If there are still conflicts use a prefix for all aliases.

Preview shapes

You do not need to do anything at this step.

Click the 'Next' button to move to the next step.

EasyGraph generates a ‘shape’ for each entity in the ontology. These shapes use the W3 SHACL standard.

The screen should look similar to the image below if you click on Organisation.

Image

You can click on a shape name in list on the left to view the generated SHACL shape. By default a 'pretty' view of the shape is displayed but you have the option to click on 'View JSON-LD' to view the shape as JSON-LD.

Also, by default, only the properties associated 'directly' with the class are displayed. Directly means properties whose domain is defined in the ontology as the selected class. If you want to also view properties that are inherited from classes that are above in the hierarchy tree select 'Include Properties From Class Hierarchy'.

ID setup

You do not need to do anything at this step.

Click the 'Next' button to move to the next step.

The screen should look similar to the image below.

Image

ID setup controls which CRUD (create, read, update and delete) operations can be performed. By default all the lowest classes in the hierarchy are selected (those that have no subclass). You do not need to change anything on this screen.

To view superclasses or subclasses you can click on an item from the list on the left. Alternatively you can view the class hierarchy by clicking Tree view button. In this view, classes will show as a tree on the left hand side similarly to the screenshot below.

Image

Note that in the class hierarchy if a class is selected for ID generation then all of its subclasses will be deselected.

For a read only API click on the Image icon and select 'Clear All (Read Only API)' option from the menu.

Inverses

You do not need to do anything at this step.

Click the FINISH button. This will complete the bootstrap process and from there you can return to the dashboard. Congratulations, at this point you are ready to explore your HTTP API and your GraphQL API. To continue the Quick Start, follow the Quick Start steps for the EasyGraph Playground.

Inverses in an ontology allow you to model the idea that if an entity A is related to another entity B by a property X then there is a property Y that applies in the opposite direction from entity B to entity A. For example if A hasParent B then hasParent might have an inverse hasChild, giving B hasChild A.

The screen should look similar to the image below.

Image

By default all inverse properties are materialised. That is, if one direction is created the other is automatically generated. For example, in our model the member property is the inverse of the memberOf property, so if we create a resource of type Organisation and link it to a Person using the member property, the memberOf property will be generated for the Person resource, linking it back to the Organisation resource. In this screen you can disable this behaviour.

You’re all done. Click FINISH button and you should see a 'Bootstrap Successful' screen as follows

Image

Re bootstrap

You might want to add/update model after the bootstrap and regenerate the APIs to include changes from updated model. So after bootstrap if you try to bootstrap again you have three options.

First option is to "Reload complete model and merge manual changes" from the existing configuration. This option is useful if you have made many changes in the different ontology files and previously you made some configuration changes using System Manager. With this option you can reload new ontology and model will be updated based on the changes in the ontology. If you want to adjust Id generation you can do so from System Manager after the merge.

Second option is to "Load partial model , keep existing model and merge into existing configuration". This option is useful if you are extending the model. The difference between this option and previous option is that with this option shapes are not deleted.

Third option is to "Wipe existing configuration and bootstrap again". With this option all the existing configuration are cleared and bootstrap is done based on the model selected.

Datasets

If you use Apache Jena Fuseki or RDF4J as backend, EasyGraph can be configured to support multiple datasets. When multiple datasets configuration is on, data for each dataset is stored in a separate database. To access data from a dataset add dataset name in the API endpoint. For example if you have created dataset named TestDataset then the graph search endpoint for TestDataset will be {base-url}/TestDataset/graph/search. If you are using EasyGraph UI you can select dataset as shown below.

Image

If a dataset is selected then applications like Bootstrap, System Manager and Playground work with the selected dataset. Selected dataset is also shown in the middle of the top bar.

Downloadable version of EasyGraph has multiple datasets enabled by default, this can be disabled by setting EG_MULTIPLE_DATASETS=false in conf/setenv.sh

Please note that multiple datasets are only supported for Apache Jena Fuseki and RDF4J. Multiple datasets help in cost reduction during development but for production we recommend to disable multiple dataset as performance will be better.

A user with Super Admin permission can manage datasets by clicking Image menu option on left. If a logged in user does not see this option then it means user does not have Super Admin permission.

Image

To add a dataset click ADD NEW DATASET button and enter details in the dialog.

To edit description of the dataset click edit icon button on the dataset card. Please note that dataset name can not be changed.

All the user details, passwords and some other data is stored in a separate database.

If multiple dataset configuration property is set to false then UI app works with default dataset and all the API requests execute against default dataset. For example if multiple dataset property is false and backend is RDF4J or Fuseki, a repository named egData is auto created to store all the data. For other databases like MarkLogic, database connection details are set through configurations. Please see setup section for more details.

Users

EasyGraph users can be managed from the user management. By default only authenticated user can access EasyGraph UI or API.

To access user management screen click Image menu option on the left of the home screen and your screen should look as below.

Image

To add a user click the add user icon button and enter the details in the dialog. To view user details click user name.

Any user can be given Super Admin permission on the user details screen. A user with Super Admin permissions can do everything a root user can do e.g. manage datasets, manage users and configure API.

Please note that If multiple datasets configuration is set to true only then dataset access for user can be configured from the Datasets block on user details screen. If multiple datasets is false then all users can access default dataset and Datasets block is not show on the user details screen.

User Authentication

EasyGraph supports JWT(JSON Web Token) based authentication and public/private key pair based authentication.

JWT based authentication

If authentication is enabled under authentication menu option in System Manager then a user can generate JWT access token by sending a POST request to {base-url}/egmManagement/login. Once user has token other API requests can be executed by specifying Authorization HTTP header e.g. Authorization: Bearer {JWT_TOKEN}

Public/Private key pair based authentication

For system to system integration JWT token based authentication may not be the best approach as JWT tokens expire after certain time. For system to system integration use case, EasyGraph supports public/private key based authentication. A public key of the user can be stored in EasyGraph and then user can sign the API request with private key.

Public/private key pair can also be generated through the EasyGraph UI on user management screen. To generate the key pair click Image button.

Image

In the dialog enter description and click GENERATE button. This should generate a key pair and you can download the private key.

If you have generated RSA key pair using some other tool you can upload the public key by clicking Image.

Signing request

Signing of the request is based on https://docs.aws.amazon.com/general/latest/gr/sigv4-signed-request-examples.html. Below is the summary of the steps to sign a request.

  • Generate a unix epoch timestamp.
  • If the request has body compute SHA256 of the request body.
  • If the request has query parameters string join key and value with "=", sort all the key/value pair and join with "&".
  • If you want to use headers in the signature, join header name and value with ":" and then concatenate all the headers with "\n".
  • Concatenate the parts of request as below and compute the signature using private key.
  • timestamp+ "\n" +keyId+"\n"+requestPath+"\n"+queryString+"\n"+headerString+"\n"+requestBodySHA256
                            
  • Specify the signature and other details in the Authorization header.
  • Authorization : Algorithm="SHA256withRSA";KeyId="https://easygraph.graphifi.com/data/publickey/17ceb312-8cfd-45ac-987d-bd5cc2f5812f";Timestamp="1621894484263;SignedHeaders="Content-Type,Prefer";Signature="KppfgLsod5QDkWjojm6eNpm6Q264ijBk8l/W7x+M3JiZGspPVpAlMXL+ZXikKIws3dh7ml56W41OvulEE6M10vo1f0kSTLGeFB9MTj9Q9WliSV9H0a8Y9Z0zWRGvVpIpl9Bb6UvDe0WK/GwQYtoQGOWkTvwPk+/S0jb+8AhHscLE/0OJOWGpYU0FPiIElJUi+yTH96kwwd4MOwQe28Tu1LXGIV2dJYMH+gd3x4ni2o0MUOu/QE5ERQH8RK/hyCvunURlZKuoybdO5cs2wLnD96zJ3Wgpi0UkGGULBNscN4xkd+AV+BS/wdIuod2WJ6raa9axtjSTviBfawlqNTY2jzPSdBUgrmSEZA21t6TdZsyWhxeBklz7kLOXnF3rgiwvW81NaI5JuCN/8oqLiR1JcciFOjp4Qgew/kikR3hEjrHFnfNMoPGM3//u6TqIz9pp0k1xYNPwtIIxcITCh9w/PnwSu0oeJz+d0KVIPx5qcYu8GVfuNE6QlIGPOQDTjpRTDm+gSRyTJ4uw+k1HW5mitcK+IUmd/X/Jchxn7KvHp5bJ8H7kB4TGFGZvfUH2dBKbsyQyY4rEE6KJ+h/pSOA1Z9EtdNf2xZBj4nio/FEoAgxkCEuHGlDNhpoxkCMVAEDKqd9WJzJ+yrUbrMHsRapl60yMU8t+2zE7CIUonHarLU4="
    
                            

Code below is example of how you can implement it in Java. Please note you might want to adjust package statement in the code.

Private key in below code is for example only. Please do not use it anywhere in production code.

package com.graphifi;

import org.apache.commons.codec.digest.DigestUtils;

import java.io.IOException;
import java.io.InputStream;
import java.security.KeyFactory;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.spec.PKCS8EncodedKeySpec;
import java.util.Arrays;
import java.util.Base64;
import java.util.stream.Collectors;

import static java.nio.charset.StandardCharsets.UTF_8;

public class RequestSigner {
    private static final String SHA_256_WITH_RSA = "SHA256withRSA";
    private static final String RSA = "RSA";
    private static final String PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----\nMIIJQwIBADANBgkqhkiG9w0BAQEFAASCCS0wggkpAgEAAoICAQDKKx50Gl0RiTi2RpyXSAM8FwJGugf1jFLLS8yp3x5F0HOCc28ahu/+y5NrQjAH/vqI8MzOy6L+U60Dv6pSjVwv3nTFvBIOj53e3bFLr5hCxd7WPv1aNSJT/jZbBUcF4FbOV+dakNmr7RNWBdGai/jZ8dYSJ+YGvtgnJK+CZrP0HDaxz6x045Dzimokbi61xQsg0X1zhSmABhHhcA52WTNTvgOwIJKjdDHpYTZYZJRy+zymn5le34cG7sdDYMGwZm6ZCpXSk2BAAa84VZnhAqodZY2+bgPOkLSMFAWbodsr7/6n5PSVwpGyrmR1tAF9PwxijAhnMmImkwzV0zc7RYUrTJk8zbO/ZBWUbjJdVTQcGlieaCF2xdn/2TMvgRGDOh1uFm/OmOZVyI2oiwSXNu8z7Nw4Rmlda14/ARdd09svE24LexVnTSeTD8YiJsnvIo996pIFENXKtCmbcxwyZY4hx2XkCp96m9RruZ5ZVKO/tYnnX2DeYxN9xQl7eNr98fgluqSCG/MG2X5zE1mCPfz3jPBjQaTzBJjfP3bLZ/9rGaCNJK8267wpdu2FV3TK4ZRqr/BEfL67m1IHr6gyEjubGjNIUhnICIK95LAeBXVNXdPRkkbBE+aavu+xqZQ3LGh9d1OlqQolg/Sl+l7vP4SrNOnve0vmIT3tstSz8JUUWwIDAQABAoICACPZM4Q47InggDrqGHhG37P3DINIF4M2B7Re04LHupF8ng7isy/L/6B5rsFVMjkowHop4NdGird4VPSWNvh+cntWgfRSHg2Q79iGDRszntcwSQxKjRhC1bx5FmBbdjWXiyz5r1+C0eZHmqclTv6NlWnoFSKRCpvlmWSPf8OqvHwryJMNFTKA68ITqDCfjQ7USt3d59XlJe+6o88K1LWtqYlO506C6B2ty+/rOfzAkQY2gJG3OTX2gvX6v0C2VoIWF8RxeRGm6mlPIyflHe0lUM73pAPBdFFbnXg9UKVBNSD8ZHaXBbvMjZNWkx+/9Iel92c+F3tdFsRqTNtZobCT6kHrcb5CHX/I75S86kkHH5UPlMRxS6eu8ovS8Wb5zKl0F8vV+S+rfKm1UrXlklq54OH5i+r9aXLWAJgYThOi8VFRVRSzdP5ESEWD4KN67vmSpr8KqOhbKKMrSlc8OfWAIWBvFJJ/Szk9DNioauzISJK0PLxuxjiaad1c/HyFG1KcgUMXzkj8qnYFD6eRMRKCkba/ImXPnTNMU1MksmbneZHkSxIYRh5B11eVogYM+zN3M3xg+qU1fOPpqsjq9vQstBUlom6MLvE6TLfjv6xrPDypgh8otyis+rfpULaLL08ajsAuLC2W4rlCCUaCMG/0yQdquyRbtWj2tKEqZ+ccZqV5AoIBAQDyg4oSnyhbOz/s42j5ve7ztSIKlnQ8AGm3Yp1LiecAwAynWDrhkm+OYTJtbCgIcmJBumSppTMhBn4yMImVEEB6NHscMULYu0T9PgfhcGr/klfCmSPtisahakXoQkLOVQoZCnTWyKksrSb/qpxQHMSPy1qn2WMFOkBiXQkI0w+7krSjlwq7UZhNSrFhnmO3pKruw93UVGYNSzhZFPGdv13NBsJPg+7w5nZySWv6WVaCKVAPP6en4xh0LtccLDx6PgyWOsIWQzUVnRW4Ab0JlTiE/Vt9DhQNwq1y3r8gEzMhKMuwykN1NoJ8ODFv+y9F60owOJTP2bCFY41ixMNJFIFVAoIBAQDVaTeMGQUgWY4k8KCSWDwa5qFDQpnMhuTw/kiEciX6M65dVg8yQ8UNP0T2ZnGZg3P4Je8p2lfQiNTx7JR4fOY2keC4jmlKIyxBJE2QZIqku690WR/JgKvqF65lLWNaAcPZsDCIXvI1Gtm5rMc8DgUFSSn4p6LUKBCU4ZeQyqyA5sLnklQLPGnSaoHQNIGNrPjd21hglOMFpw7EP0YcGY8eoHsJJywMPx8BWGRfZImIqGuTCAUXmpk/4f4oNJUA9BDB+EzP+RWkXVY3Tw4oEsAmmuyJcJle+Zbl+Dvfy45NKby5xh9/ObHF4STI+biAkljlFzyacd05vpQO67Z9pv7vAoIBAQDqn+J8Y6kaorcVC2rrfBtrgwm9LpSj3E5rEqhVhcSNEEDtwkmtJQxytoygGqych3WSW6+6BU7zG6IKErV5FvEaih21R9+BaaS0UUg0jpumSUJIzfpZfhLv5a5ep4SUtOeBFIG3rwklZRw+7CQwybRN3hMGIyZOz22s/I+aDwDAm43SW3YRhj6QQLxeUmvtJw4M1EiQfVsCb4zDeqTL1nH8wxZI8b7BKGbd6TTjT32Hjkqbhh1BK0/kT9Dju9SC+/cXfR97hGgeUgzKKjxmwgyddbUGxxEVwwwl/2TvtkOYSCzRDM643xTc80y5J040GhB7mLI4aUcDti36qZy53nHFAoIBAQDShqBIcWowNohWApa0p5xrgTZ2jp4AONZissbA+YZjY1ZQNxR4pogegFq8o+TO5vGhS3K6m+1jB4jiO1tf3P6RuKiyB7LwcvA2NuTZW4W16ny0TzNfabKuFLxyjSrkYLde6UOHU/qlzp4YX8yPftkPFNT1uhGULw3kgQMuz/EKnBqLrTuBdhCChZUX2qQvKgK7gaWWaWnnapzTlgPItqIMOY4GQoFed2pTvmoN/LT8fgDZI+E6HsWtUniSGwUe0qYxY4wK4hKqeXUSzMcPWyf5LX3IO67hFWD57j7KkBkKH/FQZpUtwbGQnoDWThrnovdUz+52AXuWel2+tmLpY7M7AoIBACcFEHpsbdSXffiJwANEtkEIT4KtGaFeprbVZ1f25zGGlVE2aX2kewZfZ+tx6WJ1ERM+JGllzlgtlbBMpXUdSY7TpvFPfomemfVbROWAgGB0U+CBF67xX1yK4CtDvzylsVYsw3l5fkQPhgBPGZhRAWW+1nEeg3jgX9SFhBz2m5AYp5ROHPhL0hsO1eRBpUZICH+qSlcm9Ks+sH5w0Wcws2r30acdc3ycZ7+AXIRRztcmUwqh1rOMylpI29EVUF7WpV+0biZI5yW2rGGzeTReBdJd4Owctoq21stffF2MFd4AtpkY0Dr7QIOA9SoQeTlhzAJFLAyaw6RiRRx++Wwhmus=\n-----END RSA PRIVATE KEY-----";

    public static void main(String []args) throws IOException {
        //Key value pair can be generated from the EasyGraph UI
        PrivateKey privateKey = loadRSAPrivateKey(PRIVATE_KEY);
        //Obtain Key id value from EasyGraph UI
        String keyId = "https://easygraph.graphifi.com/data/publickey/17ceb312-8cfd-45ac-987d-bd5cc2f5812f";

        //This is path of the request
        String path = "/graph";
        String queryParams = getQueryString("z=zvalue&a=avalue");
        String headers = "Content-Type:application/ld=json"+"\n"+"Prefer:return=representation;data=\"{description}\";dataFilter=paths";
        //As Content-Type and Prefer header are used to compute signature specify these headers in the SignedHeaders
        String signedHeaders = "Content-Type,Prefer";
        //If there is no body then set value to null
        String body = "Test body";
        if(body == null) {
            body = "";
        }
        String bodySHA256 = computeSHA256(body);
        long timeMillis = System.currentTimeMillis();

        String signature = sign(timeMillis, keyId, path, queryParams, headers, bodySHA256, privateKey);

        String authorizationHeaderValue = "Algorithm=\"SHA256withRSA\";KeyId=\""+keyId+"\";Timestamp=\""+timeMillis+";SignedHeaders=\""+signedHeaders+"\";Signature=\""+signature+"\"";
        System.out.println(authorizationHeaderValue);
        String fullAuthorizationHeader = "Authorization :"+authorizationHeaderValue;
        System.out.println(fullAuthorizationHeader);
    }

    public static String getQueryString(String queryString) {
        String collect = Arrays.stream(queryString.split("&")).sorted().collect(Collectors.joining("&"));
        return collect;
    }

    public static PrivateKey loadRSAPrivateKey(String privateKeyString) {
        String trimmed = privateKeyString.replace("-----BEGIN PRIVATE KEY-----\n", "")
                .replace("-----BEGIN RSA PRIVATE KEY-----\n", "")
                .replace("-----END PRIVATE KEY-----", "")
                .replace("-----END RSA PRIVATE KEY-----", "")
                .trim();
        byte[] decoded = Base64.getDecoder().decode(trimmed);
        PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(decoded);
        try {
            KeyFactory keyFactory = KeyFactory.getInstance(RSA);
            return keyFactory.generatePrivate(keySpec);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    public static String computeSHA256(InputStream inputStream) throws IOException {
        String sha256hex = DigestUtils.sha256Hex(inputStream);
        return sha256hex;
    }

    public static String computeSHA256(String inputData) throws IOException {
        String sha256hex = DigestUtils.sha256Hex(inputData);
        return sha256hex;
    }
    public static String sign(long timestamp, String keyId, String requestPath, String sortedQueryParams, String signedHeaders, String bodySHA256, PrivateKey privateKey) {
        String fullPayload = createFullPayload(timestamp, keyId, requestPath, sortedQueryParams, signedHeaders, bodySHA256);
        return sign(fullPayload, privateKey);
    }

    public static String createFullPayload(long timestamp, String keyId, String requestPath, String queryParams, String headerString, String body) {
        String headerStringToAppend = headerString != null && !headerString.isEmpty() ? headerString : "\n" + nullToEmpty(headerString);
        String fullPayload = timestamp+"\n"+keyId+"\n"+nullToEmpty(requestPath)+"\n"+nullToEmpty(queryParams)+headerStringToAppend+"\n"+nullToEmpty(body);
        return fullPayload;
    }

    private static String nullToEmpty(String value) {
        return value == null ? "" : value;
    }

    public static String sign(String payload, PrivateKey privateKey) {
        try {
            Signature signatureInstance = Signature.getInstance(SHA_256_WITH_RSA);
            signatureInstance.initSign(privateKey);
            signatureInstance.update(payload.getBytes(UTF_8));

            byte[] signature = signatureInstance.sign();

            return Base64.getEncoder().encodeToString(signature);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

}

                    
Signing multipart request

To sign a multipart request compute SHA256 of the content of each file. For example to compute signature of multipart request below

curl --location --request POST 'http://localhost:8080/administration/ontology/bootstrap' \
--header 'Content-Type: application/n-triples' \
--header 'Accept: text/nquads' \
--form 'files=@"org-emp-img.ttl"' \
--form 'baseIRIForData="http://example.com/"' \
--form 'baseIRIForSchema="http://example.com/"' \
--form 'defaultLanguageCode="en"' \
--form 'idSetup="readOnly"' \
--form 'files=@"prefix-only.ttl"'

Compute signature by concatenating as shown below

timestamp+"\n"+keyId+"\n"+queryString+"\n"+headerString+"\n"+requestBodySHA256+”\n”+{hash of org-emp-img.ttl} +”\n”+baseIRIForData=http://example.com/+”\n”+baseIRIForSchema=http://example.com/+”\n”+defaultLanguageCode=en+”\n”+idSetup=readOnly+”\n”+{hash of prefix-only.ttl}

Note values in the curl example form fields have double quotes but in the signature payload there are no double quotes. In curl double quotes are required for shell and actual value which is sent to backend is without double quotes. So to compute signature use what is sent to the backend.

Integration with Graphologi

If you are managing taxonomies in Graphologi and want to setup API for the delivery of the taxonomies, you can do so by following the steps explained in Graphologi documentation section Integration with EasyGraph

Note key based authentication can be used for any other system integration.

Data import integration endpoint

To publish data from Graphologi to EasyGraph, integration endpoint format is as below. InstanceID and Dataset fields are required if those are enabled in EasyGraph setup. If you are using sandbox then InstanceID and Dataset information is shown in the top bar.

{BaseURL}/{InstanceID}/{Dataset}/administration/data/import?profile=graphologi&egSignatureKeyUUID=12345

Example

https://easygraph.graphifi.com/trial1/tZGv9Li7en/Graphologi-Integration-Demo/administration/data/import?profile=graphologi&egSignatureKeyUUID=a46978f0-f97f-43c4-8af6-85b0f1c73b33

Ontology bootstrap endpoint

If you are developing model ontology in Graphologi, you can push the model changes to EasyGraph after initial bootstrap. The example integration endpoint for same is below:

Example

https://easygraph.graphifi.com/trial1/tZGv9Li7en/Graphologi-Integration-Demo/administration/ontology/bootstrap?profile=graphologi&egSignatureKeyUUID=a46978f0-f97f-43c4-8af6-85b0f1c73b33&existingConfiguration=merge-classes-in-payload-leave-other

Playground

The EasyGraph Playground helps you to explore your HTTP and GraphQL APIs. It comes with many easy to use builders which can be used to build API requests using a form like interface.

API developers can use the playground to build example requests for the API which can then be shared with developers who are consumers of the API.

In our experience we have seen that consumers of an API can struggle to find out how to use it. The Playground is meant to help with exactly that problem - it is not just a testing tool.

To get started click 'Playground' in the dashboard as shown below.

Image

If you have used an example ontology in the Bootstrap application you can automatically generate a workspace within the playground.

Click the Image button on left.

Image

In the popup dialog leave the defaults and click Create .

Image

Your screen should look as below.

Image

Click on the workspace card to open it. Your screen should look as below

Image

Within a workspace groups of requests are organised into 'scenarios'. A scenario will generally be a task that a developer needs to accomplish. A scenario will generally consist of multiple requests.

Select the 'Create features' scenario under the Scenarios tab. You should see a screenshot similar to that shown below.

Image

Click Image button at the top to execute the scenario. This will run all the requests within the scenario in order, one after the other.

Image

Next let us try using GraphQL. From the list of requests expand the one with the title 'ID provided in payload'. Your screen should look as below.

Image

In the expanded request click the Image icon on the right-hand side of the screen. This should open the request settings dialog as shown below.

Image

Change the mode to GraphQL and click Save. You should see the endpoint URL change to https://easygraph.graphifi.com/graphql. If you click on the Request tab you will be able to see the GraphQL request details as in the screenshot below.

Image

Click the scenario Image button again. When all of the requests have completed you will see the GraphQL response under the Response tab as in the screenshot below.

Image

Note that the 'Autogenerate Workspace' button is only available if you have used an example ontology.

Playground stores all the data in browser storage and different browsers has different storage limits.

Create workspace

To create your own workspace click Image button on the left and enter name and description of your workspace.

Add scenarios and requests

In a new workspace click the ADD SCENARIO button to add first scenario. button to add your first scenario. In the dialog enter a name and a description and then click the ADD button. This will create a new scenario which will show under the Scenarios tab. To add more scenarios click the Image button.

Image

To add a first request to a scenario, select the required scenario, then click the Image button in the center of the Scenario Details screen. From the menu select the type of request you want to create.

Image

Reset request

With a reset request you can clear all the data stored in the backend. This is useful when you want to try the API with a limited amount of data.

Create request

A create request is used to create new resources. Once you add a create request you can build the payload of the request using the Build tab. Click the Build tab and then ADD TYPE BLOCK. In the newly added block select the type of resource you want to create. Based on the type a form is displayed as in the example below. By default all the mandatory fields are added to the form. You can add other fields by clicking ADD in the property block.

To generate mock data you can click MOCK ALL. This will generate random values for all the fields in the form. To configure the strategy for mock value generation please refer to the section on Mock setup.

You can also use the Request tab to manually enter the body of the request. Note that if you have used the builder the request body is generated from it.

Image

Note that in type selection some of the types might be disabled as shown in the screenshot below. This is due to the ID Setup as configured in the Bootstrap application.

Image

Search request

A search request is used to search resources in a graph. You can build a search request using the tools in the Build tab.

Image
Filters

Under this tab you can build the query parameters used in a search. Click on ADD FILTER to add a block. In the Property field select the name of the property from the list or type a few characters to find a property. Once a property is selected then, depending on the type of property, a list of operators may be shown. Depending on which operator you select a Value field, Language Field and Object Field might be shown.

With the Text Search block you can specify the criteria for text search. You can select multiple properties to perform text search across. If you want to perform text search against all properties then leave this option empty. You can also specify the language for text search using the Language field. To add another value for text search click the ADD button. If you want to search multiple text values you can click ADD to add more value fields.

Search allows you to filter resources by specifying constraints on connected resources. Connected resources are resources connected via an object property. Using the builder you can easily build a query using the Matches operator. For example, let us say we want to build a query to find all organisations where its members have an image with width 100. Below are the steps to build such a query.

  • Click on ADD FILTER to add a block and select type in the Property field, eq in the Operator field and Organisation in the Value field. Your filters tab should look as below Image
  • Click on ADD FILTER again to add a block and select member in the Property field and Matches in the Operator field. When you select the Matches operator you should see that a nested block is displayed. In the Property list of the nested block you will see a list of all the properties that are related to the ImageObject class. Select width in the Property field, eq in the Operator field and type 100 in the Value field. Your filters screen should look as below. Image
  • This is all you need to do to build the query mentioned above. To view the query click on the Request tab where you will see the query parameter value. It should look as shown in the shot below. Image
Data

Using this tab you can build a Prefer header to specify the data that you want in the response. For example, let us say we want search to return both member and image data. You can build the request as below.

  • Click on the Data tab. You should be presented with a screen similar to that shown below. Image
  • Click on ADD CONNECTION to add a block and select member in the Connection Property field. This should load a nested block. Click on ADD CONNECTION in the nested block and in the nested Connection Property field select image. Your screen should look as below. Image
  • This is all you need to do to build the header. To view the header click on the Request tab where you will see the Prefer header value. It should look as shown in the shot below. Image

If you want a search response to return only specific properties you can select the 'Selected Properties' option in the Data Filter block. For example, you may want a search result to return description and name for organisations, any givenName property for member objects connected to any organisation as well as height and width properties from any ImageObject connected to a member. You can build the request as below.

  • Click on the "Selected Properties" option in the Data Filter block.
  • In the Search Results block and within the Properties field type "des" and from the presented options select description. Then type "na" and select the name option. Your screen should look as below. Image
  • Click on the ADD CONNECTION button in the Connected block. In the Connection Property field select member. This should display a nested block with a Properties field. Select givenName and click on the ADD CONNECTION button in the nested block. This should add another nested block. In the newly added block select image in the Connected Property field and select both the height and width properties. Your screen should look as below. Image
  • To view the header click on the Request tab where you will see a Prefer header value. It should look as shown in the shot below. Image
Facet

Using this tab you can build facet parameters for a search. For example, let us say that with our previous search request we also want to facet on the organisation, description and member properties. You can build the request as below.

  • Click on the Facet tab. You should be presented with a screen as shown below. Image
  • Click on ADD Property to add a block and select description in the Property field.
  • Click on ADD Property to add another block and select memeber in the Property field. This should display a field allowing you to select the Label Property. Select givenName. Your screen should look as below. Image
  • This is all you need to do to build facet parameters. To view the parameters click on the Request tab where you will see the facet parameter value. It should look as shown in the shot below. Image
Sort

Using this tab you can build the sortBy parameter for search results sorting. The steps to build this parameter are the same as described in the above sections.

Paging Counting

Using this tab you can specify the page, pageSize and countUpto parameters for a search. For each of these parameters there is a field under the Paging Counting tab as shown below. Simply enter the values for these fields. You can view the request parameters under the Request tab.

Language

Using this tab you can specify the lang parameter for a search. If you start typing the language code autocomplete will show any matching codes. If you want to enter a language code other than those in the options list you can type the code and click "Add". You can view the lang parameter under the Request tab.

Conditional GET

Using this tab you can specify the If-None-Match header and add a Prefer header to get etags for search results. If you add these headers you can view them under the Request tab.

Update request

Update requests are used to try out update features in the API. There is currently no builder for an update request but you can specify the body of the request under the Request tab.

Delete request

Delete requests are used to try out delete features in the API. There is currently no builder for a delete request but you can specify the body of the request under the Request tab.

Batch request

Batch requests are used to try out the batch features of the API. You can use the Build tab to build a body for resources to create and specify the context. To specify the update and delete parts of a payload you can edit the payload body under the Request tab.

Variables builder

To build scenarios for Search, Update, Delete and Batch you might want to use some values from previous request responses within a scenario. For example, in an update request you need to specify the eTag of the resource being updated. As eTags are returned in a response body a mechanism is required to store the value in a variable and then refer to these variables in subsequent requests. This can be done by setting variables under the Response tab. In the image below you can see two blocks at the end to set variables from a response body or a response header. Note that to set variables you need to run the request first.

Image

Set a variable from a response header

To store a value of an eTag header in a variable first execute the request then click SET ETAG FROM HEADER. This will populate the Header Name and Preview Value fields. You need to enter a Variable Name that will be used to store the value. After typing the variable name you can then save the request.

Image

Set variable from response body

Similarly to setting variables from a response header, you can also set them from a response body. Click ADD and enter a Variable Name and a JSON Path. You will be able to see the current value for the JSON Path in the Preview Value field. After adding a variable remember to save the request otherwise you will lose any changes if you load another workspace or refresh the page.

Image

Using variables

To use a variable in a request body enclose the variable name in double curly braces {{variable name}} as shown below.

Image

You can also use variables in the builders. In the below screenshot the If None Match field value is a variable.

Image

To preview the substituted value you can select 'Preview with Global Variables Substitution' under the Request tab as shown in the screenshot below.

Image

Import and export

As an API developer you might want to create examples to share with API users. The Playground allows you to export workspace and scenarios.

To export a workspace open it and click Image. This should download the workspace to your system.

To export a scenario select it and click Image.

To import a workspace click Image. This will open the import dialog. Click BROWSE FILES or drag and drop a workspace file on to the appropriate area of the screen. The screenshot below shows the Select File step with a selected file.

Image

Click NEXT to Preview the name and description of a workspace, along with its scenarios and requests. The screenshot below shows the Preview screen.

Image

Click NEXT. This will show the Import Successful message.

Image

Click FINISH to go to the Playground dashboard, where the newly imported workspace will show up.

Scenarios can be only imported into a workspace. Therefore, to import scenarios first open a workspace and then click the Import button. This will open a dialog similar to workspace import. Note that you can import multiple scenarios.

Mock setup

Under the Mock Setup tab within a workspace you can control how mock data is generated for datatype properties. To change the default regular expression (regex) click the Image button in the appropriate property card. This will display a dialog where you can change the regex and test the values generated by it.

Image

GraphQL

When you switch to GraphQL mode the Request tab shows the GraphQL query and variables editor. If you have built the request using the Build tab then, depending on the type of request, the GraphQL query is autogenerated and can be viewed under the Request tab. If you wish to manually create a query you can type it in the query block and specify any variables in the variables block.

Image

If you execute a GraphQL request the Response tab shows the result of the request.

Image

There are some differences in how various features work depending upon whether you are in HTTP API or GraphQL mode. For more details see the APIs section.

If you change mode from HTTP API to GraphQL for a search request then, by default, the generated GraphQL search query just selects __typename for egResults. To select other fields you will need to manually type the rest of the GraphQL query.

Explorer

Explorer allows you to build a site for your data in the EasyGraph.

It comes with easy to use site builder. You can create multiple sites and you can also set a site as home page. If a site is set as home page any user who visit the home page of EasyGraph will see the site instead of EasyGraph management UI.

Bootstrap EasyGraph and in the load model step choose 'Graphologi Model'. For ID Setup step configure read only API. For more details see bootstrap.

Download UNESCO Thesaurus Turtle

Open System Manager and import UNESCO Thesaurus data into EasyGraph.

Open Explorer application and click ADD NEW SITE button. Enter 'UNESCO Thesaurus' as site name and click ADD button.

In the site configuration dialog configure as below:

Language Setup

Configure languages as shown in the screen shot below and click NEXT

Image

Basics

You do not need to do anything just click NEXT

Labels

You do not need to do anything just click NEXT

Search

Switch on 'Enable Language Selection'. Select 'skosPrefLabel' and 'skosAltLabel' properties as shown below.

Image

Click on ADD FILTER button and configure the filter for 'type' as below. Note the 'Enable Facet' switch is on.

Image

Click on ADD FILTER button again and configure the filter as below. Note the 'Enable Facet' switch is on

Image

Click on ADD FILTER button again and configure the filter as below.

Image

Click on ADD FILTER button again and configure hidden filter as below.

Image

Click NEXT

Data View

In the tree on left hand side select 'Concept' and configure the view as below.

Image

In the 'Other Properties' click ADD PROPERTY button to add a property. Click the button again and configure properties as below. Note 'Show Count' switch is on.

Image

In the 'Summary Section' configure as shown below.

Image

Click NEXT

Home Page Queries

Click ADD QUERY button and configure as below.

Image

Click on 'Paging Counting' button and set the page size to 12.

Click NEXT

Pages

Click FINISH

You should see home page of the site as below. Try search or click on card to explore the data.

Image

Create Site

To create a site open Explorer application and click ADD NEW SITE button. Enter name and description of your site and click ADD button. This should create the site and open site configuration dialog.

Only root user or a user with Super Admin role can create and configure site.

All sites are shown on the explorer home page. To edit site name and/or description you can click edit icon button on site card. If you wish to delete a site the delete button is also available on site card.

Configure Site

The site configuration dialog has below sections:

Language Setup

In this section you can configure multiple language browse for your site. To configure multiple languages switch on 'Enable multilingual site browse' setting. With this setting enabled you can add languages for browse. With this configuration switched on site users will be able to select a browse language from configured languages list.

When 'Enable multilingual site browse' is on you can also switch on the setting to 'Enable multilingual UI configuration'. This will allow you to enter translations for various labels used in the site UI.

If the underlying data is not in multiple languages you leave the 'Enable multilingual site browse' switch off and just specify the default language code of the data.

Basics

Under basics section you can configure look and feel of the site. With these configuration you can create a site matching to your brand.

You can also show/hide buttons which are shown in the right pane below Filters pane.

To hide IRIs of linked resources you can change "Linked resources view type".

You can also turn on the feedback "Feedback Settings".

The switch for 'Set as home page and make settings public' is disabled on sandbox but if you are running EasyGraph in your own environment this option can be used to set a site as home page..

Labels

From the labels sections you can configure various messages and labels which are shown on the site. For a multilingual site you can also add translations.

Search

Under this section you can configure main text search. By default text search is shown at the top. To show text search in search card you can switch on 'Show In Filters' setting.

If you select properties then text search is only performed against those properties.

From the filters section you can configure the filters which site user can use to search data. When configuring a filter you specify the property and operator for the filter. You can also enable facets for a filter.

As you configure filters 'Search Card Preview' on the left of page shows how the search card is going to look on the site.

Data View

From the data view section you can configure the display of search results and resource view page.

For each resource you can specify the title, image and description properties. These properties are then used to determine what data to show on search result cards.

You can specify multiple properties for each section. If the data is not available for one property then alternative property is used to render value on search result cards.

You can also add other properties and configure how to show these on card.

Hiding Properties From View

If there are some properties on resource data but you want to hide those properties, you can do so by clicking on property tab in the top left. This should show list off all the properties. You can hide a property by clicking on the switch next to property name. To add the property back again, you can click delete button next to property name on the right of the screen(Hidden Properties Section).

Configure Resource Property View

It is also possible to configure the order of the properites shown for a resource.Select the class from the left tree and on the right side details section scroll to the "Property Order" section. First add properties by clicking the Add button. After adding the properties you will be able to change the order of the properties and that is how the properties will show on the resource.

If you switch on 'Hide all other properites' then all other properties except the ones which are added in Property Order section are hidden from the view.

If a property is hidden as explained in "Hiding Properties From View" section above, adding a property to resource view won't show the property on resource. So if a property is not showing check it is not hidden.

Home Page Queries

Under this section you can configure queries to show data on home page of the site. When site user visit the home page these queries are run and cards are shown based on the search result.

You can add multiple queries.

For more details on configuration of the query please see search request

Pages

Under this section you can configure pages like about us or API examples. Site users see these pages in the application bar.

To add a page click ADD PAGE button. Enter the page title. If the site is multilingual site you will be able to enter translations for the title. Click SAVE button.

To add the content of the page click OPEN PAGE EDITOR button.

From the page editor you can add content section, a data visualisation, graph visualisation, sheet or you can add API search examples.

To save all the settings click 'Finish' button.

You can change the site configuration at anytime by clicking settings icon button. This opens same dialog as explained in the previous section.

Import and export

To export a site click export button on the site card. This should download the site to your system.

To import a site open explorer application and click import button in the left menu. Select the site file and follow the steps in dialog.

System manager

System Manager allows you to view and edit configurations created within EasyGraph.

Image

Home

The Home tab shows statistics about the configuration and CPU usage.

ID setup

If you want to change the ID Setup after bootstrap you can do that under this tab.

Classes

The Classes tab allows you to view all the OWL classes in a configuration.This is for viewing purposes only.

Shapes

The Shapes tab allows you to view and edit the SHACL shapes generated by the EasyGraph Bootstrap application. To edit a property in the shape click the Image button. This will open a property edit dialog as shown below.

Image

What can be added/edited depends on the property type and ontology. Below is the list of options implemented.

  • You can add minimum and maximum count constraints if these restrictions are not defined in the ontology.
  • For string and language type properties you can add minimum and maximum lengths.
  • For string and language type properties you can add a regular expression (regex) pattern.
  • For object type properties you can add/edit the list of classes.
  • For object type properties you can add minimum and maximum count constraints.
  • For object type properties where the range is an RDF List you can define the class of any list items.

Inverses

If you want to change the Inverses after bootstrap you can do that under this tab.

Rules

Under the Rules tab you can define construct queries which can run on creation of or the updating of resources. The result of these queries is persisted in the database. This can be useful for search query performance tuning and generating other useful properties such as adding a created or updated time.

Note that SHACL validation runs on the results of any construct query plus any triples for create/update and validation will fail if a resource is not valid as per the shape.

To define a rule click the Image button. This will open the Create New Rule dialog.

Image

Enter a value in the Label field to give a rule a name. Select the desired Run On options to specify if the rule should be fired on create, on update or for both operations. Select values for Membership Class to specify the types of resources for which this rule is applicable. Specify the construct query and click Create.

To understand how rules work let us create an example rule to add a dateCreated property for ImageObject class (assuming the payload does not specify it).

  • Run Bootstrap with an example ontology and then open the System Manager.
  • Select the Rules tab and click Image button.
  • In the dialog enter a name and for the Run On field select Create.
  • For the Membership Class select ImageObject.
  • Enter the below query for SPARQL Construct Query
    prefix ex:  <http://example.com/>
    CONSTRUCT  {
        ?s ex:dateCreated ?dateCreated
    }
    WHERE {
      ?s ?p ?o .
      MINUS { ?s ex:dateCreated ?dt }
      BIND(NOW() as ?dateCreated).
    }
    
  • Click CREATE

Go to the Playground and create a resource of type ImageObject, without specifying any dateCreated value. Then search for the newly created ImageObject resource and you should see a dateCreated property.

Import

Importing a configuration will wipe any existing configuration.

Configuration import allows you to load an entire API configuration. This is very useful if a developer of the API wants to share a configuration with API users. By importing a configuration, API users can recreate the same setup within EasyGraph that the API developer has created, including any manual changes.

You can only import a 'Full configuration' file generated using export.

To import a configuration click the BROWSE FILES button under the Configuration tab under the Import tab. Select a configuration file from the file system dialog and click IMPORT. You should see a confirmation message.

To verify that all the configurations has been imported you can click on the other tabs in the System Manager and view imported configurations.

Image

To import data select Data tab and click the BROWSE FILES button. Select data file and click IMPORT. You should see a confirmation message.

Image

Due to performance reasons, shapes validation is not performed on the imported data. So you need to make sure that imported data is valid as per the configuration. Also all the data is loaded in memory first and for large dataset you will need to configure more heap space for EasyGraph.

Export

Export allows you to export a full or partial API configuration. Click on the Export tab. Choose an Export Type and a File Type and click EXPORT. This will download the configuration file to your file system.

Image

Under the Export tab you can also view or download the generated JSON-LD context file for the API configuration. Click the JSON-LD button and then either view the context file or click DOWNLOAD.

Image

Authentication

Authentication controls who can access EasyGraph API. EasyGraph use JWT tokens or key pair for authentication. If authentication is enabled then user can login with a post request to {base-url}/egmManagement/login for more details please see API section.

There are 3 configuration options for authentication.

When Authenticate all requests option is selected then all the API calls are authenticated using JWT token.

Or you can select Authenticate update requests only and allow read requests without authentication. This means public read API.. This option is useful if you want to setup public read only API for your dataset.

Or you can completely disable authentication by selecting Disable authentication for all requests.. For example you might want to use this option if you have AWS API Gateway fronting EasyGraph API and want to handle authentication through AWS API Gateway.

Authorisation

Authorisation is to control what an authenticated user can do. From the authorisation tab you can enable type of the authorisation you want to use on API calls.

Enable Create, Retrieve, Update and Delete Operation Based Authorisation option can be enabled to control which users are allowed to creation, retrieval, update and deletion of the resources.

Enable Data Class Based Authorisation option can be enabled to control which users are allowed to perform what type of operations on classes(type) of data.

Enable Endpoint Based Authorisation option can be enabled to control which users are allowed to perform actions on some of the admin API endpoints.

Roles

Users of the EasyGraph can be assigned roles from this tab. Depending on the authorisation settings, permissions can be configured for each role and then role can be assigned to users.

To add a new role click on the Add new role icon button on the roles screen. Enter role name and description in the dialog and click Create button. Your screen should look as below

Image

To setup Operation Based Authorisation ensure that Enable Create, Retrieve, Update and Delete Operation Based Authorisation option is checked under the Authorisation tab. If the option is checked your screen should look as below.

Image

To associate a permission click the checkbox for operation name.

To setup Class Based Authorisation make sure that Enable Data Class Based Authorisation option is checked under the Authorisation tab. Assuming that you have done boostrap with example ontology in Quick Start section, If the Class Based Authorisation is enabled your screen should look as below.

Image

To associate a permission click the checkbox for operation name in the class tree.

To understand how role based access control works let us go through some examples. Follow the steps in Quick Start section and create dataset in your sandbox. Bootstrap dataset with example ontology by following steps Quick Start blocks in Bootstrap section of this documentation.

Create a user with read only permissions

Go to User Management screen and create a new user named ReadOnlyUser. In the Datasets block select Can View checkbox against the dataset which you have setup above.

Image

Open System Manager application.

Click Authentication menu option on left and select Authenticate all requests option.

Image

Click Authorisation menu option on left and select Enable Create, Retrieve, Update and Delete Operation Based Authorisation option.

Image

Click Roles menu option on left and create a new role named ReadOnlyRole. Role details for newly created role should show on the right side.

In the role details select Retrieve checkbox from the Operation Based Authorisation block.

Image

In the role details, in Users block select Role Assigned checkbox for user ReadOnlyUserRole.

Image

Logout and login with ReadOnlyUser user.

On home screen select dataset you have setup.

Open Playground application and autogenerate example workspace by following the steps in Quick start section in the Playground documentation. Open the workspace and run create examples. If you have followed all the steps you should see that Create requests fail for the user as shown below. This is because user does not have write permissions.

Image

Next try to run Search basics example scenario. You should see that all the search requests succeed. This is because user has read permissions.

Image

Create a user with create, read and update permissions

Login as root user and Go to User Management screen and create a new user named EditorUser. In the Datasets block select Can View checkbox against the dataset which you have setup above.

As explained in the previous section setup Authentication and Authorisation.

Create a new role with name EditorRole. Select Create, Retrieve and Update checkboxes and assign EditorRole to EditorUser as shown below.

Image

Logout and login with EditorUser. Open Playground and run "Update features" scenario. As the user has permissions to create, retriev and update all requests except RESET should succeed as shown below.

Image

Reset can only be done by a user with Super Admin permission. Please see Users section for more details.

Create a user with create, read and update permissions on resources of type Organisation

Login as root user and Go to User Management screen and create a new user named OrganisationEditorUser. In the Datasets block select Can View checkbox against the dataset which you have setup above.

As explained in the previous section setup Authentication.

Setup Authorisation as shown below.

Image

Create a new role with name OrganisationEditorRole.In the CLass Based Authorisation block select Create, Retrieve and Update checkboxes for Organisation and assign OrganisationEditorRole to OrganisationEditorUser as shown below.

Image

Login with OrganisationEditorUser and run "Server side id generation" under "Create featrues" scenario. This should succeed. If you run "Multiple connected resources" request, it should fail as user does not have permission to create all types of resources in the payload.

As a root user you can create resource of type Organisation, ImageObject and Person. If you then login as OrganisationEditorUser and run search request you will see that only resources of type Organisation are returned.

Schema builder

Schema builder allows you to build a schema for your API.

Once you have built a schema you can set up your API by selecting the schema option in the bootstrap process.

Create schema

To get started click Schema Builder in the dashboard. Your screen should look as below.

Image

Click the Add New Schema button and fill in the form as shown below.

Image

Name : Give your schema a name.

Namespace Prefix : A prefix is a short name for the base IRI. EasyGraph uses prefixes when there are conflicts in generating property and class names for IRIs. For more details see prefixes

Base IRI : The base IRI is used to generate IRIs for properties and classes defined in the schema.

Description : A description for your schema.

Click the Add button to create a new schema. Your screen should look as shown below.

Image

To view/edit schema details you can click on schema name.

To view all the schemas click on the Image icon in the menu on the left.

Add a class

In the new schema click Add Class to add the first class. In the dialog enter a name and, if desired, a description and then click Add. This will create a new class which will show under the Classes tab. To add more classes click Image.

Image

Delete a class

To delete a class click Delete button in the class details.

Image

Graph view

Using graph view you can view the class hierarchy and how classes are connected to other classes through properties. To open the graph view click Image on the top right hand side of the screen.

To view details of any class click on the node in graph view.

Image

To reset the graph click Image. For other options click the Image button. The screenshot below shows all the options.

Image

To go back to the form view click Image on the top right of the screen.

Add subclass

Schema builder allows you to create a class hierarchy. To create a subclass hover over the class node and click Image as shown below.

Image

This will open a dialog with options to create a new subclass or to choose an existing class to use as a subclass.

To create a new class as a subclass select the Create New Class option as shown below. Enter a name and, optionally, a description of the class and click the Add button. To add multiple subclasses you can click Multiple. This will add the class and keep the dialog open to add additional subclasses.

Image

A subclass inherits properties from its super classes. To view all the inherited properties you can turn on the Inherited Properties switch.

To remove the relationship between a subclass and its superclass, hover over the subclass node and click Image. You can also remove the relationship by clicking on the delete button on the chip in the Hierarchy tab.

Image

Note that in graph view you can hover over the edge connecting a subclass and its superclass and this will show the remove icon button.

Image

Add property

To add a property to a class click Add in the properties block on the right of the screen. In the dialog enter a name and, optionally, a description for the property. In the Property Type field select a type for the property.

Property type

Object

Object properties allow you to connect data of different types. For example, if you have a Person class and an Image class, then you can define an Object type property to link images to a person.

List

List allows you to create ordered lists. This uses rdf:List under the covers.

Datatype

Use a datatype property for other class attributes.

Literal

If you do not want to define a datatype you can choose literal as the property type. This means that the value of this property can be a language tagged string, a string or a value with a datatype.

For example, if you want to add a givenName property to the Person class, enter "givenName" in the name field and select "String" in the property type field. Click the Add button. Your screen should look as below.

Image

To remove a property from a class click the Image button in that property. Note that this will only remove the property from the selected class. If you want to delete a property from all the classes it is used on see the Delete Property section.

You can view a list of all the properties under the Properties tab as shown below.

Image

To create a new property click the Image button and enter details in the dialog. The same property can be used in multiple classes.

To view property details click on the property. From the property details on the right you can change the property type and any inverse property.

Delete property

To delete a property click Image in the property details.

Image

Property constraints

Depending on the type of the property, constraints can be defined for that property as used on that class. Any API request not satisfying the constraints as defined on the property will be rejected.

Min count

If this value is set then a resource with this class type should have at least that number of values for this property.

To make a property mandatory you can set the Min count value to 1.

Max count

This is to set the constraint on the maximum number of values for a property.

Regex pattern

This can be used to set a constraint on the value of string type properties.

Max length

This sets a constraint on the maximum number of characters that can occur in a property value.

Min length

This sets a constraint on the minimum number of characters that must occur in a property value.

Object type

For an object type property this sets a constraint on the type of class that can be connected via this property.

You can specify more than one type. If you do this means that resources with any of those types are permitted.

Type for list

For list type properties this sets a constraint on the type of class that can be used for members of the list.

Inverse property

For object type properties an inverse property can be defined. For more details how inverse properties work in EasyGraph see Inverse.

Import and export

You can export a schema by clicking the Image button. An exported schema can be imported into another schema or in the schema dashboard.

To import a schema into another schema first open the schema in which you want to import your schema. Then click the Image button in the left menu. This will open an import dialog. Click the Browse File button or drag and drop a schema file onto the appropriate area of the screen. The screenshot below shows the Select File step with a selected file. .

Image

Click Next to preview the name and description of schema along with its classes and properties. The screenshot below shows the Preview screen.

Image

To preview existing classes or properties along with the imported classes and properties click Image.

Click Next. This will show an Import Successful message. Click FINISH and you should see the newly imported classes and properties.

To import a schema as a new schema click the Image button in the left menu on the schema dashboard. The rest of the steps are the same as explained above. Once imported you will see the newly imported schema in the schema dashboard

Bootstrap with schema

For details on bootstrap please see Bootstrap

To bootstrap an API with a schema select the schema in the Load Model step of the bootstrap.

Image

Once you have selected your schema you will see the name and description of the selected schema as shown below.

Image

Click Next and complete the rest of the steps as described in the bootstrap section.

APIs

This section gives more details about the backend API and the features that are available. We recommended that before jumping to this section you try Quick start.

HTTP API

Content negotiation

In HTTP API mode a client can specify the Accept and Content-Type headers which tell the server in which format a client would prefer the response and the format of the payload in any request body. If these headers are not specified then the default is application/ld+json. Other formats that are available for these headers are text/turtle and application/rdf+xml.

Create

To create a resource through the HTTP API send a POST request to the {base-url}/graph endpoint with a payload in the body of the request. To understand the various create features try the 'Create features' scenario in an autogenerated workspace.

During the bootstrap, or from System Manager, you can configure the level in a class hierarchy for which IDs should be generated. This also controls at what level in class hierarchy resources can be created. In our example model ImageObject is a subclass of MediaObject but ID setup is turned on for ImageObject which means that only resources of type ImageObject can be created. If you switch on ID generation for MediaObject then you will be able to post resources of type ImageObject or MediaObject but IDs will be generated using the label 'mediaobject'. The easiest way to understand this is to try it out by making the change in a configuration and then creating resources using the Build tab in the Playground.

Response codes
  • 200 Request has been processed successfully.
  • 400 To indicate request is invalid e.g. if there are SHACL validation errors.
  • 403 To indicate request is not allowed e.g. if same uuid is used in id of multiple resources.
  • 500 If something goes wrong on server side.

Update

To update resources in HTTP API mode a PATCH request can be sent to the endpoint {base-url}/graph. In GraphQL the same thing can be done through update mutations. When you update a resource you might want to update a value of a property or you might want to remove it completely. You can see examples for updating resources in an autogenerated workspace under the scenario 'Update features'.

eTag

To solve the problem of lost updates each update request needs to specify eTags of any resources being updated. On the server side this value is compared against the eTag in the database and if the request value matches then the update request is processed. If it does not match the request is rejected.

Delete property value

To delete a value of a property from a resource use null as the value of the property in the payload.For example the payload below will delete the properties description, member and slogan.

{
    "id": "http://example.com/organisation/12ee6359-5056-4ecb-ade2-adde0c84f940",
    "description": null,
    "member": null,
    "slogan": null,
    "egETag": "W/\"1589628122689\""
}
            
Update property value

To update value of the property specify new value. This will result in replacement of old values with new value. Note that for language type properties and properties of type set/list entire value is replaced with new value.

For example if we have a resource as shown and we want to update description to add description with language code "it" and delete description with langauge code "en"

"description": {
    "es": [
        "Hola mundo",
        "Hola  prueba"
    ],
    "fr": "Bonjour tester"
}
            

Patch request for same will be as below. Note that even though we are not changing anything for "es" we still need specify the values for "es".

"description": {
    "es": [
        "Hola mundo",
        "Hola  prueba"
    ],
    "en": "Hello test"
}
            
Response codes
  • 200 Request has been processed successfully.
  • 400 To indicate request is invalid e.g. if there are SHACL validation errors.
  • 412 To indicate precondition failed e.g. if eTag is stale.
  • 500 If something goes wrong on server side.

We wanted to keep PATCH syntax simple and easy to understand for front end developers. So null value in PATCH payload with media type application/ld+json or application/vnd.graphifi.patch.ld+json is processed as deletion of the property. As concept of null is not applicable to RDF/XML and Turtle payload, media types application/rdf+xml and text/turtle are not supported for PATCH endpoint.

Delete

To delete resources in HTTP API mode DELETE request can be sent to endpoint {base-url}/graph. In GraphQL the same thing can be done through delete mutations. For examples see 'Delete features' scenario in autogenerated workspace.

Response codes
  • 204 Request has been processed successfully.
  • 412 To indicate precondition failed e.g. if eTag is stale.
  • 500 If something goes wrong on server side.

GraphQL server

EasyGraph automatically generates GraphQL schema and GraphQL spec compliant server endpoint is made available at {base-url}/graphql.

In playground you can try GraphQL and in autogenerated workspace for most of the requests you can change the mode and see GraphQL equivalent of HTTP API.

Create

In GraphQL schema mutations to create resources start with 'create_'. To view the list of mutations you can explore GraphQL schema or try it from Playground.

Search

Most of the options explained under HTTP API Search are also available in GraphQL mode. Only difference is how you specify these options. In GraphQL mode all the parameters are specified with 'search' query as shown in example below.

query search($query: String!,
  $page: Int = 1,
  $pageSize: Int = 10,
  $countUpto: Int = 10,
  $sortBy: String!,
  $lang: String!,
  $facet: String!,
  $labelPropertyLang: String!) {
      search(query: $query,
        page: $page,
        pageSize: $pageSize,
        countUpto: $countUpto,
        sortBy: $sortBy,
        lang: $lang) @hint(queryType: PATHS) {
            egHasNextPage
            egHasMoreToCount
            egTotalCount
            egFacets(query: $facet, labelPropertyLang: $labelPropertyLang) {
              egFacetLabel
              egFacetResults {
                egFacetValue {
                  type
                  value
                }
                egFacetValueCount
                egFacetValueLabel {
                  lang
                  value
                }
              }
            }

      }
}
    
Variables for above query can be specified as below
    {
        "query": "{  member{   image } }",
        "facet": "{ givenName }",
        "sortBy": "{ givenName }",
        "page": "2",
        "pageSize": "2",
        "countUpto": "100",
        "lang": "fr"
    }
                    

A GraphQL query can contain details about which properties are to be returned. Below example shows how to fetch some of the properties of Organisation and it'smembers. To some extent it is similar to Prefer header 'return=representation' in HTTP API.

{
  search(query: "{  type(eq:[\"Organisation\"] ) }") {
    egHasNextPage
    egHasMoreToCount
    egTotalCount
    egResults {
      __typename
      ... on Organisation {
        id
        type
        egETag
        description {
          lang
          value
        }
        member {
          id
          egETag
          givenName
        }
      }
    }
  }
}
                

Update

In GraphQL schema mutations to update resources start with "update_". To view the list of mutations you can explore GraphQL schema or try it from Playground.

Delete

In GraphQL schema mutations to delete resources start with "delete_". To view the list of mutations you can explore GraphQL schema or try it from Playground.

Language type properties

Language type properties are serialised differently in GraphQL and HTTP API. Reason for this is that in HTTP API language type property values are serialised as language container as shown below.

"description": {
    "en": [
        "Hello world",
        "Hello test"
    ],
    "fr": "Bonjour tester"
}
                

It is not possible to define language container with GraphQL schema. So in GraphQL mode all the language type property values are returned as object containing lang and value property as shown below.

"description": [
    {
        "lang": "en",
        "value": "Hello world"
    },
    {
        "lang": "en",
        "value": "Hello test"
    },
    {
        "lang": "fr",
        "value": "Bonjour tester"
    }
]
                

For create and update operations same difference applies.

Nested objects

As GraphQL does not allow union for input types if a object property can be assigned more than one class types then in GraphQL objects cannot be nested in create payload. You can still connect resources by IDs. However this means ids needs to be generated on client side.

Batch and Async API

There is no Batch API in GraphQL. However GraphQL mutation query can execute multiple update operations so HTTP Batch API can be converted to GraphQL mutation to achieve the same result.

Async request are not supported in GraphQL.

GraphQL schema

At the moment GraphQL schema is generated with union. Based on the feedback and actual use cases we might add option to generate schema with interfaces.

Type name introspection

As GraphQL server endpoint is spec compliant introspection works out of the box. Below is the example of type introspection with search results.

          {
            search(query: "{  type(eq:[\"Person\" \"Organisation\" \"ImageObject\"] ) }")  {
              egHasNextPage
              egHasMoreToCount
              egTotalCount
              egResults {
                __typename
                ... on Person {
                  id
                }
                ... on Organisation {
                  id
                }
                ... on ImageObject {
                  id
                }
              }
            }
          }
                        

Schema introspection

Introspection also works with schema. Query below is example of schema introspection.

query IntrospectionQuery {
  __schema {
    types {
      kind
      name
      description
    }
  }
}
        

Fragment spread

Below is the example of search with FragmentSpread. If you have bootstrapped with example ontology you can try it from playground.

{
  leftSearch : search(query:"{  givenName(eq:[\"Left Org Member\"] ) }") {
    egResults {
      ... personFields
    }
  }
  rightSearch : search(query:"{  givenName(eq:[\"Right Org Member\"] ) }") {
    egResults {
      ... personFields
    }
  }
}

fragment personFields on Person {
  id
  givenName
}
            

Assuming there is no data matching the search, response for above request will look as below. As you can see from response both leftSearch and rightSearch are returned in the response.

{
  "data": {
    "leftSearch": {
      "egResults": []
    },
    "rightSearch": {
      "egResults": []
    }
  }
}

GraphQL errors

As per GraphQL spec EasyGraph return errors in response. Wherever possible error message property will contain HTTP API code and phrase. Other details about the error are returned in extensions as shown below.

{
  "errors": [
    {
      "message": "reason : 'FORBIDDEN' httpStatusCode : '403'",
      "extensions": {
        "id": "_:node1e82c5uqnx8120",
        "type": "EgApiError",
        "rdfsLabel": {
          "lang": "en",
          "value": "UUID values [da2bfd55-d616-4d7d-941a-2787d3e0f093, 35334a2d-10d1-4cba-833e-fcef9c6d7cb6, 367a6c56-9255-4d06-852a-47e492b5f5ff] are already used for other resources."
        }
      }
    }
  ]
}
            

Batch API

Batch API allows you to perform create, update and delete in one HTTP API call. Depending on the feature of underlying database used with EasyGraph this means that entire operation can be executed in one transaction. For examples see requests under 'Batch API features' in autogenerated workspace.

In GraphQL, Batch API equivalent is to send multiple mutation operations in one call. For examples change the request mode to GraphQL for requests under 'Batch API features' in autogenerated workspace.

Async batch api

Depending on the size of update batch api might take some time to process. To wait long on client side with synchronous calls for the large operation to finish can cause many problems e.g. bad UI experience and connection timeouts etc. To solve these problems Batch API also supports respond-async preference. When async request is accepted by the server a response code of 202 is returned along with the activity in the response. Returned activity contains a property egStatus to indicate the status of the request. Initially the egStatus will be https://easygraph.graphifi.com/schema/eg/validating and if the update call succeeds activity egStatus will change to https://easygraph.graphifi.com/schema/eg/success. In case operation fails the egStatus will change to https://easygraph.graphifi.com/schema/eg/failed.

Client can poll to keep searching for the activity to get the updated egStatus. For examples see requests under 'Batch API async features' in autogenerated workspace.

There can be a use case where client might want to search the batch operation by some client generated ID. For these use cases client can pass 'activityContext' parameter to 'respond-async' preference. Value of this parameter must be a valid IRI and it maximum limit is 5. If a request is sent with 'activityContext' then values of this parameter are added to activity property named egActivityContext. A client can filter activity search request to find all the activities for a 'activityContext'.

For async request there are chances that request may fail when it is processed in background. If a request fails then egStatus is set to https://easygraph.graphifi.com/schema/eg/failed and property egFailureReason will contain all the details about failures. For example if there are SHACL validation errors then egFailureReason will contain SHACL validation report.

API activity

For each API call for create, update and delete EasyGraph records what IRI's has been changed in a resource of type EgApiActivity. Below are the properties which are added to EgApiActivity

  • egStartedAtTime This property records server side activity start time.
  • egGenerated This property records IRI's of the newly created resources.
  • egUsed This property records IRI's of the updated resources.
  • egInvalidated This property records IRI's of the deleted resources.

For examples see requests under scenario 'Activities' in autogenerated workspace.

Async api activity

For async batch api requests, activity of type EgAsyncApiActivity is generated. EgAsyncApiActivity is sub class of EgApiActivity and it contains below extra properties.

  • egStatus To indicate the status of the activity.
  • egActivityContext To record the 'activityContext' specified with async request.
  • egFailureReason Details of why an async request failed.

Admin API

EasyGraph admin API can be used to perform API admin functions programmatically.

Bootstrap From Ontology

API Endpoint to bootstrap EasyGraph from ontology is {base-url}/administration/ontology/bootstrap

Body of the request should be multipart request with below request parameter.

  • baseIRIForData This is same as Base IRI of Data field in Bootstrap Application.
  • baseIRIForSchema This is same as Base IRI of Schema field in Bootstrap Application.
  • defaultLanguageCode This is same as Default Language field in Bootstrap Application.Value of this parameter should be valid language code.
  • enableDataReset This is same as Enable Data Reset field in Bootstrap Application. If you want to enable data reset specify value "YES" otherwise do not specify this parameter value.
  • idSetup Allowed values for this parameter are "readOnly" to setup read only API and "lowestClasses" to setup id generation with lowest classes in the hierarchy.
  • inverses To exclude inverse property IRIs from materialisation specify "exclude" as value of this parameter.
  • inversePropertiesList This parameter is used in combination with parameter "inverses". For example if value "exclude" is specified for parameter inverse then you can specify a comma separated list of property IRIs for this parameter.

Below is the curl example to bootstrap with example ontology. Please replace value of JWT_TOKEN and PATH_TO_FILE before running the request.

curl --request POST 'http://localhost:9982/TestDataset/administration/ontology/bootstrap' --header 'Authorization: Bearer {JWT_TOKEN}' --form 'files=@"{PATH_TO_FILE}/example-ontology.ttl"' --form 'baseIRIForData=http://example.com/data/' --form 'baseIRIForSchema=http://example.com/schema/' --form 'defaultLanguageCode=en' --form 'enableDataReset=YES' --form 'idSetup=lowestClasses'

Or if you use Postman below is how the request looks like in Postman. Please note you will need to add Authorization header with value "Bearer {JWT_TOKEN}" under the header tab.

Image Image

Re bootstrap

To regenerate API from changed model endpoint is same as bootstrap endpoint but you will need to specify value for existingConfiguration parameter. To wipe existing configuration and bootstrap again specify "wipe". To load partial model and keep existing model and merge into existing configuration specify "merge-classes-in-payload-leave-other". To load complete model and merge manual changes specify "merge". Below is the curl example

curl --request POST 'http://localhost:9982/TestDataset/administration/ontology/bootstrap' --header 'Authorization: Bearer {JWT_TOKEN}' --form 'files=@"{PATH_TO_FILE}/example-ontology.ttl"' --form 'existingConfiguration=merge-classes-in-payload-leave-other'

Configuration Management API

API configuration resources are stored in the same dataset where data is stored. Endpoint for configuration management is {base-url}/administration/configuration. A Super Admin user can execute requests against this endpoint.

To create/update a configuration resource use PUT request. Below is example to create a Role.

curl 'http://localhost:9982/TestDataset/administration/configuration' \
  -X 'PUT' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"id":"https://easygraph.graphifi.com/data/role/d5e41983-1b36-4e82-88ee-fcb9154018ba","type":["EgRole"],"egLabel":"TestRole","egDescription":"","@context":"http://localhost:9982/egContext/eg-v1.jsonld"}'

Below example is to associate a role to a user

curl 'http://localhost:9982/TestDataset/administration/configuration' \
  -X 'PUT' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"id":"https://easygraph.graphifi.com/data/role/d5e41983-1b36-4e82-88ee-fcb9154018ba","type":"EgRole","egDescription":"","egIsConfigurationResourceOf":"https://easygraph.graphifi.com/data/api-configuration/9615d3a3-d0f4-49ac-8ffa-138fe699ab11","egLabel":"TestRole","egAssignedTo":["https://easygraph.graphifi.com/data/user/1ddcdde6-14dd-4ed2-91fd-ec4dd2812e4d"],"@context":"http://localhost:9982/egContext/eg-v1.jsonld"}'

To retrieve all the API configuration execute GET against configuration endpoint.

Configuration Import API

To wipe all the existing configuration and import new configuration endpoint is {base-url}/import/configuration. Specify the configuration in the payload and run a POST request.

Dataset Management API

Endpoint for dataset management is {base-url}/egmManagement/dataset. Below are the examples

To create a dataset

curl 'http://localhost:9982/egmManagement/dataset?' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"@context":"http://localhost:9982/egmManagement/egContext/api.jsonld","type":"Dataset","label":"DatasetLabel","description":"Dataset description."}'

To GET all datasets

curl 'http://localhost:9982/egmManagement/dataset/search?' \
  -H 'Authorization: Bearer {JWT_TOKEN}'

To update description

curl 'http://localhost:9982/egmManagement/dataset' \
  -X 'PATCH' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"@context":"http://localhost:9982/egContext/eg-v1.jsonld","id":"https://easygraph.graphifi.com/data/dataset/bcbc0ada-fac0-4305-912d-d8db5d3ad6d7","egETag":"W/\"1619430452161\"","description":"Description"}'

To delete a dataset

curl 'http://localhost:9982/egmManagement/dataset' \
  -X 'DELETE' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"@context":"http://localhost:9982/egContext/eg-v1.jsonld","id":"https://easygraph.graphifi.com/data/dataset/bcbc0ada-fac0-4305-912d-d8db5d3ad6d7","egETag":"W/\"1619430452161\""}'

User Management API

Endpoint for user management API is {base-url}/egmManagement/user. Below are the examples

To create a user

curl 'http://localhost:9982/egmManagement/user?' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"type":["User"],"username":"TestUser","password":"TestUser1$","description":"A test user.","@context":"http://localhost:9982/egmManagement/egContext/api.jsonld"}'

To search/get user. Please see Search for details. In the request specify type value "User".

To set permission for user to view a dataset.

curl 'http://localhost:9982/egmManagement/user?' \
  -X 'PATCH' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"@context":"http://localhost:9982/egmManagement/egContext/api.jsonld","id":"https://easygraph.graphifi.com/data/user/1ddcdde6-14dd-4ed2-91fd-ec4dd2812e4d","egETag":"W/\"1619430944595\"","canView":["https://easygraph.graphifi.com/data/dataset/edef38cd-751f-4def-8d2f-e7d86957f6c5"]}'

To delete a user

curl 'http://localhost:9982/egmManagement/user?' \
  -X 'DELETE' \
  -H 'Authorization: Bearer {JWT_TOKEN}' \
  -H 'Content-Type: application/ld+json' \
  --data-raw '{"@context":"http://localhost:9982/egmManagement/egContext/api.jsonld","id":"https://easygraph.graphifi.com/data/user/1ddcdde6-14dd-4ed2-91fd-ec4dd2812e4d","egETag":"W/\"1619430944595\""}'

SHACL validation

For both create and update requests, resources are validated to check if there is any SHACL constraint violation. If create/update request violates any constraint defined in SHACL shape then request is rejected and SHACL report is returned in the response.

Conditional GET

With Conditional Requests you can specify eTag as If-None-Match header value for search and result is returned only if server side eTag value is different. This is very useful for caching. Scenario 'Search and conditional GET' in autogenerated workspace has examples for it.

DB specific optimisations

EasyGraph can be easily configured to work with any triple-store which provides SPARQL HTTP endpoint. We have also implemented some custom repository connectors for StarDog, MarkLogic, Fuseki and GraphDB and it is very easy to customise the repository layer to utilise db specific optimisations. For more details please get in touch with us.

OWL to SHACL

Below are the main points about how SHACL shapes are generated from OWL.

  • owl:cardinality is mapped to sh:minCount and sh:maxCount
  • owl:minCardinality is mapped to sh:minCount
  • owl:maxCardinality is mapped to sh:maxCount
  • For range of property is xsd:boolean then it is mapped to sh:maxCount with value 1
  • owl:FunctionalProperty is mapped to sh:maxCount with value 1
  • If owl:Restriction is defined with owl:someValuesFrom then sh:minCount with value 1 is added to shape
  • if no rdfs:range and no owl:Restriction is defined for datatype property then it is mapped to sh:nodeKind of type sh:Literal
  • if single type is defined rdfs:range but no owl:Restriction is defined for datatype property then rdfs:range is mapped to sh:datatype with type of rdfs:range
  • if no rdfs:range and no owl:Restriction is defined on type for object property then it is mapped to sh:nodeKind of type sh:IRI
  • if single type is defined for rdfs:range but no owl:Restriction is defined for object property then rdfs:range type is mapped to sh:class with type of rdfs:range
  • if multiple types are defined for rdfs:range usind owl:unionOf but no owl:Restriction is defined on type for object property then types from owl:unionOf are mapped to sh:or types
  • if a class is defined with owl:Restriction on datatype property with a single type for owl:allValuesFrom then owl:allValuesFrom value is added to sh:datatype
  • if a class is defined with owl:Restriction on object property with a single type for owl:allValuesFrom then owl:allValuesFrom type is added to sh:class
  • if a class is defined with owl:Restriction on object property with a multiple types for owl:allValuesFrom through owl:unionOf then owl:allValuesFrom types are added to sh:or

Assumptions

This section gives details about assumptions and some of the limitations.

Blank nodes

Blank nodes are not supported at the moment. In our experience blank nodes add complexity and API becomes difficult to understand. You can still use RDF List.

ACID compliance

Level of ACID compliance depends on database under the hood.

Multiple types

Multiple types for a resource are not supported at the moment. That is you cannot specify more than one type for a resource in the payload. Reason this is not allowed is because GraphQL schema restrictions.

JSON-LD serialisation

All the property values are serialised as strings. However JSON-LD context files give details about datatype of property value.

SPARQL

SPARQL endpoint is disabled by default, to enable it set the properties as below.

  • If you are on OSX/Linux platform, edit conf/setenv.sh and add/update env variables exports as shown below.
            export EG_SPARQL_ENDPOINT_READ_ENABLED=true
            export EG_SPARQL_ENDPOINT_UPDATE_ENABLED=true
            
  • If you are on Windows platform, edit conf/setenv.bat and add/update env variables exports as shown below.
            set EG_SPARQL_ENDPOINT_READ_ENABLED=true
            set EG_SPARQL_ENDPOINT_UPDATE_ENABLED=true
    
  • You can also use Endpoint Based Authorisation to control access to SPARQL endpoint. For more details please see Authorisation section.

    Badly written SPARQL queries can cause performance issue and SPARQL update can wipe entire database.

    SPARQL Console

    To Launch SPARQL console click on the SPARQL card in the dashboard. You should see console as shown below.

    Image

    If Endpoint Based Authorisation is enabled make sure your user has role with POST QUERY permission for read queries and POST UPDATE query permission for update query for SPARQL endpoint. Without the permissions user will get 403 Forbidden message in response. An example role configuration is shown in the screen shot below.

    Image

    All the queries are persisted in browser local storage. If multiple dataset are enabled then queries are executed against selected dataset.

    Local set up

    To run EasyGraph locally you will need following

    • Java 11 installed. You can verify your version of Java by running the following command:
      java -version
    • It is recommended that you configure 1GB for heap space. Default configuration for heap space is -Xmx1024m -Xms256m. You can change this setting in conf/setenv.sh for OSX/Linux env and in conf/setenv.bat for Windows environment.

    Download

    Go to https://easygraph.graphifi.com

    Image

    To sign up click on the SIGN UP button and fill the sign up form. Once you have signed up you can can login using your username and password.

    If you want to use your LinkedIn account, you must accept the Terms and Conditions. This will enable the button. Click on it to complete the login process.

    Once logged in select 'Download' option and download EasyGraph by clicking the DOWNLOAD EASYGRAPH button.

    Image

    RDF4J native store

    EasyGraph package comes with RDF4J native store. To start EasyGraph with RDF4J native store follow the steps below

    • Download the zip file.
    • Unzip the file.
    • Change directory to the root of unzipped directory. You should see below files/directories
      README.txt              conf                    data                    easygraph.jar           run-easygraph.bat       run-easygraph.sh
    • If you are on OSX/Linux platform, edit conf/setenv.sh uncomment line to set EG_JWT_SECRET env variable and set its value. If you do not set this value a random key will be used everytime you start the instance.
    • If you are on Windows platform, edit conf/setenv.bat uncomment line to set EG_JWT_SECRET env variable and set its value. If you do not set this value a random key will be used everytime you start the instance.
    • If you are on OSX/Linux platform, run run-easygraph.sh from terminal. Your screen should look as below Image
    • If you are on Windows platform, run run-easygraph.bat from command prompt. Your screen should look as below Image
    • When you see Tomcat started on port(s): 9982 message, open your browser and paste the URL http://localhost:9982/. Default login username is root and password is Password1$

    Once you have EasyGraph running follow the steps in Bootstrap

    Stardog

    EasyGraph can be configured to store data in Stardog. Below are the steps to run EasyGraph with Stardog.

    • Run all the steps mentioned in RDF4J native store section and make sure EasyGraph starts up without any error.
    • Create a database named "egData" and create another database named "egmManagement". For both databases ensure that property "Query All Graphs" is checked. Below is the screen shot of StarDog studio to set this property. Image

      Shot below shows old version of StarDog webconsole.

      Image
    • If you are on OSX/Linux platform, edit conf/setenv.sh and add/update env variables exports as shown below.
      export EG_MULTIPLE_DATASETS=false
      export DB_IMPLEMENTATION=stardog_triplestore
      export DB_SERVER_REPOSITORY_AUTOCREATE=false
      export MANAGEMENT_DB_IMPLEMENTATION=stardog_triplestore
      export MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      export SPRING_PROFILES_ACTIVE=stardog_triplestore
      
      export DB_SERVER_URL=http://localhost:5820/
      export DB_SERVER_REPOSITORYID=egData
      export DB_USERNAME=admin
      export DB_PASSWORD=admin
      
      export MANAGEMENT_DB_SERVER_URL=http://localhost:5820/
      export MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      export MANAGEMENT_DB_USERNAME=admin
      export MANAGEMENT_DB_PASSWORD=admin
      
      
    • If you are on Windows platform, edit conf/setenv.bat and add/update env variables exports as shown below.
      set EG_MULTIPLE_DATASETS=false
      set DB_IMPLEMENTATION=stardog_triplestore
      set DB_SERVER_REPOSITORY_AUTOCREATE=false
      set MANAGEMENT_DB_IMPLEMENTATION=stardog_triplestore
      set MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      set SPRING_PROFILES_ACTIVE=stardog_triplestore
      
      set DB_SERVER_URL=http://localhost:5820/
      set DB_SERVER_REPOSITORYID=egData
      set DB_USERNAME=admin
      set DB_PASSWORD=admin
      
      set MANAGEMENT_DB_SERVER_URL=http://localhost:5820/
      set MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      set MANAGEMENT_DB_USERNAME=admin
      set MANAGEMENT_DB_PASSWORD=admin
      
    • Start EasyGraph.

    If you have changed Stardog default port, username or password then make sure you set the EasyGraph properties accordingly.

    We have tested EasyGraph with Stardog version 7.6.2

    For default EasyGraph username and password see RDF4J

    Once you have EasyGraph running follow the steps in Bootstrap

    MarkLogic

    EasyGraph can be configured to store data in MarkLogic. Below are the steps to setup EasyGraph with MarkLogic.

    • Run all the steps mentioned in RDF4J native store section and make sure EasyGraph starts up without any error.
    • Next we need to setup database and http server in MarkLogic. For our example setup we are going to use ml-gradle. To setup ml-gradle visit https://github.com/marklogic-community/ml-gradle/wiki/Getting-started .
    • Run gradle mlNewProject to create new project. For "Application name" use "egData" and for "REST API port (leave blank for no REST API server)" use 8251. On success you should have gradle.properties file as shown below
      mlAppName=egData
      mlHost=localhost
      mlUsername=admin
      mlPassword=admin
      mlRestPort=8251
      
    • Run gradle mlDeploy. This action should create HTTP server, Databases and forests in MarkLogic.
    • Repeat above steps again but use "egmManagement" for Application name and 8252 for REST PORT.
    • Change directory to where you have unzipped EasyGraph.
    • If you are on OSX/Linux platform, edit conf/setenv.sh and add/update env variables exports as shown below.
      export EG_MULTIPLE_DATASETS=false
      export DB_IMPLEMENTATION=marklogic_triplestore
      export DB_SERVER_REPOSITORY_AUTOCREATE=false
      export MANAGEMENT_DB_IMPLEMENTATION=marklogic_triplestore
      export MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      export SPRING_PROFILES_ACTIVE=marklogic_triplestore
      
      export DB_SERVER_HOST=localhost
      export DB_SERVER_PORT=8251
      export DB_USERNAME=admin
      export DB_PASSWORD=admin
      
      export MANAGEMENT_DB_SERVER_HOST=localhost
      export MANAGEMENT_DB_SERVER_PORT=8252
      export MANAGEMENT_DB_USERNAME=admin
      export MANAGEMENT_DB_PASSWORD=admin
      
    • If you are on Windows platform, edit conf/setenv.bat and add/update env variables exports as shown below.
      set EG_MULTIPLE_DATASETS=false
      set DB_IMPLEMENTATION=marklogic_triplestore
      set DB_SERVER_REPOSITORY_AUTOCREATE=false
      set MANAGEMENT_DB_IMPLEMENTATION=marklogic_triplestore
      set MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      set SPRING_PROFILES_ACTIVE=marklogic_triplestore
      
      set DB_SERVER_HOST=localhost
      set DB_SERVER_PORT=8251
      set DB_USERNAME=admin
      set DB_PASSWORD=admin
      
      set MANAGEMENT_DB_SERVER_HOST=localhost
      set MANAGEMENT_DB_SERVER_PORT=8252
      set MANAGEMENT_DB_USERNAME=admin
      set MANAGEMENT_DB_PASSWORD=admin
      
    • Start EasyGraph.

    If you have changed port, username or password then make sure you set the EasyGraph properties accordingly.

    We have tested EasyGraph with MarkLogic version 10.0-6.3

    For default EasyGraph username and password see RDF4J

    Once you have EasyGraph running follow the steps in Bootstrap

    Apache Jena Fuseki

    EasyGraph can be configured to store data in Fuseki. Below are the steps to run EasyGraph with Fuseki.

    • Run all the steps mentioned in RDF4J native store section and make sure EasyGraph starts up without any error.
    • Start Fuseki with flag tdb:unionDefaultGraph=true. Below is the full command and for more details see https://jena.apache.org/documentation/tdb/configuration.html
      ./fuseki-server --set tdb:unionDefaultGraph=true
    • If you are on OSX/Linux platform, edit conf/setenv.sh and add/update env variables exports as shown below.
      export EG_MULTIPLE_DATASETS=true
      export DB_IMPLEMENTATION=fuseki_triplestore_multiuser
      export MANAGEMENT_DB_IMPLEMENTATION=fuseki_triplestore
      export SPRING_PROFILES_ACTIVE=fuseki_triplestore_multiuser
      
      export DB_SERVER_URL=http://localhost:3030/
      export DB_SERVER_REPOSITORYID=egData
      
      export MANAGEMENT_DB_SERVER_URL=http://localhost:3030/
      export MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      
      
      To run in single dataset mode add/update env variables exports as shown below.
      export EG_MULTIPLE_DATASETS=false
      export DB_IMPLEMENTATION=fuseki_triplestore
      export MANAGEMENT_DB_IMPLEMENTATION=fuseki_triplestore
      export SPRING_PROFILES_ACTIVE=fuseki_triplestore
      
      export DB_SERVER_URL=http://localhost:3030/
      export DB_SERVER_REPOSITORYID=egData
      
      export MANAGEMENT_DB_SERVER_URL=http://localhost:3030/
      export MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      
      
    • If you are on Windows platform, edit conf/setenv.bat and add/update env variables exports as shown below.
      set DB_IMPLEMENTATION=fuseki_triplestore_multiuser
      set MANAGEMENT_DB_IMPLEMENTATION=fuseki_triplestore
      set SPRING_PROFILES_ACTIVE=fuseki_triplestore_multiuser
      
      set DB_SERVER_URL=http://localhost:3030/
      set DB_SERVER_REPOSITORYID=egData
      
      set MANAGEMENT_DB_SERVER_URL=http://localhost:3030/
      set MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      
      To run in single dataset mode add/update env variables exports as shown below.
      set EG_MULTIPLE_DATASETS=false
      set DB_IMPLEMENTATION=fuseki_triplestore
      set MANAGEMENT_DB_IMPLEMENTATION=fuseki_triplestore
      set SPRING_PROFILES_ACTIVE=fuseki_triplestore
      
      set DB_SERVER_URL=http://localhost:3030/
      set DB_SERVER_REPOSITORYID=egData
      
      set MANAGEMENT_DB_SERVER_URL=http://localhost:3030/
      set MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      
      
    • Start EasyGraph.

    This section assumes you are running Fuseki with default settings. If you have changed port then make sure you set the EasyGraph properties accordingly.

    We have tested EasyGraph with Fuseki version 3.16.0

    For default EasyGraph username and password see RDF4J

    Once you have EasyGraph running follow the steps in Bootstrap

    GraphDB

    EasyGraph can be configured to store data in GraphDB. Below are the steps to run EasyGraph with GraphDB.

    • Run all the steps mentioned in RDF4J native store section and make sure EasyGraph starts up without any error.
    • Start GraphDB and create a new repository. In "Repository ID" field enter "egData", in the "Repository title" field enter "egData". In the "Ruleset" field select "No inference". Enable context index by selecting "Use context index" checkbox and click create button to create the repository.
    • Create another repository and In "Repository ID" field enter "egmManagement", in the "Repository title" field enter "egmManagement". In the "Ruleset" field select "No inference". Enable context index by selecting "Use context index" checkbox and click create button to create the repository.
    • If you are on OSX/Linux platform, edit conf/setenv.sh and add/update env variables exports as shown below.
      export EG_MULTIPLE_DATASETS=false
      export DB_IMPLEMENTATION=sparql_http_triplestore
      export DB_SERVER_REPOSITORY_AUTOCREATE=false
      export MANAGEMENT_DB_IMPLEMENTATION=sparql_http_triplestore
      export MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      export SPRING_PROFILES_ACTIVE=sparql_http_triplestore
      
      export DB_SERVER_URL=http://localhost:7200/
      export DB_SERVER_REPOSITORYID=egData
      
      export MANAGEMENT_DB_DB_SERVER_URL=http://localhost:7200/
      export MANAGEMENT_DB_DB_SERVER_REPOSITORYID=egData
      
    • If you are on Windows platform, edit conf/setenv.bat and add/update env variables exports as shown below.
      set EG_MULTIPLE_DATASETS=false
      set DB_IMPLEMENTATION=sparql_http_triplestore
      set DB_SERVER_REPOSITORY_AUTOCREATE=false
      set MANAGEMENT_DB_IMPLEMENTATION=sparql_http_triplestore
      set MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      set SPRING_PROFILES_ACTIVE=sparql_http_triplestore
      
      set DB_SERVER_URL=http://localhost:7200/
      set DB_SERVER_REPOSITORYID=egData
      
      set MANAGEMENT_DB_DB_SERVER_URL=http://localhost:7200/
      set MANAGEMENT_DB_DB_SERVER_REPOSITORYID=egmManagement
      
    • Start EasyGraph.

    This section assumes you are running GraphDB with default settings. If you have changed GraphDB port then make sure you set the EasyGraph properties accordingly.

    We have tested EasyGraph with GraphDB version 9.7.0

    For default EasyGraph username and password see RDF4J

    Once you have EasyGraph running follow the steps in Bootstrap

    SPARQL HTTP repository

    EasyGraph can be configured to run with any store which provides SPARQL HTTP repository. Please see GraphDB section above. You just need to set the properties to point to SPARQL endpoint.

    AWS Neptune(SPARQL Endpoint)

    EasyGraph can be configured to run with SPARQL endpoint. For example using this setup you can use AWS Neptune as backend.

    • Run all the steps mentioned in RDF4J native store section and make sure EasyGraph starts up without any error.
    • From the AWS Console create a new Neptune Database.
    • Download and copy EasyGraph to instance which can connect to Neptune SPARQL endpoint.
    • If you are on OSX/Linux platform, edit conf/setenv.sh and add/update env variables exports as shown below. Replace value {WRITE_ENDPOINT_NAME} with Neptune endpoint name
      export EG_MULTIPLE_DATASETS=false
      export DB_IMPLEMENTATION=sparql_endpoint_triplestore
      export DB_SERVER_REPOSITORY_AUTOCREATE=false
      export MANAGEMENT_DB_IMPLEMENTATION=rdf4j_nativestore_triplestore
      export MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=true
      export SPRING_PROFILES_ACTIVE=sparql_endpoint_triplestore
      
      export DB_SERVER_URL=https://{WRITE_ENDPOINT_NAME}:8182/sparql
      
      export MANAGEMENT_RDF4J_NATIVESTORE_FILEPATH=data
      export MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      
      
      If you want to store user data AWS Neptune database, just create another database and edit/override as below. Replace value {WRITE_ENDPOINT_NAME} and {MANAGEMENT_WRITE_ENDPOINT_NAME} with Neptune endpoints.
      export EG_MULTIPLE_DATASETS=false
      export DB_IMPLEMENTATION=sparql_endpoint_triplestore
      export DB_SERVER_REPOSITORY_AUTOCREATE=false
      export MANAGEMENT_DB_IMPLEMENTATION=sparql_endpoint_triplestore
      export MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      export SPRING_PROFILES_ACTIVE=sparql_endpoint_triplestore
      
      export DB_SERVER_URL=https://{WRITE_ENDPOINT_NAME}:8182/sparql
      
      export MANAGEMENT_DB_SERVER_URL=https://{MANAGEMENT_WRITE_ENDPOINT_NAME}:8182/sparql
      
      
    • If you are on Windows platform, edit conf/setenv.bat and add/update env variables exports as shown below.
      set EG_MULTIPLE_DATASETS=false
      set DB_IMPLEMENTATION=sparql_endpoint_triplestore
      set DB_SERVER_REPOSITORY_AUTOCREATE=false
      set MANAGEMENT_DB_IMPLEMENTATION=rdf4j_nativestore_triplestore
      set MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=true
      set SPRING_PROFILES_ACTIVE=sparql_endpoint_triplestore
      
      set DB_SERVER_URL=https://{WRITE_ENDPOINT_NAME}:8182/sparql
      
      set MANAGEMENT_RDF4J_NATIVESTORE_FILEPATH=data
      set MANAGEMENT_DB_SERVER_REPOSITORYID=egmManagement
      
      If you want to store user data AWS Neptune database, just create another database and edit/override as below. Replace value {WRITE_ENDPOINT_NAME} and {MANAGEMENT_WRITE_ENDPOINT_NAME} with Neptune endpoints.
      set EG_MULTIPLE_DATASETS=false
      set DB_IMPLEMENTATION=sparql_endpoint_triplestore
      set DB_SERVER_REPOSITORY_AUTOCREATE=false
      set MANAGEMENT_DB_IMPLEMENTATION=sparql_endpoint_triplestore
      set MANAGEMENT_DB_SERVER_REPOSITORY_AUTOCREATE=false
      set SPRING_PROFILES_ACTIVE=sparql_endpoint_triplestore
      
      set DB_SERVER_URL=https://{WRITE_ENDPOINT_NAME}:8182/sparql
      
      set MANAGEMENT_DB_SERVER_URL=https://{MANAGEMENT_WRITE_ENDPOINT_NAME}:8182/sparql
      
      
    • Start EasyGraph.

    For default EasyGraph username and password see RDF4J

    As Neptune endpoint is HTTPS you can't use tunnel only to connect from your local. You will need to setup tunnel and hostname. Please see https://serverfault.com/questions/347499/how-to-assign-a-hostname-to-ssh-tunnel .

    Once you have EasyGraph running follow the steps in Bootstrap

    Try In AWS

    If you have some basic idea of how to launch stack in AWS using cloudformation, You can launch EasyGraph in you own AWS account for trial. This is useful if you want to try EasyGraph with large instances and upload bigger datasets. This also gives you quick idea about how you can set up EasyGraph in cloud. Please note that the cost to you will depend on the configuration you choose and as the setup will be running in your account you will be paying for it.

    Cloud formation templates we provide are for trial only and setup is not secure. If you need help for production setup or want to try EasyGraph in a secure setup, please get in touch with us.

    Quick Start

    To launch stack, follow the steps in Quick start section and login to your account. On the account home page choose Try In AWS option.

    Image
    • On the form choose region.
    • Choose setup type. You have 3 options. Please click the select field and see the description of the each option.
    • Create a SSH Key in your AWS account in the region where you want to setup EasyGraph and enter its name on the form field.
    • Depending on the option you choose form might show/hide some extra configuration options.
    • Screen shot below shows above settings
    • Image
    • Click LAUNCH STACK button. Please read our Terms and Condition and if you are happy click Accept button. This should open a new tab in your browser.
    • In the new tab you might need to login to your AWS account. Once logged in you should be redirected to "Quick create stack" page in AWS. Screen shot below shows the AWS page.
    • Image
    • As shown below, click checkboxes in the capabilities section at the bottom of the page.
    • Image
    • Click "Create Stack" button.
    • Once the stack is created you should see main stack along with nested stacks as shown below.
    • Image
    • Go to the instances page in AWS console and get the IP address of EasyGraph instance as shown below.
    • Image
    • Copy the public IP of the instance and paste it into the browser. You should see login page as shown below. If the login page does not show up, wait for 10 minutes and retry. It might take a while for EasyGraph and backend database to start.
    • Image

      For default EasyGraph username and password see RDF4J

      Once you have EasyGraph running follow the steps in Bootstrap

      To delete the stack just delete main stack from AWS console.

      Please note that this setup is not secure. If you need help for production setup or want to try EasyGraph in a secure setup, please get in touch with us.

    Setup with AWS API Gateway

    AWS API Gateway has lots of features to control Caching, API throttling and Security etc. If you want to setup AWS API Gateway in front of EasyGraph fill rest of the form as explained in previous section, expand "Advanced Settings" block and click "Create API Gateway" as shown in screen shot below.

    Image

    Create stack and once the stack creation is complete you can get the endpoint to access EasyGraph as shown in the screen shot below. The screen shot also shows all the nested stacks as well.

    Image

    Click on the URL in outputs. This should open EasyGraph login page. If you do not see the login page wait for 10 minutes and refresh.

    For default EasyGraph username and password see RDF4J

    Once you have EasyGraph running follow the steps in Bootstrap

    Please note that although communication with API gateway is over HTTPs still this setup is not secure. If you need help for production setup or want to try EasyGraph in a secure setup, please get in touch with us.

    Two availability zones with Apache Jena Fuseki

    For resilience and high availability select "Two AZ With Apache Jena Fuseki" option in the "Choose Setup Type" field. In this setup Fuseki data is stored on AWS EFS and EasyGraph instances are spread across two availability zones. Still there is one Fuseki instance but if one availability zone goes down AWS autoscaling brings up another Fuskei instance in another availability zone. As Fuseki data is stored in EFS the file system automatically gets mounted to the data directory of new instance.

    As there are more than one EasyGraph instances in this setup, a load balancer is also created to distribute the traffic.

    If you want you can also setup AWS API gateway with this setup from the "Advanced Settings" block.

    This setup is for trial only and not suitable for production due to security reasons. Also note that this setup will cost more in comparison to setup in previous section as it creates more AWS resources.

    Two availability zones with AWS Neptune

    For highest level of resilience and very high availability select "Two AZs With AWS Neptune" option in the "Choose Setup Type" field. In this setup AWS Neptune is used as backend to store all the data. You can also setup database replica by clicking "Create Replica" field under the "Database Configuration".

    This setup is for trial only and not suitable for production due to security reasons. Also note that this setup will cost more in comparison to setup in previous sections as it creates more AWS resources and cost of AWS Neptune adds up into the cost.

    Advanced Settings

    By using settings in this section you can setup EasyGraph in a secure manner.

    If you have a domain and you have HTTPS certificate managed in AWS certificate manager then you can specify the certificate ARN in "SSL Certificate ARN" field. This certificate will be used by the ELB for TLS. Then you can point the domain to ELB DNA created by the stack. You will also need to specify the same domain URL in "API Base URL" field.

    EasyGraph use JWT for authentication. You can store JWT secret key in AWS Secret Manager and specify the ARN of the secret manager in "Secret Manager ARN" field. Screen shot below shows how the value should be in Secret Manager.

    Image

    If Secret Manager ARN value is specified, IAM permissions are given to EasyGraph instance to access Secret Manager and startup script loads this key into EasyGraph.

    With advanced settings EasyGraph setup is fairly secure. If there is requirement for even higher level of security please get in touch with us.