Giter Club home page Giter Club logo

ogma-linkurious-parser's Introduction

Ogma-Linkurious-Parser

Description

Ogma-Linkurious-Parser is an official library maintained by the Linkurious team that allows you to quickly parse and load a Linkurious Enterprise visualization in Ogma with one line of code and apply different Linkurious Enterprise styles, filters, captions and more.

Prerequisites

  • Linkurious Enterprise 2.10.x or above
  • An existing visualization to export
  • An Ogma license

Installation

npm install @linkurious/ogma-linkurious-parser

Usage

In order to create an Ogma visualization with your Linkurious styles:

  1. Get your visualization using Linkurious Enterprise REST API.

  2. Get Linkurious Enterprise configuration using Linkurious Enterprise REST API.

  3. If you need to reproduce the same caption styles, get graph schema using Linkurious Enterprise REST API.

  4. Initialize LKOgma and call initVisualization with the configuration and the visualization data from the previous steps. You can also pass a base url as second parameter in case you are using relative paths in your image style urls.

A full working example using the Linkurious Enterprise REST API library:

const {RestClient} = require('@linkurious/rest-client');
const {LKOgma} = require('@linkurious/ogma-linkurious-parser');

async function main() {

  // Initialize the rest client
  const rc = new RestClient({baseUrl: 'http://localhost:3000'});
  // Log in
  await rc.auth.login({
    usernameOrEmail: 'your-username',
    password: 'your-password'
  });
  // Get linkurious configuration response
  const linkuriousConfigurationResponse = await rc.config.getConfiguration();
  // Get the visualisation configuration response
  const visualizationResponse = await rc
    .visualization.getVisualization({
      sourceKey: 'e7900d9b',
      id: 3
    });
  const nodeTypesResponse = await this.rc.graphSchema.getTypesWithAccess({
    entityType: 'node'
  });
  const edgeTypesResponse = await this.rc.graphSchema.getTypesWithAccess({
    entityType: 'edge'
  });

  if (linkuriousConfigurationResponse.isSuccess() && visualizationResponse.isSuccess() && nodeTypesResponse.isSuccess() && edgeTypesResponse.isSuccess()) {
    const ogmaConfiguration = linkuriousConfigurationResponse.body.ogma;
    const lkeServerBaseUrl = linkuriousConfigurationResponse.body.url;
    const graphSchema = {
      node: nodeTypesResponse.body.node.results,
      edge: edgeTypesResponse.body.edge.results
    }
    const visualizationConfiguration = visualizationResponse.body;
    // Initialize ogma object
    const ogma = new LKOgma(
      {
        ...ogmaConfiguration,
        options: {
          ...ogmaConfiguration.options,
          backgroundColor: 'rgba(240, 240, 240)'
        }
      },
      // the base url is an optional parameter
      lkeServerBaseUrl
    );
    // Set HTML container where Ogma will be rendered
    ogma.setContainer('graph-container');
    // Set graphSchema that will be used in defining caption styles
    ogma.LKCaptions.graphSchema = graphSchema;
    // Initialize the visualization content & styles
    await ogma.initVisualization(visualizationConfiguration);
  }
}

main();

You can use any other Ogma feature you would like to apply to the visualization.

To learn more about Ogma check our official documentation.

Licensing

The Ogma-Linkurious-parser is licensed under the Apache License, Version 2.0. See LICENSE for the full license text.

ogma-linkurious-parser's People

Contributors

aminerhanemi avatar amrsobhy avatar davidrapin avatar diachk avatar enys avatar ericmallard avatar fantandrea avatar gmasclet avatar hsenbassam avatar kraamel avatar leo-nicolle avatar linkurious-infra avatar maxime-allex avatar mzorkany avatar pierre-etienne-deutsch avatar renovate[bot] avatar w8r avatar yigitakbulut avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

isabella232

ogma-linkurious-parser's Issues

Action Required: Fix Renovate Configuration

There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.

Location: .github/renovate.json
Error type: Duplicate keys in JSON
Message: "Syntax error: duplicated keys \"packageRules\" near ules\": [\n "

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Repository problems

