Serialize() static private méthode

Serializes the given graph to the given stream using TriX data format.
static private Serialize ( RDFGraph graph, Stream outputStream ) : void
graph RDFGraph
outputStream Stream
Résultat void
        /// <summary>
        /// Writes the graph into a file in the given RDF format.
        /// </summary>
        public void ToFile(RDFModelEnums.RDFFormats rdfFormat, String filepath)
        {
            if (!String.IsNullOrEmpty(filepath))
            {
                switch (rdfFormat)
                {
                case RDFModelEnums.RDFFormats.NTriples:
                    RDFNTriples.Serialize(this, filepath);
                    break;

                case RDFModelEnums.RDFFormats.RdfXml:
                    RDFXml.Serialize(this, filepath);
                    break;

                case RDFModelEnums.RDFFormats.TriX:
                    RDFTriX.Serialize(this, filepath);
                    break;

                case RDFModelEnums.RDFFormats.Turtle:
                    RDFTurtle.Serialize(this, filepath);
                    break;

                default:
                    throw new NotImplementedException();
                    break;
                }
            }
            else
            {
                throw new RDFModelException("Cannot write RDF graph to file because given \"filepath\" parameter is null or empty.");
            }
        }
        /// <summary>
        /// Writes the graph into a stream in the given RDF format.
        /// </summary>
        public void ToStream(RDFModelEnums.RDFFormats rdfFormat, Stream outputStream)
        {
            if (outputStream != null)
            {
                switch (rdfFormat)
                {
                case RDFModelEnums.RDFFormats.NTriples:
                    RDFNTriples.Serialize(this, outputStream);
                    break;

                case RDFModelEnums.RDFFormats.RdfXml:
                    RDFXml.Serialize(this, outputStream);
                    break;

                case RDFModelEnums.RDFFormats.TriX:
                    RDFTriX.Serialize(this, outputStream);
                    break;

                case RDFModelEnums.RDFFormats.Turtle:
                    RDFTurtle.Serialize(this, outputStream);
                    break;

                default:
                    throw new NotImplementedException();
                    break;
                }
            }
            else
            {
                throw new RDFModelException("Cannot write RDF graph to stream because given \"outputStream\" parameter is null.");
            }
        }
Exemple #3
0
        /// <summary>
        /// Writes the graph into a file in the given RDF format.
        /// </summary>
        public void ToFile(RDFModelEnums.RDFFormats rdfFormat, String filepath)
        {
            if (filepath != null && filepath.Trim() != String.Empty)
            {
                switch (rdfFormat)
                {
                case RDFModelEnums.RDFFormats.NTriples:
                    RDFNTriples.Serialize(this, filepath);
                    break;

                case RDFModelEnums.RDFFormats.RdfXml:
                    RDFXml.Serialize(this, filepath);
                    break;

                case RDFModelEnums.RDFFormats.TriX:
                    RDFTriX.Serialize(this, filepath);
                    break;

                case RDFModelEnums.RDFFormats.Turtle:
                    RDFTurtle.Serialize(this, filepath);
                    break;
                }
            }
            else
            {
                throw new RDFModelException("Cannot write RDF graph to file because given \"filepath\" parameter is null or empty.");
            }
        }