<?xml version="1.0" encoding="UTF-8" ?>


<!--  RSS generated by JIRA #108 at Sat May 25 08:28:24 CEST 2013 -->

<rss version="0.92">






<channel>
    <title>openRDF.org Issue Tracker</title>
    <link>http://www.openrdf.org/issues</link>
    <description>This file is an XML representation of an issue</description>
    <language>en</language>
    <item>
        







<title>[SES-995] Missing context when using remote repository.</title>
<link>http://www.openrdf.org/issues/browse/SES-995</link>

    
        <description>Issue originally raised by Christopher Lott in the context of OWLIM-Lite. However, this has been confirmed with Sesame in-memory repository also:&lt;br/&gt;
&lt;br/&gt;
When I add a statement to two contexts and then ask the repository for the known contexts, a remote Sesame repository only shows one of the contexts.  The same test works as expected on a local repository, i.e. both contexts are returned.&lt;br/&gt;
&lt;br/&gt;
</description>
    
    
        <environment>Sesame in-memory repository with RDFS.&lt;br/&gt;
Correct behaviour when repository instantiated locally.&lt;br/&gt;
Incorrect behaviour when repository used remotely.</environment>
    
        <key id="13490">SES-995</key>
        <summary>Missing context when using remote repository.</summary>
        <type id="1">Bug</type>
    
        <priority id="3">Major</priority>
    
        <status id="5">Resolved</status>
        
        <resolution id="1">Fixed</resolution>
        
    
        
        <assignee username="jeen">Jeen Broekstra</assignee>
        
    

    
        
        <reporter username="bazbishop">Barry Bishop</reporter>
        
    

        
        <created>Mon, 14 May 2012 09:41:05 +0200 (CEST)</created>
    <updated>Fri, 18 May 2012 07:17:35 +0200 (CEST)</updated>

    
        
        
            
            
                
                    <version>2.6.5</version>
                
            
        
    

    
        
        
            
            
                
                    <fixVersion>2.6.6</fixVersion>
                
            
        
    

    
        
        
            
            
                
                    <component>HTTPRepository</component>
                
            
        
    

    
    
        <due></due>
    
    
        <votes>1</votes>
    
    

    
    
        <comments>
            
            <comment author="bazbishop" created="Mon, 14 May 2012 09:42:45 +0200 (CEST)" level="">The following sample code will demonstrate the problem (courtesy of Christopher Lott):&lt;br/&gt;
