I do something like this:

OntModel memoryModel = ...;

VirtModel model = null;
try {
 model =
VirtModel.openDatabaseModel(graphURI,virtuosoURL,virtuosoUser,virtuosoPassword);
 model.begin();
 model.removeAll();
 model.add(memoryModel);
 model.commit();
} catch (Exception e) {
 if (model != null) model.abort();
} finally {
 if (model != null) model.close();
}



On Wed, Jan 15, 2014 at 3:02 PM, Andra Waagmeester <
andra.waagmees...@gmail.com> wrote:

> Hi,
>
>     I am looking into a solution to automatically load triples into our
> triples store. We use jena to convert our data into triples. Our current
> workflow is that we dump the triples in a file (e.g. content.ttl) after
> which this file is loaded through the isql command line:
>
>     "DB.DBA.TTLP_MT (file_to_string_output
> ('wpContent_v0.0.73237_20140115.ttl'), '', 'http://rdf.wikipathways.org');
>  “
>
> Loading the file takes minutes, but it still requires some manual steps. I
> would very much like to make both the authoring and the subsequent loading
> in the triple store a automatic process.
>
>  I have tried the following in java:
>
> InputStream in = new FileInputStream(args[1]);
>  InputStream in = new FileInputStream("wpContent_v0.0.73237_20140115.ttl"
> );
>  String url ="jdbc:virtuoso://localhost:4444";
>
> /* STEP 1 */
>  VirtGraph wpGraph = new VirtGraph ("http://rdf.wikipathways.org/";, url,
> “dba", “<dba-pw>");
>
> wpGraph.clear();
>  VirtuosoUpdateRequest vur = VirtuosoUpdateFactory.read(in,wpGraph);
>                 vur.exec();
>
>
>
> or loading them triple by triple:
>
> VirtGraph wpGraph = new VirtGraph ("http://rdf.wikipathways.org/";, url,
> “dba", “<dba-pw>");
>
>
> //wpGraph.getTransactionHandler().begin();
>  wpGraph.clear();
> StmtIterator iter = model.listStatements();
>  while (iter.hasNext()) {
>  Statement stmt      = iter.nextStatement();  // get next statement
> wpGraph.add(new Triple(stmt.getSubject().asNode(),
> stmt.getPredicate().asNode(), stmt.getObject().asNode()));
>  System.out.println( stmt.getSubject()+" - "+stmt.getPredicate()+" - "
> +stmt.getObject());
>  }
>
> Both of these approached work, they only take hours to proceed.
>
> Can I get the minutes needed for loading through the isql  command line in
> an automated pipeline process? Can I trigger the DB.DBA.TTLP_MT through
> java or a shell script?
>
> Any guidance is much appreciated
>
>
> Kind regards,
>
>
> Andra Waagmeester
>
>
>
>
>
>
>
>
>
> ------------------------------------------------------------------------------
> CenturyLink Cloud: The Leader in Enterprise Cloud Services.
> Learn Why More Businesses Are Choosing CenturyLink Cloud For
> Critical Workloads, Development Environments & Everything In Between.
> Get a Quote or Start a Free Trial Today.
>
> http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
> _______________________________________________
> Virtuoso-users mailing list
> Virtuoso-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/virtuoso-users
>
>


-- 
Jim McCusker

Data Scientist
5AM Solutions
jmccus...@5amsolutions.com
http://5amsolutions.com

PhD Student
Tetherless World Constellation
Rensselaer Polytechnic Institute
mcc...@cs.rpi.edu
http://tw.rpi.edu
------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today. 
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
_______________________________________________
Virtuoso-users mailing list
Virtuoso-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/virtuoso-users

Reply via email to