public Map<String, String> getNamespaces() { assertModel(); Map<String,String> nsMap = new HashMap<String, String>(); try { RepositoryResult<Namespace> openrdfMap = this.connection.getNamespaces(); openrdfMap.enableDuplicateFilter(); List<Namespace> openrdfList = openrdfMap.asList(); for( Namespace openrdfNamespace : openrdfList) { nsMap.put(openrdfNamespace.getPrefix(), openrdfNamespace.getName()); } return nsMap; } catch (RepositoryException e) { throw new ModelRuntimeException(e); } }
@Override public Map<String,String> getNamespaces() { assertModel(); Map<String,String> nsMap = new HashMap<String,String>(); try { RepositoryResult<Namespace> openrdfMap = this.connection.getNamespaces(); openrdfMap.enableDuplicateFilter(); List<Namespace> openrdfList = Iterations.asList(openrdfMap); for(Namespace openrdfNamespace : openrdfList) { nsMap.put(openrdfNamespace.getPrefix(), openrdfNamespace.getName()); } return nsMap; } catch(RepositoryException e) { throw new ModelRuntimeException(e); } }
public Map<String, String> getNamespaces() { this.assertModel(); Map<String, String> nsMap = new HashMap<String, String>(); try { RepositoryResult<Namespace> openrdfMap = this.connection .getNamespaces(); openrdfMap.enableDuplicateFilter(); List<Namespace> openrdfList = openrdfMap.asList(); for (Namespace openrdfNamespace : openrdfList) { nsMap.put(openrdfNamespace.getPrefix(), openrdfNamespace .getName()); } return nsMap; } catch (RepositoryException e) { throw new ModelRuntimeException(e); } }
@Override public Map<String,String> getNamespaces() { this.assertModel(); Map<String,String> nsMap = new HashMap<String,String>(); try { RepositoryResult<Namespace> openrdfMap = this.connection.getNamespaces(); openrdfMap.enableDuplicateFilter(); while (openrdfMap.hasNext()) { Namespace openrdfNamespace = openrdfMap.next(); nsMap.put(openrdfNamespace.getPrefix(), openrdfNamespace.getName()); } return nsMap; } catch(RepositoryException e) { throw new ModelRuntimeException(e); } }
@Test public void testDuplicateFilter() throws Exception { testCon.begin(); testCon.add(bob, name, nameBob); testCon.add(bob, name, nameBob, context1); testCon.add(bob, name, nameBob, context2); testCon.commit(); RepositoryResult<Statement> result = testCon.getStatements(bob, name, null, true); result.enableDuplicateFilter(); int count = 0; while (result.hasNext()) { result.next(); count++; } assertThat(count, is(equalTo(1))); }
public void testDuplicateFilter() throws Exception { testCon.setAutoCommit(false); testCon.add(bob, name, nameBob); testCon.add(bob, name, nameBob, context1); testCon.add(bob, name, nameBob, context2); testCon.setAutoCommit(true); RepositoryResult<Statement> result = testCon.getStatements(bob, name, null, true); result.enableDuplicateFilter(); int count = 0; while (result.hasNext()) { result.next(); count++; } assertEquals(1, count); }
@Test public void testDuplicateFilter() throws Exception { testCon.begin(); testCon.add(bob, name, nameBob); testCon.add(bob, name, nameBob, context1); testCon.add(bob, name, nameBob, context2); testCon.commit(); RepositoryResult<Statement> result = testCon.getStatements(bob, name, null, true); result.enableDuplicateFilter(); int count = 0; while (result.hasNext()) { result.next(); count++; } assertThat(count, is(equalTo(1))); }