Beispiel #1
0
        public void SaveToFile(string filePath, DatasourceFileType fileType)
        {
            try
            {
                switch (fileType)
                {
                case DatasourceFileType.Rdfxml:     // RDF/XML
                    FastRdfXmlWriter rxtw = new FastRdfXmlWriter();
                    rxtw.Save(myGraph, filePath);
                    break;

                case DatasourceFileType.NTriples:     // NTriples
                    NTriplesWriter wr = new NTriplesWriter();
                    wr.Save(myGraph, filePath);
                    break;
                }
            }
            catch (Exception ex)
            {
                MySoapFault fault = new MySoapFault();
                fault.Operation   = "SaveToFile";
                fault.Reason      = "Error in saving datasource from graph to file .";
                fault.Details     = ex.Message;
                fault.MoreDetails = ex.StackTrace;
                throw new FaultException <MySoapFault>(fault);
            }
        }
Beispiel #2
0
        public void LoadFromFile(string filePath, DatasourceFileType fileType)
        {
            try
            {
                switch (fileType)
                {
                case DatasourceFileType.Rdfxml:     // RDF/XML
                    RdfXmlParser rdfXmlParser = new RdfXmlParser(RdfXmlParserMode.Streaming);
                    myGraph = new Graph();
                    rdfXmlParser.Load(myGraph, filePath);
                    break;

                case DatasourceFileType.NTriples:     // NTriples
                    NTriplesParser ntp = new NTriplesParser();
                    myGraph = new Graph();
                    ntp.Load(myGraph, filePath);
                    break;
                }
            }
            catch (Exception ex)
            {
                MySoapFault fault = new MySoapFault();
                fault.Operation   = "LoadFromFile";
                fault.Reason      = "Error in loading datasource file into graph .";
                fault.Details     = ex.Message;
                fault.MoreDetails = ex.StackTrace;
                throw new FaultException <MySoapFault>(fault);
            }
        }