public static boolean deepContains(List<Object> values, Object value) { for (final Object item : values) { if (deepCompare(item, value, false)) { return true; } } return false; }
public static boolean isRelativeIri(String value) { if (!(isKeyword(value) || isAbsoluteIri(value))) { return true; } return false; }
private class EmbedNode { public Object parent = null; public String property = null; public EmbedNode(Object parent, String property) { this.parent = parent; this.property = property; } }
if (hasProperty(subject, property)) { Object val = subject.get(property); final boolean isList = isList(val); if (isList || val instanceof List) { if (isList) { if (compareValues(value, i)) { rval = true; break; rval = compareValues(value, val);
if (isArray(input)) { for (final Object i : (List<Object>) input) { fillNodesToPrune(i, toPrune); } else if (isObject(input)) { if (isValue(input)) { return; if (isList(input)) { fillNodesToPrune(((Map<String, Object>) input).get("@list"), toPrune); return; fillNodesToPrune(((Map<String, Object>) input).get(prop), toPrune);
if (isArray(input)) { final List<Object> output = new ArrayList<>(); for (final Object i : (List<Object>) input) { final Object result = removePreserve(ctx, i, opts); } else if (isObject(input)) { if (isValue(input)) { return input; if (isList(input)) { ((Map<String, Object>) input).put("@list", removePreserve(ctx, ((Map<String, Object>) input).get("@list"), opts)); return input; Object result = removePreserve(ctx, ((Map<String, Object>) input).get(prop), opts); final String container = ctx.getContainer(prop); if (opts.getCompactArrays() && isArray(result) && ((List<Object>) result).size() == 1 && container == null) { result = ((List<Object>) result).get(0);
if (JsonLdUtils.isRelativeIri(id)) { continue; else if (isKeyword(property)) { continue; else if (JsonLdUtils.isRelativeIri(property)) { continue; } else { if (isList(item)) { final List<Object> list = (List<Object>) ((Map<String, Object>) item) .get("@list");
for (final Object i : (List<Object>) nodeTypes) { for (final Object j : (List<Object>) types) { if (JsonLdUtils.deepCompare(i, j)) { return true; if ("@id".equals(key) || !isKeyword(key) && !(node.containsKey(key))) { return false;
JsonLdUtils.mergeValue(node, activeProperty, elem); JsonLdUtils.mergeValue(list, JsonLdConsts.LIST, elem); activeProperty, result); JsonLdUtils.mergeValue(node, activeProperty, result); JsonLdUtils.mergeValue((Map<String, Object>) graph.get(id), activeProperty, activeSubject); JsonLdUtils.mergeValue(node, activeProperty, reference); JsonLdUtils.mergeValue(list, JsonLdConsts.LIST, reference); JsonLdUtils.mergeValue(node, JsonLdConsts.TYPE, type); final Object elemIndex = elem.remove(JsonLdConsts.INDEX); if (node.containsKey(JsonLdConsts.INDEX)) { if (!JsonLdUtils.deepCompare(node.get(JsonLdConsts.INDEX), elemIndex)) { throw new JsonLdError(Error.CONFLICTING_INDEXES);
if (JsonLdUtils.compareValues(output, p)) { embedOn = true; break; if (isKeyword(prop)) { output.put(prop, JsonLdUtils.clone(element.get(prop))); continue; .get("@list")) { if (JsonLdUtils.isNodeReference(listitem)) { final Map<String, Object> tmp = newMap(); final String itemid = (String) ((Map<String, Object>) listitem) else if (JsonLdUtils.isNodeReference(item)) { final Map<String, Object> tmp = newMap(); final String itemid = (String) ((Map<String, Object>) item).get("@id"); for (final String prop : props) { if (isKeyword(prop)) { continue; Object def = "@null"; if (propertyFrame.containsKey("@default")) { def = JsonLdUtils.clone(propertyFrame.get("@default"));
frame = JsonLdUtils.clone(frame); final List<Object> framed = api.frame(expandedInput, expandedFrame); if (opts.getPruneBlankNodeIdentifiers()) { JsonLdUtils.pruneBlankNodes(framed); rval.putAll((Map) compacted); JsonLdUtils.removePreserve(activeCtx, rval, opts); return rval;
JsonLdUtils.mergeValue(node, JsonLdConsts.TYPE, object.getValue()); continue; JsonLdUtils.laxMergeValue(node, predicate, value); } else { JsonLdUtils.mergeValue(node, predicate, value); head = nodeUsage.value; if (!JsonLdUtils.isBlankNode(node)) { break;
public Permutator(List<String> list) { this.list = (List<String>) JsonLdUtils.clone(list); Collections.sort(this.list); this.done = false; this.left = new LinkedHashMap<>(); for (final String i : this.list) { this.left.put(i, true); } }
Map<String, Boolean> defined) throws JsonLdError { if (value == null || JsonLdUtils.isKeyword(value)) { return value; } else if (context != null && JsonLdUtils.isRelativeIri(value)) { throw new JsonLdError(Error.INVALID_IRI_MAPPING, "not an absolute IRI: " + value);
sObject = obj.optString("rdf:resource"); if(JsonLdUtils.isAbsoluteIri(sObject)){ object = new RDFDataset.IRI(sObject); }else{ if(JsonLdUtils.isAbsoluteIri(value)){ object = new RDFDataset.IRI(value); }else{
/** * Retrieve container mapping. * * @param property * The Property to get a container mapping for. * @return The container mapping */ public String getContainer(String property) { if ("@graph".equals(property)) { return "@set"; } if (JsonLdUtils.isKeyword(property)) { return property; } final Map<String, Object> td = (Map<String, Object>) termDefinitions.get(property); if (td == null) { return null; } return (String) td.get("@container"); }
boolean propertyIsArray, boolean allowDuplicate) { if (isArray(value)) { if (((List) value).isEmpty() && propertyIsArray && !subject.containsKey(property)) { subject.put(property, new ArrayList<>()); addValue(subject, property, val, propertyIsArray, allowDuplicate); final boolean hasValue = !allowDuplicate && hasValue(subject, property, value); if (!isArray(subject.get(property)) && (!hasValue || propertyIsArray)) { final List<Object> tmp = new ArrayList<>(); tmp.add(subject.get(property));