&lt;br/&gt;
=================================================&lt;br/&gt;
&lt;br/&gt;
import org.openrdf.model.Resource;&lt;br/&gt;
import org.openrdf.model.Statement;&lt;br/&gt;
import org.openrdf.model.URI;&lt;br/&gt;
import org.openrdf.model.ValueFactory;&lt;br/&gt;
import org.openrdf.model.vocabulary.RDF;&lt;br/&gt;
import org.openrdf.repository.Repository;&lt;br/&gt;
import org.openrdf.repository.RepositoryConnection;&lt;br/&gt;
import org.openrdf.repository.RepositoryResult;&lt;br/&gt;
import org.openrdf.repository.http.HTTPRepository;&lt;br/&gt;
import org.openrdf.repository.sail.SailRepository;&lt;br/&gt;
import org.openrdf.sail.memory.MemoryStore;&lt;br/&gt;
&lt;br/&gt;
/**&lt;br/&gt;
&amp;nbsp;* Adds a single entity with two contexts to test context implementation. Uses a&lt;br/&gt;
&amp;nbsp;* memory repository if the program is invoked with no arguments. If a single&lt;br/&gt;
&amp;nbsp;* argument is supplied, treats it as the URI of a remote repository and runs&lt;br/&gt;
&amp;nbsp;* the test using that repository.&lt;br/&gt;
&amp;nbsp;* &lt;br/&gt;
&amp;nbsp;* @author clott&lt;br/&gt;
&amp;nbsp;*/&lt;br/&gt;
public class TestOneEntityTwoContexts {&lt;br/&gt;
&lt;br/&gt;
	public static void main(String[] args) {&lt;br/&gt;
&lt;br/&gt;
		try {&lt;br/&gt;
			// Get started&lt;br/&gt;
			Repository repo = null;&lt;br/&gt;
			if (args.length != 1) {&lt;br/&gt;
				System.out.println(&amp;quot;Creating an in-memory Sail repository&amp;quot;);&lt;br/&gt;
				repo = new SailRepository(new MemoryStore());&lt;br/&gt;
				repo.initialize();&lt;br/&gt;
			} else {&lt;br/&gt;
				System.out.println(&amp;quot;Using remote repository at &amp;quot; + args[0]);&lt;br/&gt;
				repo = new HTTPRepository(args[0]);&lt;br/&gt;
			}&lt;br/&gt;
&lt;br/&gt;
			// Open a connection.&lt;br/&gt;
			RepositoryConnection con = repo.getConnection();&lt;br/&gt;
&lt;br/&gt;
			// Create some resources and literals to use in statements&lt;br/&gt;
			ValueFactory f = repo.getValueFactory();&lt;br/&gt;
			String namespace = &amp;quot;&lt;a href=&quot;http://example.org/ontology#&quot;&gt;http://example.org/ontology#&lt;/a&gt;&amp;quot;;&lt;br/&gt;
			URI personClassUri = f.createURI(namespace + &amp;quot;Person&amp;quot;);&lt;br/&gt;
&lt;br/&gt;
			// Use these two contexts&lt;br/&gt;
			URI context1 = f.createURI(&amp;quot;&lt;a href=&quot;http://example.org/context1&quot;&gt;http://example.org/context1&lt;/a&gt;&amp;quot;);&lt;br/&gt;
			URI context2 = f.createURI(&amp;quot;&lt;a href=&quot;http://example.org/context2&quot;&gt;http://example.org/context2&lt;/a&gt;&amp;quot;);&lt;br/&gt;
			URI[] contexts = new URI[] { context1, context2 };&lt;br/&gt;
&lt;br/&gt;
			// Add entity&lt;br/&gt;
			System.out.println(&amp;quot;Adding entity of type Person&amp;quot;);&lt;br/&gt;
			Resource entity = f.createBNode();&lt;br/&gt;
			con.add(entity, RDF.TYPE, personClassUri, contexts);&lt;br/&gt;
&lt;br/&gt;
			// Query and show contexts&lt;br/&gt;
			System.out.println(&amp;quot;Repository contexts:&amp;quot;);&lt;br/&gt;
			RepositoryResult&amp;lt;Resource&amp;gt; repoContexts = con.getContextIDs();&lt;br/&gt;
			int conCount = 0;&lt;br/&gt;
			while (repoContexts.hasNext()) {&lt;br/&gt;
				++conCount;&lt;br/&gt;
				Resource r = repoContexts.next();&lt;br/&gt;
				System.out.println(r);&lt;br/&gt;
			}&lt;br/&gt;
&lt;br/&gt;
			// Show results: expect two statements&lt;br/&gt;
			System.out.println(&amp;quot;Showing entities of type Person&amp;quot;);&lt;br/&gt;
			RepositoryResult&amp;lt;Statement&amp;gt; stmts = con.getStatements(null,&lt;br/&gt;
					RDF.TYPE, personClassUri, false);&lt;br/&gt;
			int stmtCount = 0;&lt;br/&gt;
			while (stmts.hasNext()) {&lt;br/&gt;
				++stmtCount;&lt;br/&gt;
				System.out.println(stmts.next());&lt;br/&gt;
			}&lt;br/&gt;
			stmts.close();&lt;br/&gt;
&lt;br/&gt;
			// Remove the newly added statements from all context&lt;br/&gt;
			con.remove(entity, RDF.TYPE, personClassUri);&lt;br/&gt;
&lt;br/&gt;
			// Shut down&lt;br/&gt;
			System.out.println(&amp;quot;Closing repository connection&amp;quot;);&lt;br/&gt;
			con.close();&lt;br/&gt;
&lt;br/&gt;
			// Check result&lt;br/&gt;
			if (conCount == 2 &amp;amp;&amp;amp; stmtCount == 2)&lt;br/&gt;
				System.out&lt;br/&gt;
						.println(&amp;quot;Pass, found expected context and statement count of 2 each&amp;quot;);&lt;br/&gt;
			else&lt;br/&gt;
				System.out.println(&amp;quot;Fail, expected 2 contexts but found &amp;quot;&lt;br/&gt;
						+ conCount + &amp;quot;; expected 2 statements but found &amp;quot;&lt;br/&gt;
						+ stmtCount);&lt;br/&gt;
&lt;br/&gt;
		} catch (Exception ex) {&lt;br/&gt;
			ex.printStackTrace();&lt;br/&gt;
		}&lt;br/&gt;
	}&lt;br/&gt;
}&lt;br/&gt;
</comment>
            
            <comment author="chrislott" created="Mon, 14 May 2012 20:47:10 +0200 (CEST)" level="">Also please check the implementation of the remote-repository version of the RepositoryConnection#add(Iteration&amp;lt;? extends Statement, RepositoryException&amp;gt; statements, Resource... contexts)  method.  I&apos;m using that to push batches of statements over, using a single context . As far as I can tell, that context is ignored completely.  Thanks.&lt;br/&gt;
&lt;br/&gt;
</comment>
            
            <comment author="jeen" created="Tue, 15 May 2012 00:12:59 +0200 (CEST)" level="">added testcase to RepositoryConnectionTest for this case. Case currently greenlines on memory stores but indeed fails on http repositories, which confirms this is a bug in sesame.</comment>
            
            <comment author="jeen" created="Tue, 15 May 2012 00:29:58 +0200 (CEST)" level="">managed to track this to a bug in the TransactionReader.</comment>
            
            <comment author="jeen" created="Tue, 15 May 2012 00:35:08 +0200 (CEST)" level="">Tracked to an issue in the TransactionSAXParser. Fix and unit test checked in, will be available for the next release. Thanks for reporting this.</comment>
            
            <comment author="chrislott" created="Tue, 15 May 2012 02:07:47 +0200 (CEST)" level="">Thank you so much for the same-day fix!  Do you have an estimated date for the next release?</comment>
            
            <comment author="jeen" created="Fri, 18 May 2012 07:17:35 +0200 (CEST)" level="">Chris, no fixed release date yet, I&apos;m afraid, but &amp;quot;Real Soon Now&amp;quot;(TM). Tentatively scheduled for last week of May.</comment>
            
        </comments>
    
    

        



        <customfields>
        
            
        </customfields>
    </item>
</channel>


</rss>  