Let's make things even simpler:  How do I load a set of Quads into SDB via the 
Java API (not 'sdbloader')?


On Jun 25, 2013, at 11:32 AM, Cindy A McMullen wrote:

> I want to load triples into an empty SDB Store.  Here's what I'm trying:
> 
> Store store = getStore();
> GraphSDB graph = new GraphSDB(store);
> DatasetGraph datasetGraph = DatasetGraphFactory.create(graph);
> if (datasetGraph.isEmpty())
> {
>      System.out.println("Empty dataset graph");      // yes, it is
> }
> for (EventGraph eventGraph : eventGraphs)   // internal classes
> {
>         persist(eventGraph, datasetGraph);   // code below
> }
> 
> --------
> I'm calling into the same code that I use for in-memory implementation to 
> persist:
> 
> protected void persist(EventGraph eventGraph, DatasetGraph dsg)
>    {
>        // First,  pull the triples from the Set<Event>.
>        Set<Triple> triples = generateTriplesFromGraphEvent(eventGraph);
> 
>        // Named graph node, into which we'll store the event triples
>        Node graphNode = Node.createURI(UUID.randomUUID().toString());
> 
>        // Next, create a Jena Quad for that
>        for (Triple triple : triples)
>        {
>            Quad q = new Quad(graphNode, triple);
>            dsg.add(q);
>        }
> 
>        dsg.add(new Quad(Quad.defaultGraphIRI, createActionTriple(graphNode, 
> eventGraph)));
>        dsg.add(new Quad(Quad.defaultGraphIRI, 
> createTimestampTriple(graphNode, eventGraph)));
>    }
> 
> -------
> And get this message for the "dsg.add(q)" line:
> 
> Exception in thread "main" com.hp.hpl.jena.shared.JenaException: No such 
> graph: ef3f02ef-c203-42af-9e3d-9061acf27022
>    DatasetGraphCollection.add(DatasetGraphCollection.java:41)
>    InMemoryRDFManager.persist(InMemoryRDFManager.java:98)
>    SDBRDFManager.persist(SDBRDFManager.java:58)
> 
> ----
> 
> Any ideas?
> 
> 

Reply via email to