/** * Constructs an instance of JsonLdOptions using the given base. * * @param base * The base IRI for the document. */ public JsonLdOptions(String base) { this.setBase(base); }
/** * Constructs an instance of JsonLdOptions using the given base. * * @param base * The base IRI for the document. */ public JsonLdOptions(String base) { this.setBase(base); }
/** * Constructs an instance of JsonLdOptions using the given base. * * @param base * The base IRI for the document. */ public JsonLdOptions(String base) { this.setBase(base); }
/** * Returns a new (mutable) JSON-LD options instance based on this context. */ public JsonLdOptions jsonLdOptions() { // TODO Technically both the documentLoader and potentially expandContext are mutable JsonLdOptions options = new JsonLdOptions(); options.setDocumentLoader(documentLoader); options.setBase(base); options.setExpandContext(expandContext); options.setOmitDefault(Boolean.TRUE); return options; }
opts.setBase((String) input);
opts.setBase((String) input);
opts.setBase((String) input);
@Test public void testCompaction() throws Exception { final Map<String, Object> contextAbbrevs = new HashMap<String, Object>(); contextAbbrevs.put("so", "http://schema.org/"); final Map<String, Object> json = new HashMap<String, Object>(); json.put("@context", contextAbbrevs); json.put("@id", "http://example.org/my_work"); final List<Object> types = new LinkedList<Object>(); types.add("so:CreativeWork"); json.put("@type", types); json.put("so:name", "My Work"); json.put("so:url", "http://example.org/my_work"); final JsonLdOptions options = new JsonLdOptions(); options.setBase("http://schema.org/"); options.setCompactArrays(true); // System.out.println("Before compact"); // System.out.println(JsonUtils.toPrettyString(json)); final List<String> newContexts = new LinkedList<String>(); newContexts.add("http://schema.org/"); final Map<String, Object> compacted = JsonLdProcessor.compact(json, newContexts, options); // System.out.println("\n\nAfter compact:"); // System.out.println(JsonUtils.toPrettyString(compacted)); assertTrue("Compaction removed the context", compacted.containsKey("@context")); assertFalse("Compaction of context should be a string, not a list", compacted.get("@context") instanceof List); }
final Map<String, Object> test_opts = (Map<String, Object>) test.get("option"); if (test_opts.containsKey("base")) { options.setBase((String) test_opts.get("base"));
opts.setBase(baseURI);
opts.setBase(baseURI);