/// <summary>Uses a specific serializer.</summary> /// <remarks>Uses a specific serializer.</remarks> /// <exception cref="JsonLdError"></exception> public static async Task <JToken> FromRdfAsync(JToken input, JsonLdOptions options, IRdfParser parser ) { var dataset = parser.Parse(input); // convert from RDF JToken rval = new JsonLdApi(options).FromRdf(dataset); // re-process using the generated context if outputForm is set if (options.outputForm != null) { if ("expanded".Equals(options.outputForm)) { return(rval); } else { if ("compacted".Equals(options.outputForm)) { return(await CompactAsync(rval, dataset.GetContext(), options)); } if ("flattened".Equals(options.outputForm)) { return(await FlattenAsync(rval, dataset.GetContext(), options)); } throw new JsonLdError(JsonLdError.Error.UnknownError); } } return(rval); }
/// <exception cref="JsonLdError"></exception> public static Task <JToken> FromRdfAsync(JToken input, IRdfParser parser) { return(FromRdfAsync(input, new JsonLdOptions(string.Empty), parser)); }
public static void RegisterRdfParser(string format, IRdfParser parser) { rdfParsers[format] = parser; }