Git Product home page Git Product logo

Comments (13)

krishnangovindraj avatar krishnangovindraj commented on June 12, 2024

The version you are using is extremely outdated, so the url of the repository has changed.
The artifact should still available at https://repo.vaticle.com/repository/maven/

I also see you're using TypeDB 2.21? If so, you should be using the TypeDB client:
https://typedb.com/docs/clients/2.x/java/java-install
The modern equivalent of Grami is TypeDB loader: https://github.com/typedb-osi/typedb-loader

from typedb.

krishnangovindraj avatar krishnangovindraj commented on June 12, 2024

Closing this. Please, re-open if needed.

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

This still doesn't resolve my issue.

I am running typedb server in dcoker container.
2023-10-03 21:41:07 01:41:07.804 [main] INFO com.vaticle.typedb.core.server.TypeDBServer - version: 2.21.1

maven pom.xml

`

<repositories>
    <repository>
        <id>repo.vaticle.com</id>
        <url>https://repo.vaticle.com/repository/maven/</url>
    </repository>
</repositories>
<dependencies>
    <dependency>
        <groupId>com.vaticle.typedb</groupId>
        <artifactId>typedb-client</artifactId>
        <version>2.18.0</version>
    </dependency>
</dependencies>

`

java code:

`
package org.example;

import cli.LoadOptions;
import loader.TypeDBLoader;

public class LoadingData {

public void loadData() {
    String uri = "localhost:1729";
    String config = "dataConfig.json";
    String database = "databaseName";

    String[] args = {
            "load",
            "-tdb", uri,
            "-c", config,
            "-db", database,
            "-cm"
    };

    LoadOptions options = LoadOptions.parse(args);
    TypeDBLoader loader = new TypeDBLoader(options);
    loader.load();
}

}
`
Not able to resolve the LoadOptions and TypeDBLoader objects in this java code.

from typedb.

jamesreprise avatar jamesreprise commented on June 12, 2024

Ensure that the osi-maven repository is also added:

<repository>
    <id>typedb</id>
    <url>https://repo.vaticle.com/repository/osi-maven/</url>
</repository>

and that you've declared the loader dependency:

<dependency>
    <groupId>com.vaticle.typedb-osi</groupId>
    <artifactId>typedb-loader</artifactId>
    <version>1.2.0</version>
</dependency>

See the full instructions: https://github.com/typedb-osi/typedb-loader/wiki/09-TypeDB-Loader-as-Dependency

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

I used same pom.xml as described in the instructions provided by you;

"""


typedb
https://repo.vaticle.com/repository/maven/


typedb
https://repo.vaticle.com/repository/osi-maven/


jitpack.io
https://jitpack.io

<dependencies>
    <dependency>
        <groupId>com.vaticle.typedb-osi</groupId>
        <artifactId>typedb-loader</artifactId>
        <version>1.2.0</version>
    </dependency>
</dependencies>

"""

Still the same issue.

from typedb.

jamesreprise avatar jamesreprise commented on June 12, 2024

From your code:

package org.example;
import cli.LoadOptions;
import loader.TypeDBLoader;

I think these import paths are not specific enough. Can you try importing these by a full-er path, i.e. com.vaticle.typedb.osi.loader.cli.LoadOptions? Likewise for the Loader itself, something like com.vaticle.typedb.osi.loader.loader.TypeDBLoader.

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

pom.xml

`

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.example</groupId>
    <artifactId>datamigration</artifactId>
    <version>1.0-SNAPSHOT</version>

    <properties>
        <maven.compiler.source>20</maven.compiler.source>
        <maven.compiler.target>20</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <repositories>
        <repository>
            <id>repo.vaticle.com</id>
            <url>https://repo.vaticle.com/repository/maven/</url>
        </repository>

        <repository>
            <id>typedb</id>
            <url>https://repo.vaticle.com/repository/osi-maven/</url>
        </repository>

    </repositories>
    <dependencies>
        <dependency>
            <groupId>com.vaticle.typedb</groupId>
            <artifactId>typedb-client</artifactId>
            <version>2.18.0</version>
        </dependency>

        <dependency>
            <groupId>com.vaticle.typedb-osi</groupId>
            <artifactId>typedb-loader</artifactId>
            <version>1.2.0</version>
        </dependency>

    </dependencies>

</project>

`

Java code:

`package org.example;

import com.vaticle.typedb.osi.loader.cli.LoadOptions;
import com.vaticle.typedb.osi.loader.loader.TypeDBLoader;

public class LoadingData {

public void loadData() {
    String uri = "localhost:1729";
    String config = "dataConfig.json";
    String database = "databaseName";

    String[] args = {
            "load",
            "-tdb", uri,
            "-c", config,
            "-db", database,
            "-cm"
    };

    LoadOptions options = LoadOptions.parse(args);
    TypeDBLoader loader = new TypeDBLoader(options);
    loader.load();
}

}
`

