4

I need to convert RDF files in XML, through a process in C#. Is this possible?


What I need is a process or command that can convert one or more Oracle report (. Rdf) to XML, for example:

We start example.rdf and need a process that transforms example.rdf in an XML file (example.xml) containing the same information as the rdf file.

I searched and found rwconverter.exe Oracle http://download.oracle.com/docs/html/B10314_01/pbr_cla.htm#634712. I've also been seeing rdf2xml http://www.semwebtech.org/rdf2xml/, but not if it's the right way.

Thank you so much

Bill the Lizard
  • 398,270
  • 210
  • 566
  • 880
Oliver
  • 81
  • 2
  • 7
  • 1
    See http://stackoverflow.com/questions/240903/what-is-a-good-rdf-library-for-net – Jim Mischel Nov 02 '11 at 12:03
  • 3
    Most if not all RDF documents are described in XML. So what exactly is the question? – home Nov 02 '11 at 12:04
  • 1
    Can all RDF graphs be expressed as XML? I didn't think this was the case e.g. nodes with multiple parents. – Tim Lloyd Nov 03 '11 at 00:05
  • 1
    @chibacity Yes you are entirely correct, RDF/XML can only represent a subset of all possible graphs due to a number of technical limitations. Nodes with multiple parents is not actually one of them but there are other problems to do with URIs that cannot be compressed to QNames and XML Literals to name a couple – RobV Nov 03 '11 at 05:26

1 Answers1

4

Your question is unclear but I'll give you a quick example using the open source API dotNetRDF that I'm a developer on to just convert between RDF serializations. If this was not what you meant then you need to expand your question to explain what you want to do as others have already commented.

Simplest way to convert between one RDF serialization and another:

Graph g = new Graph();
g.LoadFromFile("input.ttl");
g.SaveToFile("output.rdf");

The above example would take in input.ttl and attempt to read it as Turtle (does auto-format detection based on file extension) and then attempt to save it as RDF/XML (again does auto-format detection based on file extension).

If your file extensions were not standard you can specify the reader and writer explicitly e.g.

Graph g = new Graph();
g.LoadFromFile("input.temp", new RdfJsonParser());
g.SaveToFile("output.temp", new NTriplesWriter());

That example will read the input file as RDF/JSON and output is as NTriples.

If you are only wanting to do conversion and have large input data to convert there are more memory efficient ways of doing this as the above examples require loading the entire input into memory first. If the input is too big you may hit an OutOfMemoryException in trying to run the above (if your file is several hundred megabytes then the above method is likely to run into this problem).

If you're interested in seeing the alternative conversion method please comment and I can add examples of leveraging the pure streaming conversion APIs but the code is a bit less obvious than these examples.

RobV
  • 28,022
  • 11
  • 77
  • 119
  • What I need is a process or command that can convert one or more Oracle report (. Rdf) to XML, for example: We start example.rdf and need a process that transforms example.rdf in an XML file (example.xml) containing the same information as the rdf file. I searched and found rwconverter.exe Oracle http://download.oracle.com/docs/html/B10314_01/pbr_cla.htm#634712. I've also been seeing rdf2xml http://www.semwebtech.org/rdf2xml/, but not if it's the right way. Thank you so much – Oliver Nov 03 '11 at 10:49
  • If you just want to convert from the Oracle Reports RDF into the Oracle Reports XML then use their converter tool. If you are wanting to convert to some custom XML format then please edit your question to show an example of that target format or link to relevant specifications for it. If you want your question answered it still needs to be much more specific – RobV Nov 03 '11 at 18:49
  • I found what I need. It is explained here [link](http://bloggingaboutoracleapplications.org/oracle-bi-report-migration-utility/) The command I need is: C:\DevSuiteHome_1\BIN>rwconverter batch=yes source="file.rdf" dest="file.xml" dtype=xmlfile overwrite=yes – Oliver Nov 08 '11 at 08:39
  • Here is the wayback url for @Oliver 's link: https://web.archive.org/web/20120313220651/http://bloggingaboutoracleapplications.org/oracle-bi-report-migration-utility/ – SeriousM Feb 17 '22 at 12:16