protected void getMetadataProperties(Map<String, Object> metadata, BiConsumer<Object, Object> properties) { // A BdioMetadata instance should effectively be expanded data so we need to compact it using the graph context JsonLdOptions opts = frame().context().jsonLdOptions(); Object expandContext = opts.getExpandContext(); opts.setExpandContext(null); Map<String, Object> metadataNode = JsonLdProcessor.compact(metadata, expandContext, opts); options().metadataLabel().ifPresent(type -> metadataNode.put(JsonLdConsts.TYPE, type)); if (metadata.size() == 1 && metadata.containsKey(JsonLdConsts.ID)) { // JSON-LD compaction will remove the "@id" if it is the only field, put it back metadataNode.put(JsonLdConsts.ID, metadata.get(JsonLdConsts.ID)); } // Use the regular node property extraction logic getNodeProperties(metadataNode, properties); }
if (opts.getExpandContext() != null) { Object exCtx = opts.getExpandContext(); if (exCtx instanceof Map && ((Map<String, Object>) exCtx).containsKey("@context")) { exCtx = ((Map<String, Object>) exCtx).get("@context");
if (opts.getExpandContext() != null) { Object exCtx = opts.getExpandContext(); if (exCtx instanceof Map && ((Map<String, Object>) exCtx).containsKey(JsonLdConsts.CONTEXT)) {
if (opts.getExpandContext() != null) { Object exCtx = opts.getExpandContext(); if (exCtx instanceof Map && ((Map<String, Object>) exCtx).containsKey(JsonLdConsts.CONTEXT)) {
final Object savedExpandedContext = opts.getExpandContext(); opts.setExpandContext(null); opts.setFrameExpansion(true);
final Object savedExpandedContext = opts.getExpandContext(); opts.setExpandContext(null); opts.setFrameExpansion(true);