Error

Cannot resolve symbol 'osi'
Cannot resolve symbol 'LoadOptions'
Cannot resolve symbol 'TypeDBLoader'

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

krishnangovindraj This issue isn't resolved, can you please help ?

from typedb.

krishnangovindraj avatar krishnangovindraj commented on June 12, 2024

@krish-yadav23 Could you try version 1.7.0 for typebd-loader please?
That seems to work for me.

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

Thank you krishnangovindraj , i was able to proceed. However, i am now facing below issue while dumping data from csv file.

Inside Loading data11:37:20.488 [main] INFO com.vaticle.typedb.osi.loader.loader - validating your config... Exception in thread "main" java.lang.NullPointerException: Cannot invoke "com.vaticle.typedb.osi.loader.config.Configuration$GlobalConfig.getSchema()" because the return value of "com.vaticle.typedb.osi.loader.config.Configuration.getGlobalConfig()" is null at com.vaticle.typedb.osi.loader.config.ConfigurationValidation.validateSchemaPresent(ConfigurationValidation.java:287) at com.vaticle.typedb.osi.loader.loader.TypeDBLoader.load(TypeDBLoader.java:52) at org.example.LoadingData.loadData(LoadingData.java:21) at org.example.Main.main(Main.java:9)

`

My Config file

{
"Instructor": {
"dataPath": "D:\TypedbWorkspace\dataFiles\entity_example.csv",
"separator": ",",
"processor": "Instructor",
"batchSize": 2000,
"threads": 4,
"attributes": [
{
"columnName": "id",
"generator": "id"
},
{
"columnName": "email",
"generator" : "email"
},
{
"columnName": "firstname",
"generator": "firstname"
},
{
"columnName": "lastname",
"generator": "lastname"
}]
}
}
`

from typedb.

krishnangovindraj avatar krishnangovindraj commented on June 12, 2024

I think the config file structure may have changed to include the schema.
Please refer to the wiki for typedb-loader: https://github.com/typedb-osi/typedb-loader/wiki/01-Global-Configuration

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

Okay, i tried that and now facing issue saying file not found.

{
   "globalConfig":{
      "separator":",",
      "rowsPerCommit":50,
      "parallelisation":4,
      "schema":"src/test/resources/eduSchema.gql"
   },
   "entities":{
      "Instructor":{
         "data":[
            "src/test/resources/entity_instructor.csv",
         ],
         "config":{
            "separator":",",
            "rowsPerCommit":50
         },
         "insert":{
            "entity":"Instructor",
            "ownerships":[
               {
                  "attribute":"id",
                  "generator":"id",
                  "required":false
               },
               {
                  "attribute":"email",
                  "generator":"email",
                  "required":false
               },
               {
                  "attribute":"firstname",
                  "generator":"firstname",
                  "required":false
               },
               {
                  "attribute":"lastname",
                  "generator":"lastname",
                  "required":false
               }
            ]
         }
      }
   }
}

Config file set in java code:
String config = "D:\Typedb Workspace\dataConfig.json";

Error:

14:30:36.835 [main] INFO  com.vaticle.typedb.osi.loader.loader - validating your config...
14:30:37.276 [main] WARN  com.vaticle.typedb.osi.loader.loader - defaultConfig.parallelisation is not set - defaults to number of processors on machine * 8
14:30:37.276 [main] ERROR com.vaticle.typedb.osi.loader.loader - entities.Instructor.data: <null>: file not found

Files are already present on my windows machine in src/test/resources/
Is this how it expects file paths? can't we give absolute paths if relative paths are not working?

from typedb.

devkrish23 avatar devkrish23 commented on June 12, 2024

I was able to dump data in typedb after making changes to the config file.

{
   "globalConfig":{
      "separator":",",
      "rowsPerCommit":50,
      "parallelisation":4,
      "schema":"src/test/resources/eduSchema.gql"
   },
   "entities":{
      "Instructor":{
         "data":[
            "src/test/resources/entity_instructor.csv"
         ],
         "config":{
            "separator":",",
            "rowsPerCommit":50
         },
         "insert":{
            "entity":"Instructor",
            "ownerships":[
               {
                  "attribute":"id",
                  "column":"id",
                  "required":false
               },
               {
                  "attribute":"email",
                  "column":"email",
                  "required":false
               },
               {
                  "attribute":"firstname",
                  "column":"firstname",
                  "required":false
               },
               {
                  "attribute":"lastname",
                  "column":"lastname",
                  "required":false
               }
            ]
         }
      }
   }
}

Thank you krishnangovindraj, jamesreprise for your help.

from typedb.

Related Issues (20)

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.