/// <summary> /// Reads a memory store from a stream of the given RDF format. /// </summary> public static RDFMemoryStore FromStream(RDFStoreEnums.RDFFormats rdfFormat, Stream inputStream) { if (inputStream != null) { switch (rdfFormat) { case RDFStoreEnums.RDFFormats.NQuads: return(RDFNQuads.Deserialize(inputStream)); case RDFStoreEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(inputStream)); } } throw new RDFStoreException("Cannot read RDF memory store from stream because given \"inputStream\" parameter is null."); }
/// <summary> /// Reads a memory store from a file of the given RDF format. /// </summary> public static RDFMemoryStore FromFile(RDFStoreEnums.RDFFormats rdfFormat, string filepath) { if (!string.IsNullOrEmpty(filepath)) { if (File.Exists(filepath)) { switch (rdfFormat) { case RDFStoreEnums.RDFFormats.NQuads: return(RDFNQuads.Deserialize(filepath)); case RDFStoreEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(filepath)); } } throw new RDFStoreException("Cannot read RDF memory store from file because given \"filepath\" parameter (" + filepath + ") does not indicate an existing file."); } throw new RDFStoreException("Cannot read RDF memory store from file because given \"filepath\" parameter is null or empty."); }
/// <summary> /// Reads the given file in the given RDF format to a memory store. /// </summary> public static RDFMemoryStore ReadRDF(RDFStoreEnums.RDFFormats rdfFormat, String filepath) { if (filepath != null) { if (File.Exists(filepath)) { switch (rdfFormat) { case RDFStoreEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(filepath)); case RDFStoreEnums.RDFFormats.NQuads: return(RDFNQuads.Deserialize(filepath)); } } throw new RDFStoreException("Cannot read RDF file because given \"filepath\" parameter (" + filepath + ") does not indicate an existing file."); } throw new RDFStoreException("Cannot read RDF file because given \"filepath\" parameter is null."); }