public Object getContextValue(String activeProperty, String string) throws JsonLdError { throw new JsonLdError(Error.NOT_IMPLEMENTED, "getContextValue is only used by old code so far and thus isn't implemented"); }
throw new JsonLdError(Error.CYCLIC_IRI_MAPPING, term); throw new JsonLdError(Error.KEYWORD_REDEFINITION, term); throw new JsonLdError(Error.INVALID_TERM_DEFINITION, value); throw new JsonLdError(Error.INVALID_TYPE_MAPPING, val.get("@type")); type = this.expandIri((String) val.get("@type"), false, true, context, defined); } catch (final JsonLdError error) { if (error.getType() != Error.INVALID_IRI_MAPPING) { throw error; throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type); definition.put("@type", type); } else { throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type); throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY, val); throw new JsonLdError(Error.INVALID_IRI_MAPPING, "Expected String for @reverse value. got " + (val.get("@reverse") == null ? "null" : val.get("@reverse") context, defined); if (!JsonLdUtils.isAbsoluteIri(reverse)) { throw new JsonLdError(Error.INVALID_IRI_MAPPING, "Non-absolute @reverse IRI: " + reverse);
@Override public void parse(Graph target, InputStream serializedGraph, String formatIdentifier, IRI baseUri) { //The callback will add parsed triples to the target Graph ClerezzaTripleCallback ctc = new ClerezzaTripleCallback(); ctc.setGraph(target); Object input; int startSize = 0; if(logger.isDebugEnabled()){ startSize = target.size(); } long start = System.currentTimeMillis(); try { input = JsonUtils.fromInputStream(serializedGraph,"UTF-8"); } catch (IOException e) { logger.error("Unable to read from the parsed input stream",e); throw new RuntimeException(e.getMessage(), e); } try { JsonLdProcessor.toRDF(input,ctc); } catch (JsonLdError e) { logger.error("Unable to parse JSON-LD from the parsed input stream",e); throw new RuntimeException(e.getMessage(), e); } if(logger.isDebugEnabled()){ logger.debug(" - parsed {} triples in {}ms", target.size() - startSize, System.currentTimeMillis()-start); } }
if (failure_expected) { if (result instanceof JsonLdError) { testpassed = Obj.equals(expect, ((JsonLdError) result).getType().toString()); if (!testpassed) { ((JsonLdError) result).printStackTrace(); + test.get("input") + "," + test.get("expect") + ")\n" + "expected: " + JsonUtils.toPrettyString(expect) + "\nresult: " + (result instanceof JsonLdError ? ((JsonLdError) result).toString() : JsonUtils.toPrettyString(result)), testpassed);
@Test public void testDisallowRemoteContexts() throws Exception { final String testUrl = "http://json-ld.org/contexts/person.jsonld"; final Object test = documentLoader.loadDocument(testUrl); assertNotNull( "Was not able to fetch from URL before testing disallow remote contexts loading", test); final String disallowProperty = System .getProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING); try { System.setProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING, "true"); documentLoader.loadDocument(testUrl); fail("Expected exception to occur"); } catch (final JsonLdError e) { assertEquals(JsonLdError.Error.LOADING_REMOTE_CONTEXT_FAILED, e.getType()); } finally { if (disallowProperty == null) { System.clearProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING); } else { System.setProperty(DocumentLoader.DISALLOW_REMOTE_CONTEXT_LOADING, disallowProperty); } } }
throw new JsonLdError(Error.CYCLIC_IRI_MAPPING, term); && !(options.getAllowContainerSetOnType() && JsonLdConsts.TYPE.equals(term) && !(context.get(term)).toString().contains(JsonLdConsts.ID))) { throw new JsonLdError(Error.KEYWORD_REDEFINITION, term); throw new JsonLdError(Error.INVALID_TERM_DEFINITION, value); throw new JsonLdError(Error.INVALID_TYPE_MAPPING, val.get(JsonLdConsts.TYPE)); defined); } catch (final JsonLdError error) { if (error.getType() != Error.INVALID_IRI_MAPPING) { throw error; throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type, error); definition.put(JsonLdConsts.TYPE, type); } else { throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type); throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY, val); throw new JsonLdError(Error.INVALID_IRI_MAPPING, "Expected String for @reverse value. got " + (val.get(JsonLdConsts.REVERSE) == null ? "null" true, context, defined); if (!JsonLdUtils.isAbsoluteIri(reverse)) {
@Override public void parse(Graph target, InputStream serializedGraph, String formatIdentifier, IRI baseUri) { // The callback will add parsed triples to the target MGraph final ClerezzaTripleCallback ctc = new ClerezzaTripleCallback(); ctc.setMGraph(target); Object input; int startSize = 0; if (logger.isDebugEnabled()) { startSize = target.size(); } final long start = System.currentTimeMillis(); try { input = JsonUtils.fromInputStream(serializedGraph, "UTF-8"); } catch (final IOException e) { logger.error("Unable to read from the parsed input stream", e); throw new RuntimeException(e.getMessage(), e); } try { JsonLdProcessor.toRDF(input, ctc); } catch (final JsonLdError e) { logger.error("Unable to parse JSON-LD from the parsed input stream", e); throw new RuntimeException(e.getMessage(), e); } if (logger.isDebugEnabled()) { logger.debug(" - parsed {} triples in {}ms", target.size() - startSize, System.currentTimeMillis() - start); } }
public void setEmbed(String embed) throws JsonLdError { switch (embed) { case "@always": this.embed = Embed.ALWAYS; break; case "@never": this.embed = Embed.NEVER; break; case "@last": this.embed = Embed.LAST; break; case "@link": this.embed = Embed.LINK; break; default: throw new JsonLdError(JsonLdError.Error.INVALID_EMBED_VALUE); } }
throw new JsonLdError(Error.CYCLIC_IRI_MAPPING, term); && !(options.getAllowContainerSetOnType() && JsonLdConsts.TYPE.equals(term) && !(context.get(term)).toString().contains(JsonLdConsts.ID))) { throw new JsonLdError(Error.KEYWORD_REDEFINITION, term); throw new JsonLdError(Error.INVALID_TERM_DEFINITION, value); throw new JsonLdError(Error.INVALID_TYPE_MAPPING, val.get(JsonLdConsts.TYPE)); defined); } catch (final JsonLdError error) { if (error.getType() != Error.INVALID_IRI_MAPPING) { throw error; throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type, error); definition.put(JsonLdConsts.TYPE, type); } else { throw new JsonLdError(Error.INVALID_TYPE_MAPPING, type); throw new JsonLdError(Error.INVALID_REVERSE_PROPERTY, val); throw new JsonLdError(Error.INVALID_IRI_MAPPING, "Expected String for @reverse value. got " + (val.get(JsonLdConsts.REVERSE) == null ? "null" true, context, defined); if (!JsonLdUtils.isAbsoluteIri(reverse)) {
@Override public void parse(Graph target, InputStream serializedGraph, String formatIdentifier, IRI baseUri) { //The callback will add parsed triples to the target Graph ClerezzaTripleCallback ctc = new ClerezzaTripleCallback(); ctc.setGraph(target); Object input; int startSize = 0; if(logger.isDebugEnabled()){ startSize = target.size(); } long start = System.currentTimeMillis(); try { input = JsonUtils.fromInputStream(serializedGraph,"UTF-8"); } catch (IOException e) { logger.error("Unable to read from the parsed input stream",e); throw new RuntimeException(e.getMessage(), e); } try { JsonLdProcessor.toRDF(input,ctc); } catch (JsonLdError e) { logger.error("Unable to parse JSON-LD from the parsed input stream",e); throw new RuntimeException(e.getMessage(), e); } if(logger.isDebugEnabled()){ logger.debug(" - parsed {} triples in {}ms", target.size() - startSize, System.currentTimeMillis()-start); } }
public void setEmbed(String embed) throws JsonLdError { switch (embed) { case "@always": this.embed = Embed.ALWAYS; break; case "@never": this.embed = Embed.NEVER; break; case "@last": this.embed = Embed.LAST; break; case "@link": this.embed = Embed.LINK; break; default: throw new JsonLdError(JsonLdError.Error.INVALID_EMBED_VALUE); } }
throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e);
public String expandIRI(String ns, String name) throws JsonLdError { if (namespaces.containsKey(ns)) { return namespaces.get(ns) + name; } else { throw new JsonLdError(JsonLdError.Error.PARSE_ERROR, "No prefix found for: " + ns + " {line: " + lineNumber + ", position:" + linePosition + "}"); } } }
throw new RuntimeException(e.getMessage(), e); } catch (final IOException e) { throw new RuntimeException(e.getMessage(), e);
private void validateIRI(State state, String iri) throws JsonLdError { if (!IRIREF_MINUS_CONTAINER.matcher(iri).matches()) { throw new JsonLdError(JsonLdError.Error.PARSE_ERROR, "Error while parsing Turtle; invalid IRI after escaping. {line: " + state.lineNumber + "position: " + state.linePosition + "}"); } }
throw new RuntimeException(e.getMessage(), e); } catch (IOException e) { throw new RuntimeException(e.getMessage(), e);
@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."); } }
errorHandler.error(e.getMessage(), -1, -1); throw new RiotException(e) ;
@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."); } }
@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."); } }