marklogic / marklogic-jena

Adapter for using MarkLogic with the Jena RDF Framework
Other
5 stars 11 forks source link

adding named graph within transaction dosen't add the graph node #5

Closed kkanthet closed 9 years ago

kkanthet commented 9 years ago

I am exactly not sure whats going wrong here ,, adding named graph within transaction does not add graph node .

         Graph g = markLogicDatasetGraph.getDefaultGraph();
    markLogicDatasetGraph.begin(ReadWrite.WRITE);
            Node newgraph1 = NodeFactory.createURI("http://jena.example.org/perm1");
            markLogicDatasetGraph.addGraph(newgraph1, g);
            Iterator<Quad> quads = markLogicDatasetGraph.find();
            while (quads.hasNext()) {
                Quad quad1 = quads.next();
                System.out.println(quad1);
                assertTrue(quad1.matches(newgraph1, Node.ANY, NodeFactory.createURI("http://example.org/kennedy/sameAs"), Node.ANY));
            }

quad1 is printed as ==  [_ http://example.org/kennedy/person1 http://example.org/kennedy/sameAs http://foo/bar]

Expecting quad1 = [http://jena.example.org/perm1 http://example.org/kennedy/person1 http://example.org/kennedy/sameAs http://foo/bar]
grechaw commented 9 years ago

Hi Kiran, I'm wondering if you're getting the triple from the default graph as quad1, then if you went to the next triple in the iterator, you'll get the one you're looking for.

Maybe find() should take the newgraph1 as a parameter to narrow down that iterator

kkanthet commented 9 years ago

Thats right , i am getting triples first then quads from find()

[_ http://example.org/kennedy/person1 http://example.org/kennedy/sameAs http://foo/bar]
[_ http://example.org/kennedy/person1 http://purl.org/dc/elements/1.1/title "Person's title"@en]
[_ http://example.org/kennedy/person1 http://purl.org/dc/elements/1.1/title "Titulo de la persona"@es]
[http://jena.example.org/perm1 http://example.org/kennedy/person1 http://example.org/kennedy/sameAs http://foo/bar]
[http://marklogic.com/semantics#default-graph http://example.org/kennedy/person1 http://example.org/kennedy/sameAs http://foo/bar]
[http://jena.example.org/perm1 http://example.org/kennedy/person1 http://purl.org/dc/elements/1.1/title "Person's title"@en]
[http://marklogic.com/semantics#default-graph http://example.org/kennedy/person1 http://purl.org/dc/elements/1.1/title "Person's title"@en]
[http://jena.example.org/perm1 http://example.org/kennedy/person1 http://purl.org/dc/elements/1.1/title "Titulo de la persona"@es]
[http://marklogic.com/semantics#default-graph http://example.org/kennedy/person1 http://purl.org/dc/elements/1.1/title "Titulo de la persona"@es]