/** * Get a copy of the current prefix map. * * @return a copy of the current prefix map */ public Map<String, String> getPrefixes() { return this.context.getPrefixes(false); }
Map<String, String> getPrefixes(boolean onlyCommonPrefixes) { return context.getPrefixes(onlyCommonPrefixes); }
/** * Get a prefix manager with the current prefixes. * * @return a new DefaultPrefixManager */ public DefaultPrefixManager getPrefixManager() { return makePrefixManager(context.getPrefixes(false)); }
/** * Tests to see if the specified term or fully qualified type should be embedded. */ public boolean isEmbedded(@Nullable Object type) { if (type instanceof List<?>) { return ((List<?>) type).stream().anyMatch(this::isEmbedded); } else if (embeddedTypes.contains(type)) { return true; } else { String fullyQualified = context.getPrefixes(false).get(type); if (fullyQualified != null) { return isEmbedded(fullyQualified); } else { return false; } } }
/** * Return the current prefixes as a JSON-LD string. * * @return the current prefixes as a JSON-LD string * @throws IOException on any error */ public String getContextString() throws IOException { try { Object compact = JsonLdProcessor.compact( JsonUtils.fromString("{}"), context.getPrefixes(false), new JsonLdOptions()); return JsonUtils.toPrettyString(compact); } catch (Exception e) { throw new IOException(jsonldContextCreationError, e); } }
final Map<String, String> prefixes = context.getPrefixes(true);
final Map<String, String> prefixes = context.getPrefixes(true);
final Map<String, String> prefixes = context.getPrefixes(true);