I am sorry for mistake.
It should be
Dataset dbdataset = TDB2Factory.connectDataset("dataset");
“dataset” is the location of the TDB2.And I also tried assembler file without
working well.
Thanks!
Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
________________________________
From: Andy Seaborne <[email protected]>
Sent: Tuesday, June 18, 2019 6:34:10 PM
To: [email protected]
Subject: Re: Command-line tools and JAVA API
On 18/06/2019 10:36, Scarlet Remilia wrote:
> Hello everyone,
>
> I bulk load some RDF files into a TDB2 in my Java code, like,
> Runtime.getRuntime().exec(“tdb2.tdbloader --loc=dataset --loader=parallel
> a.rdf b.rdf c.rdf”);
>
> But when I connect to the dataset by java API, like
> Dataset dbdataset = TDB2Factory.assembleDataset("dataset");
TDB2Factory.connectDataset
I get an error with "assembleDataset"
11:32:00 WARN LocatorFile :: File unreadable (but
exists): dataset Exception: dataset (Is a directory)
Exception in thread "main" org.apache.jena.sparql.ARQException: Failed
reading assembler description: Not found: dataset
> I get a empty dataset, and cannot query any data.
> Further, I add some data into the same TDB2 by java api, like
> dbdataset.begin(ReadWrite.WRITE);
> UpdateRequest updateRequest = UpdateFactory.create(
> "PREFIX dc: <http://purl.org/dc/elements/1.1/>\n" +
> "INSERT DATA\n" +
> "{ \n" +
> " <http://example/book1> dc:title \"A new book\"
> ;\n" +
> " dc:creator \"A.N.Other\"
> .\n" +
> "}");
> UpdateProcessor updateProcessor =
> UpdateExecutionFactory.create(updateRequest, dbdataset);
> updateProcessor.execute();
> dbdataset.commit();
> dbdataset.close();
> I can query the data of book1 only by java api, and tdb2.tdbquery commandline
> tool can query all data include book1 and RDF files.
>
> So how to make it work?
>
> Btw, is there any tdb2 tdbloaer Java API?
>
>
> Thank you very much
>
> Jason
>
> Sent from Mail<https://go.microsoft.com/fwlink/?LinkId=550986> for Windows 10
>
>