These problems occurred while renovating this repository. View logs.

  • WARN: Base branch does not exist - skipping

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • Update dependency @types/sha1 to v1.1.5 (develop-maintenance)
  • Update dependency eslint-plugin-prettier to v3.4.1 (develop-maintenance)
  • Update dependency mocha to v9.2.2 (develop-maintenance)
  • Update dependency node to v18.20.4 (develop-maintenance)
  • Update dependency ts-node to v10.9.2 (develop-maintenance)
  • Update dependency typescript to v4.9.5 (develop-maintenance)
  • Update dependency @linkurious/ogma to v4.6.6 (develop-maintenance)
  • Update dependency @linkurious/rest-client to ~4.1.0 (develop-maintenance)
  • Update dependency @rollup/plugin-commonjs to v17.1.0 (develop-maintenance)
  • Update dependency @rollup/plugin-node-resolve to v11.2.1 (develop-maintenance)
  • Update dependency @types/lodash to v4.17.7 (develop-maintenance)
  • Update dependency chai to v4.5.0 (develop-maintenance) (chai, @types/chai)
  • Update dependency eslint-config-prettier to v6.15.0 (develop-maintenance)
  • Update dependency eslint-plugin-import to v2.29.1 (develop-maintenance)
  • Update dependency mocha-junit-reporter to v2.2.1 (develop-maintenance)
  • Update dependency prettier to v2.8.8 (develop-maintenance)
  • Update dependency rollup to v2.79.1 (develop-maintenance)
  • Update dependency rollup-plugin-typescript2 to v0.36.0 (develop-maintenance)
  • Update dependency should to v11.2.1 (develop-maintenance)
  • Update typescript-eslint monorepo to v2.34.0 (develop-maintenance) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • Update dependency @linkurious/ogma to v5.1.2 (develop-stable)
  • Update dependency @linkurious/rest-client to v4.1.2-master-stable.1 (develop-stable)
  • Update dependency eslint-plugin-import to v2.29.1 (develop-stable)
  • Update dependency eslint-plugin-prettier to v3.4.1 (develop-stable)
  • Update dependency mocha to v9.2.2 (develop-stable)
  • Update dependency ts-node to v10.9.2 (develop-stable)
  • Update dependency typescript to v4.9.5 (develop-stable)
  • Update dependency @rollup/plugin-commonjs to v17.1.0 (develop-stable)
  • Update dependency @rollup/plugin-node-resolve to v11.2.1 (develop-stable)
  • Update dependency @types/lodash to v4.17.7 (develop-stable)
  • Update dependency eslint-config-prettier to v6.15.0 (develop-stable)
  • Update dependency mocha-junit-reporter to v2.2.1 (develop-stable)
  • Update dependency node to v20.16.0 (develop-stable)
  • Update dependency prettier to v2.8.8 (develop-stable)
  • Update dependency rollup to v2.79.1 (develop-stable)
  • Update dependency rollup-plugin-typescript2 to v0.36.0 (develop-stable)
  • Update dependency should to v11.2.1 (develop-stable)
  • Update typescript-eslint monorepo to v7.18.0 (develop-stable) (@typescript-eslint/eslint-plugin, @typescript-eslint/parser)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Detected dependencies

Branch develop-maintenance
npm
package.json
  • lodash 4.17.21
  • rxjs 7.8.1
  • sha1 1.1.1
  • @linkurious/ogma 4.5.9
  • @linkurious/rest-client ~4.0.30-develop-maintenance.15
  • @rollup/plugin-buble 0.21.3
  • @rollup/plugin-commonjs 17.0.0
  • @rollup/plugin-json 4.1.0
  • @rollup/plugin-node-resolve 11.0.1
  • @types/chai 4.2.17
  • @types/lodash 4.14.182
  • @types/mocha 5.2.7
  • @types/sha1 1.1.2
  • @typescript-eslint/eslint-plugin 2.25.0
  • @typescript-eslint/parser 2.25.0
  • chai 4.3.4
  • eslint 6.8.0
  • eslint-config-prettier 6.10.1
  • eslint-plugin-import 2.22.1
  • eslint-plugin-prettier 3.4.0
  • mocha 9.2.0
  • mocha-junit-reporter 2.0.2
  • mocha-multi-reporters 1.5.1
  • nyc 15.1.0
  • prettier 2.2.1
  • rollup 2.47.0
  • rollup-plugin-node-globals 1.4.0
  • rollup-plugin-typescript2 0.29.0
  • should 11.1.0
  • ts-node 10.9.1
  • typescript 4.9.4
  • @linkurious/ogma 4.5.9
  • node 18.20.1
nvm
.nvmrc
  • node 18.20.1
Branch develop-stable
npm
package.json
  • lodash 4.17.21
  • rxjs 7.8.1
  • sha1 1.1.1
  • @linkurious/ogma 5.1.1
  • @linkurious/rest-client 4.1.2-develop-stable.198
  • @rollup/plugin-buble 0.21.3
  • @rollup/plugin-commonjs 17.0.0
  • @rollup/plugin-json 4.1.0
  • @rollup/plugin-node-resolve 11.0.1
  • @types/chai 4.2.17
  • @types/lodash 4.14.182
  • @types/mocha 5.2.7
  • @types/sha1 1.1.2
  • @typescript-eslint/eslint-plugin 7.13.1
  • @typescript-eslint/parser 7.13.1
  • chai 4.3.4
  • eslint 8.57.0
  • eslint-config-prettier 6.10.1
  • eslint-plugin-import 2.29.0
  • eslint-plugin-prettier 3.4.0
  • mocha 9.2.0
  • mocha-junit-reporter 2.0.2
  • mocha-multi-reporters 1.5.1
  • nyc 15.1.0
  • prettier 2.2.1
  • rollup 2.47.0
  • rollup-plugin-node-globals 1.4.0
  • rollup-plugin-typescript2 0.29.0
  • should 11.1.0
  • ts-node 10.9.1
  • typescript 4.9.4
  • @linkurious/ogma 5.1.1
  • node 20.14.0
nvm
.nvmrc
  • node 20.14.0

  • Check this box to trigger a request for Renovate to run again on this repository

Code review from Ogma perspective

tsconfig

package.json

  • ./nobe_modules/.bin ... stuff in package.json is to avoid calling the globally installed packages? Don't the local versions have the priority?
  • bump2version stuff can be ambiguous for external people
  • tests are not linted

src/index.ts

src/tools/tools.ts

src/tools/ogmaTool.ts

src/styles/itemAttributes.ts

ogma-helper/src/styles/nodeAttributes.ts

src/styles/edgeAttributes.ts

src/styles/styleRule.ts

src/ogma/index.ts

src/ogma/features/reactive.ts

src/ogma/features/selectors.ts

Good style, that's what I suggested before for namespaces

src/captions/captions.ts

src/ogma/features/styles.ts

src/filters/filters.ts

@francescoinfante @aminerhanemi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.