/** * Abbreviate an URI with a full namespace URI to a short form URI with help of * the prefix in this namespace context. * * @param uri the long URI * @return a compact short URI or the original URI if there is no prefix in * this context */ public String compact(IRI uri) { return compact(uri, false); }
private void writeURI(IRI uri) throws IOException { if (uri == null) { sb.append("<>"); return; } String abbrev = getParams().getNamespaceContext().compact(uri); if (!abbrev.equals(uri.toString())) { sb.append(abbrev); return; } if (getParams().getNamespaceContext().getNamespaceURI(uri.getScheme()) != null) { sb.append(uri.toString()); return; } sb.append('<').append(encodeURIString(uri.toString())).append('>'); }
builder.field(params.getNamespaceContext().compact(predicate), values.get(0)); } else if (values.size() > 1) { builder.array(params.getNamespaceContext().compact(predicate), values); Resource res = resources.iterator().next(); if (!res.isEmpty()) { builder.field(params.getNamespaceContext().compact(predicate)); builder.startObject(); build(res); builder.field(params.getNamespaceContext().compact(predicate)); builder.startArray(); for (Resource res : resources) {