Serialize() static private method

Serializes the given store to the given filepath using N-Quads data format.
static private Serialize ( RDFStore store, Stream outputStream ) : void
store RDFStore
outputStream Stream
return void
Esempio n. 1
0
        /// <summary>
        /// Writes the given store to the given stream in the given RDF format.
        /// </summary>
        public static void WriteRDF(RDFStoreEnums.RDFFormats rdfFormat, RDFStore store, Stream outputStream)
        {
            if (store != null)
            {
                if (outputStream != null)
                {
                    switch (rdfFormat)
                    {
                    case RDFStoreEnums.RDFFormats.NQuads:
                        RDFNQuads.Serialize(store, outputStream);
                        break;

                    case RDFStoreEnums.RDFFormats.TriX:
                        RDFTriX.Serialize(store, outputStream);
                        break;
                    }
                }
                else
                {
                    throw new RDFStoreException("Cannot write RDF file because given \"outputStream\" parameter is null.");
                }
            }
            else
            {
                throw new RDFStoreException("Cannot write RDF file because given \"store\" parameter is null.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Writes the store into a stream in the given RDF format.
        /// </summary>
        public void ToStream(RDFStoreEnums.RDFFormats rdfFormat, Stream outputStream)
        {
            if (outputStream != null)
            {
                switch (rdfFormat)
                {
                case RDFStoreEnums.RDFFormats.NQuads:
                    RDFNQuads.Serialize(this, outputStream);
                    break;

                case RDFStoreEnums.RDFFormats.TriX:
                    RDFTriX.Serialize(this, outputStream);
                    break;
                }
            }
            else
            {
                throw new RDFStoreException("Cannot write RDF store to stream because given \"outputStream\" parameter is null.");
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Writes the store into a file in the given RDF format.
        /// </summary>
        public void ToFile(RDFStoreEnums.RDFFormats rdfFormat, String filepath)
        {
            if (filepath != null)
            {
                switch (rdfFormat)
                {
                case RDFStoreEnums.RDFFormats.NQuads:
                    RDFNQuads.Serialize(this, filepath);
                    break;

                case RDFStoreEnums.RDFFormats.TriX:
                    RDFTriX.Serialize(this, filepath);
                    break;
                }
            }
            else
            {
                throw new RDFStoreException("Cannot write RDF store to file because given \"filepath\" parameter is null or empty.");
            }
        }