@Override public String getNamespace(String prefix) throws SailException { Namespace namespace = namespaces.get(prefix); return (namespace == null) ? null : namespace.getName(); }
@Override public boolean containsValue(Object nextValue) { if (nextValue instanceof String) { for (Namespace nextNamespace : namespaces) { if (nextNamespace.getName().equals(nextValue)) { return true; } } } return false; }
@Override public boolean containsValue(Object nextValue) { if (nextValue instanceof String) { for (Namespace nextNamespace : namespaces) { if (nextNamespace.getName().equals(nextValue)) { return true; } } } return false; }
@Override public Collection<String> values() { List<String> result = new ArrayList<String>(); for (Namespace nextNamespace : namespaces) { result.add(nextNamespace.getName()); } return result; } };
@Override public Collection<String> values() { List<String> result = new ArrayList<>(); for (Namespace nextNamespace : namespaces) { result.add(nextNamespace.getName()); } return result; } };
@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 String getNamespace(String prefix) throws RepositoryException { Optional<Namespace> ns = committed.getNamespace(prefix); if (ns.isPresent()) { return ns.get().getName(); } else { return null; } }
private static void addPrefixes(Map<String, Object> ctx, Set<Namespace> namespaces) { for (final Namespace ns : namespaces) { ctx.put(ns.getPrefix(), ns.getName()); } } }
@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 put(String nextKey, String nextValue) { String result = null; for (Namespace nextNamespace : new LinkedHashSet<Namespace>(namespaces)) { if (nextNamespace.getPrefix().equals(nextKey)) { result = nextNamespace.getName(); namespaces.remove(nextNamespace); } } namespaces.add(new SimpleNamespace(nextKey, nextValue)); return result; }
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()); } } }
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); } } }