static private Deserialize ( Stream inputStream ) : RDFGraph | ||
inputStream | Stream | |
Résultat | RDFGraph |
/// <summary> /// Creates a graph from a stream of the given RDF format. /// </summary> public static RDFGraph FromStream(RDFModelEnums.RDFFormats rdfFormat, Stream inputStream) { if (inputStream != null) { switch (rdfFormat) { case RDFModelEnums.RDFFormats.NTriples: return(RDFNTriples.Deserialize(inputStream)); case RDFModelEnums.RDFFormats.RdfXml: return(RDFXml.Deserialize(inputStream)); case RDFModelEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(inputStream)); case RDFModelEnums.RDFFormats.Turtle: return(RDFTurtle.Deserialize(inputStream)); default: throw new NotImplementedException(); break; } } throw new RDFModelException("Cannot read RDF graph from stream because given \"inputStream\" parameter is null."); }
/// <summary> /// Creates a graph from a file of the given RDF format. /// </summary> public static RDFGraph FromFile(RDFModelEnums.RDFFormats rdfFormat, String filepath) { if (!String.IsNullOrEmpty(filepath)) { if (File.Exists(filepath)) { switch (rdfFormat) { case RDFModelEnums.RDFFormats.NTriples: return(RDFNTriples.Deserialize(filepath)); case RDFModelEnums.RDFFormats.RdfXml: return(RDFXml.Deserialize(filepath)); case RDFModelEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(filepath)); case RDFModelEnums.RDFFormats.Turtle: return(RDFTurtle.Deserialize(filepath)); default: throw new NotImplementedException(); break; } } throw new RDFModelException("Cannot read RDF graph from file because given \"filepath\" parameter (" + filepath + ") does not indicate an existing file."); } throw new RDFModelException("Cannot read RDF graph from file because given \"filepath\" parameter is null or empty."); }
/// <summary> /// Creates a graph from a file of the given RDF format. /// </summary> public static RDFGraph FromFile(RDFModelEnums.RDFFormats rdfFormat, String filepath) { if (filepath != null) { if (File.Exists(filepath)) { switch (rdfFormat) { case RDFModelEnums.RDFFormats.NTriples: return(RDFNTriples.Deserialize(filepath)); case RDFModelEnums.RDFFormats.RdfXml: return(RDFXml.Deserialize(filepath)); case RDFModelEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(filepath)); case RDFModelEnums.RDFFormats.Turtle: throw new RDFModelException("Cannot read RDF graph from file because Turtle format is not supported. What about joining the project to contribute it?"); } } throw new RDFModelException("Cannot read RDF graph from file because given \"filepath\" parameter (" + filepath + ") does not indicate an existing file."); } throw new RDFModelException("Cannot read RDF graph from file because given \"filepath\" parameter is null or empty."); }
/// <summary> /// Creates a graph from a stream of the given RDF format. /// </summary> public static RDFGraph FromStream(RDFModelEnums.RDFFormats rdfFormat, Stream inputStream) { if (inputStream != null) { switch (rdfFormat) { case RDFModelEnums.RDFFormats.NTriples: return(RDFNTriples.Deserialize(inputStream)); case RDFModelEnums.RDFFormats.RdfXml: return(RDFXml.Deserialize(inputStream)); case RDFModelEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(inputStream)); case RDFModelEnums.RDFFormats.Turtle: throw new RDFModelException("Cannot read RDF graph from stream because Turtle format is not supported. What about joining the project to contribute it?"); } } throw new RDFModelException("Cannot read RDF graph from stream because given \"filepath\" parameter is null."); }
internal static RDFGraph FromStream(RDFModelEnums.RDFFormats rdfFormat, Stream inputStream, Uri graphContext) { if (inputStream != null) { switch (rdfFormat) { case RDFModelEnums.RDFFormats.RdfXml: return(RDFXml.Deserialize(inputStream, graphContext)); case RDFModelEnums.RDFFormats.Turtle: return(RDFTurtle.Deserialize(inputStream, graphContext)); case RDFModelEnums.RDFFormats.NTriples: return(RDFNTriples.Deserialize(inputStream, graphContext)); case RDFModelEnums.RDFFormats.TriX: return(RDFTriX.Deserialize(inputStream, graphContext)); } } throw new RDFModelException("Cannot read RDF graph from stream because given \"inputStream\" parameter is null."); }