@Test public void testGetNamespaces() throws Exception { setupNamespaces(); Map<String, String> map = Namespaces.asMap(Iterations.asSet(testCon.getNamespaces())); assertThat(map.size(), is(equalTo(3))); assertThat(map.keySet(), hasItems(EXAMPLE, RDFS_PREFIX, RDF_PREFIX)); assertThat(map.get(EXAMPLE), is(equalTo(EXAMPLE_NS))); assertThat(map.get(RDFS_PREFIX), is(equalTo(RDFS_NS))); assertThat(map.get(RDF_PREFIX), is(equalTo("http://www.w3.org/1999/02/22-rdf-syntax-ns#"))); }
/** * Creates a new StatementCollector that stores reported statements in the * supplied collection and that uses a new LinkedHashMap to store the * reported namespaces. */ public ContextStatementCollector(Collection<Statement> statements, ValueFactory vf, Resource... contexts) { OpenRDFUtil.verifyContextNotNull(contexts); if (statements instanceof Model) { this.namespaces = Namespaces.wrap(((Model)statements).getNamespaces()); } else { this.namespaces = new LinkedHashMap<String, String>(); } this.statements = statements; this.vf = vf; this.contexts = contexts; }
@Test public void testGetNamespaces() throws Exception { setupNamespaces(); Map<String, String> map = Namespaces.asMap(Iterations.asSet(testCon.getNamespaces())); assertThat(map.size(), is(equalTo(3))); assertThat(map.keySet(), hasItems(EXAMPLE, RDFS_PREFIX, RDF_PREFIX)); assertThat(map.get(EXAMPLE), is(equalTo(EXAMPLE_NS))); assertThat(map.get(RDFS_PREFIX), is(equalTo(RDFS_NS))); assertThat(map.get(RDF_PREFIX), is(equalTo("http://www.w3.org/1999/02/22-rdf-syntax-ns#"))); }
SesameUtils.storeOntology(nextOntology, concreteModel, Namespaces.asMap(concreteModel.getNamespaces()), inferredModel, this.repository, SesameUtils.ONTOLOGY_MANAGER_GRAPH);