Stardog api for bulk loading


(rakesh) #1

Hi,

We are currently using Database builder for Bulk data load in stardog. Below code throws an error if database is already exist. Please can you advise how we can progress even if database is already exist.

We are basically want to load bulk data on existing database. Please share your inputs on this.Thanks

val adminConnection = AdminConnectionConfiguration
.toServer(endPoint)
.credentials(connConfig.username, connConfig.password)
.connect()
adminConnection.builder(
Metadata.create()
.set(DatabaseOptions.NAME, “db name”)
).copyServerSide()
.create(Paths.get(dataFilePath))


(stephen) #2

Hi,

You would simply need to use the data add capabilities of the regular Connection API, as you cannot create a database that already exists:

try (Connection c = ConnectionConfiguration.to("myDb").server("http://localhost:5820").credentials("admin", "admin").connect()) {
			c.begin();
			c.add().io().file(dataFilePath);
			c.commit();
		}

(zachary.whitley) #3

I you can’t bulk load into an existing database. I believe that bulk loading relies on this condition to do what it does. You can do a regular load or depending on how much data you have in there already you can dump the existing data, bulk load, and then reload the previous data.


(rakesh) #4

It is working fine. Thanks a lot for quick solution.


(system) #5

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.