/** * Copies this UniqueNamer. * * @return a copy of this UniqueNamer. */ @Override public UniqueNamer clone() { final UniqueNamer copy = new UniqueNamer(this.prefix); copy.counter = this.counter; copy.existing = (Map<String, String>) JsonLdUtils.clone(this.existing); return copy; }
@Override public RDFDataset parse(Object input) throws JsonLdError { if (input instanceof String) { return RDFDatasetUtils.parseNQuads((String) input); } else { throw new JsonLdError(JsonLdError.Error.INVALID_INPUT, "NQuad Parser expected string input."); } }
/** * Outputs the RDF dataset found in the given JSON-LD object, using the * default {@link JsonLdOptions}. * * @param input * the JSON-LD input. * @return A JSON-LD object. * @throws JsonLdError * If there is an error converting the dataset to JSON-LD. */ public static Object toRDF(Object input) throws JsonLdError { return toRDF(input, new JsonLdOptions("")); }
/** * Expands the given input according to the steps in the <a * href="http://www.w3.org/TR/json-ld-api/#expansion-algorithm">Expansion * algorithm</a>, using the default {@link JsonLdOptions}. * * @param input * The input JSON-LD object. * @return The expanded JSON-LD document * @throws JsonLdError * If there is an error while expanding. */ public static List<Object> expand(Object input) throws JsonLdError { return expand(input, new JsonLdOptions("")); }
static private JsonLdOptions defaultJsonLdOptions(String baseURI) { JsonLdOptions opts = new JsonLdOptions(baseURI); opts.useNamespaces = true ; // this is NOT jsonld-java's default // opts.setUseRdfType(true); // false -> use "@type" opts.setUseNativeTypes(true); // this is NOT jsonld-java's default opts.setCompactArrays(true); // this is jsonld-java's default return opts; }
public Context(Map<String, Object> map) { super(map); init(new JsonLdOptions()); }
/** * Performs RDF dataset normalization on the given JSON-LD input. The output * is an RDF dataset unless the 'format' option is used. Uses the default * {@link JsonLdOptions}. * * @param input * the JSON-LD input to normalize. * @return The JSON-LD object * @throws JsonLdError * If there is an error normalizing the dataset. */ public static Object normalize(Object input) throws JsonLdError { return normalize(input, new JsonLdOptions("")); }
public Quad(final Node subject, final Node predicate, final Node object, final String graph) { super(); put("subject", subject); put("predicate", predicate); put("object", object); if (graph != null && !"@default".equals(graph)) { // TODO: i'm not yet sure if this should be added or if the // graph should only be represented by the keys in the dataset put("name", graph.startsWith("_:") ? new BlankNode(graph) : new IRI(graph)); } }
public RemoteDocument loadDocument(String url) throws JsonLdError { final RemoteDocument doc = new RemoteDocument(url, null); try { doc.setDocument(fromURL(new URL(url))); } catch (final Exception e) { new JsonLdError(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED, url); } return doc; }
/*** * _____ _ _ _ _ _ _ _ _ | ___| | __ _| |_| |_ ___ _ __ / \ | | __ _ ___ _ * __(_) |_| |__ _ __ ___ | |_ | |/ _` | __| __/ _ \ '_ \ / _ \ | |/ _` |/ _ * \| '__| | __| '_ \| '_ ` _ \ | _| | | (_| | |_| || __/ | | | / ___ \| | * (_| | (_) | | | | |_| | | | | | | | | |_| |_|\__,_|\__|\__\___|_| |_| /_/ * \_\_|\__, |\___/|_| |_|\__|_| |_|_| |_| |_| |___/ */ void generateNodeMap(Object element, Map<String, Object> nodeMap) throws JsonLdError { generateNodeMap(element, nodeMap, "@default", null, null, null); }
/** * Outputs the RDF dataset found in the given JSON-LD object, using the * default {@link JsonLdOptions}. * * @param input * the JSON-LD input. * @return A JSON-LD object. * @throws JsonLdError * If there is an error converting the dataset to JSON-LD. */ public static Object toRDF(Object input) throws JsonLdError { return toRDF(input, new JsonLdOptions("")); }
public Context(Map<String, Object> map) { super(map); init(new JsonLdOptions()); }
public Quad(final Node subject, final Node predicate, final Node object, final String graph) { super(); put("subject", subject); put("predicate", predicate); put("object", object); if (graph != null && !"@default".equals(graph)) { // TODO: i'm not yet sure if this should be added or if the // graph should only be represented by the keys in the dataset put("name", graph.startsWith("_:") ? new BlankNode(graph) : new IRI(graph)); } }
@Override public RDFDataset parse(Object input) throws JsonLdError { if (input instanceof String) { return parseNQuads((String) input); } else { throw new JsonLdError(JsonLdError.Error.INVALID_INPUT, "NQuad Parser expected string input."); } }
/** * Copies this UniqueNamer. * * @return a copy of this UniqueNamer. */ @Override public UniqueNamer clone() { final UniqueNamer copy = new UniqueNamer(this.prefix); copy.counter = this.counter; copy.existing = (Map<String, String>) JsonLdUtils.clone(this.existing); return copy; }
/** * Outputs the RDF dataset found in the given JSON-LD object, using the * default {@link JsonLdOptions}. * * @param input * the JSON-LD input. * @return A JSON-LD object. * @throws JsonLdError * If there is an error converting the dataset to JSON-LD. */ public static Object toRDF(Object input) throws JsonLdError { return toRDF(input, new JsonLdOptions("")); }
public Context(Map<String, Object> map) { super(map); init(new JsonLdOptions()); }
public Quad(final Node subject, final Node predicate, final Node object, final String graph) { super(); put("subject", subject); put("predicate", predicate); put("object", object); if (graph != null && !"@default".equals(graph)) { // TODO: i'm not yet sure if this should be added or if the // graph should only be represented by the keys in the dataset put("name", graph.startsWith("_:") ? new BlankNode(graph) : new IRI(graph)); } }
@Override public RDFDataset parse(Object input) throws JsonLdError { if (input instanceof String) { return RDFDatasetUtils.parseNQuads((String) input); } else { throw new JsonLdError(JsonLdError.Error.INVALID_INPUT, "NQuad Parser expected string input."); } }
/** * Copies this UniqueNamer. * * @return a copy of this UniqueNamer. */ @Override public UniqueNamer clone() { final UniqueNamer copy = new UniqueNamer(this.prefix); copy.counter = this.counter; copy.existing = (Map<String, String>) JsonLdUtils.clone(this.existing); return copy; }