/** * Add a prefix mapping to the current JSON-LD context, as a prefix string and target string. * Rebuilds the context. * * @param prefix the short prefix to add; should not include ":" * @param target the IRI string that is the target of the prefix * @throws IOException if prefix cannot be parsed */ public void addPrefix(String prefix, String target) throws IOException { try { context.put(prefix.trim(), target.trim()); context.remove("@base"); setContext((Map<String, Object>) context); } catch (Exception e) { throw new IOException(String.format(prefixLoadError, prefix, target), e); } }
final Object value = ((Map<String, Object>) context).get("@base"); if (value == null) { result.remove("@base"); } else if (value instanceof String) { if (JsonLdUtils.isAbsoluteIri((String) value)) { final Object value = ((Map<String, Object>) context).get("@vocab"); if (value == null) { result.remove("@vocab"); } else if (value instanceof String) { if (JsonLdUtils.isAbsoluteIri((String) value)) { final Object value = ((Map<String, Object>) context).get("@language"); if (value == null) { result.remove("@language"); } else if (value instanceof String) { result.put("@language", ((String) value).toLowerCase());
result.remove(JsonLdConsts.BASE); } else if (value instanceof String) { final Object value = ((Map<String, Object>) context).get(JsonLdConsts.VOCAB); if (value == null) { result.remove(JsonLdConsts.VOCAB); } else if (value instanceof String) { if (JsonLdUtils.isAbsoluteIri((String) value)) { final Object value = ((Map<String, Object>) context).get(JsonLdConsts.LANGUAGE); if (value == null) { result.remove(JsonLdConsts.LANGUAGE); } else if (value instanceof String) { result.put(JsonLdConsts.LANGUAGE, ((String) value).toLowerCase());
result.remove(JsonLdConsts.BASE); } else if (value instanceof String) { final Object value = ((Map<String, Object>) context).get(JsonLdConsts.VOCAB); if (value == null) { result.remove(JsonLdConsts.VOCAB); } else if (value instanceof String) { if (JsonLdUtils.isAbsoluteIri((String) value)) { final Object value = ((Map<String, Object>) context).get(JsonLdConsts.LANGUAGE); if (value == null) { result.remove(JsonLdConsts.LANGUAGE); } else if (value instanceof String) { result.put(JsonLdConsts.LANGUAGE, ((String) value).toLowerCase());