@Override public boolean containsKey(Object nextKey) { if (nextKey instanceof String) { for (Namespace nextNamespace : namespaces) { if (nextNamespace.getPrefix().equals(nextKey)) { return true; } } } return false; }
@Override public Set<String> keySet() { Set<String> result = new LinkedHashSet<String>(); for (Namespace nextNamespace : namespaces) { result.add(nextNamespace.getPrefix()); } return result; }
@Override public Optional<Namespace> getNamespace(String prefix) { for (Namespace nextNamespace : namespaces) { if (prefix.equals(nextNamespace.getPrefix())) { return Optional.of(nextNamespace); } } return Optional.empty(); }
@Override public Optional<Namespace> getNamespace(String prefix) { for (Namespace nextNamespace : namespaces) { if (prefix.equals(nextNamespace.getPrefix())) { return Optional.of(nextNamespace); } } return Optional.empty(); }
@Override public Optional<Namespace> getNamespace(String prefix) { for (Namespace nextNamespace : namespaces) { if (prefix.equals(nextNamespace.getPrefix())) { return Optional.of(nextNamespace); } } return Optional.empty(); }
@Override public Optional<Namespace> getNamespace(String prefix) { for (Namespace nextNamespace : namespaces) { if (prefix.equals(nextNamespace.getPrefix())) { return Optional.of(nextNamespace); } } return Optional.empty(); }
@Override public void setNamespace(Namespace namespace) { removeNamespace(namespace.getPrefix()); namespaces.add(namespace); }
@Override public void setNamespace(Namespace namespace) { removeNamespace(namespace.getPrefix()); namespaces.add(namespace); }
@Override public String get(Object nextKey) { if (nextKey instanceof String) { for (Namespace nextNamespace : namespaces) { if (nextNamespace.getPrefix().equals(nextKey)) { return nextNamespace.getName(); } } } return null; }
@Override public String remove(Object nextKey) { String result = null; for (Namespace nextNamespace : new LinkedHashSet<Namespace>(namespaces)) { if (nextNamespace.getPrefix().equals(nextKey)) { result = nextNamespace.getName(); namespaces.remove(nextNamespace); } } return result; }
private static void addPrefixes(Map<String, Object> ctx, Set<Namespace> namespaces) { for (final Namespace ns : namespaces) { ctx.put(ns.getPrefix(), ns.getName()); } } }
@Override public void setNamespace(Namespace namespace) { removeNamespace(namespace.getPrefix()); namespaces.add(namespace); }
private static void addPrefixes(Map<String, Object> ctx, Set<Namespace> namespaces) { for (final Namespace ns : namespaces) { ctx.put(ns.getPrefix(), ns.getName()); } } }
public static void main(String[] args) throws Exception { NamespaceStore nsStore = new NamespaceStore(new File(args[0])); for (Namespace ns : nsStore) { System.out.println(ns.getPrefix() + " = " + ns.getName()); } } }
protected void initializeNamespaceTableFromConfiguration() { for (Namespace aNS : getParserConfig().get(BasicParserSettings.NAMESPACES)) { namespaceTable.put(aNS.getPrefix(), aNS.getName()); } }
protected void initializeNamespaceTableFromConfiguration() { for (Namespace aNS : getParserConfig().get(BasicParserSettings.NAMESPACES)) { namespaceTable.put(aNS.getPrefix(), aNS.getName()); } }
protected void initializeNamespaceTableFromConfiguration() { for (Namespace aNS : getParserConfig().get(BasicParserSettings.NAMESPACES)) { namespaceTable.put(aNS.getPrefix(), aNS.getName()); } }
@Override public List<Namespace> getNamespaces() throws RepositoryException { List<Namespace> result = new ArrayList<>(); RepositoryResult<org.eclipse.rdf4j.model.Namespace> namespaces = repo.getConnection().getNamespaces(); while(namespaces.hasNext()) { org.eclipse.rdf4j.model.Namespace ns = namespaces.next(); result.add(new Namespace(ns.getPrefix(), ns.getName())); } return result; }
private void writeNamespaces(SailDataset store, DataOutputStream dataOut) throws IOException, SailException { try (CloseableIteration<? extends Namespace, SailException> iter = store.getNamespaces();) { while (iter.hasNext()) { Namespace ns = iter.next(); dataOut.writeByte(NAMESPACE_MARKER); writeString(ns.getPrefix(), dataOut); writeString(ns.getName(), dataOut); } } }
private void writeNamespaces(SailDataset store, DataOutputStream dataOut) throws IOException, SailException { try (CloseableIteration<? extends Namespace, SailException> iter = store.getNamespaces();) { while (iter.hasNext()) { Namespace ns = iter.next(); dataOut.writeByte(NAMESPACE_MARKER); writeString(ns.getPrefix(), dataOut); writeString(ns.getName(), dataOut); } } }