antoniogarrote / rdfstore-js

JS RDF store with SPARQL support
MIT License
563 stars 109 forks source link

How-to: Serialize results to rdf/xml, turtle, json-ld or N-triples format #57

Open m1ci opened 10 years ago

m1ci commented 10 years ago

Hi!

I need to serialize graph (result from CONSTRUCT or SELECT query) in different RDF serialization formats: rdf/xml, turtle, json-ld and N-triples. I use the graph.toNT() method to get the results in N-triples, what about the rdf/xml and the other formats?

Is there some way to serialize the results in other formats?

Thanks, all the best!

l00mi commented 10 years ago

Hi Milan,

I am just now working in this fields of the rdfstore-js. It is right now not implemented. But a simple rdf/xml serialization should not be a too big problem to include. The .toNT() function uses the .toString() function in the background of the rdfinterface. If you have a look at the .toString() function of the rdfinterface you might see quite fast how to proceed.

Cheers!

On 28.11.2013, at 12:31, Milan Dojčinovski notifications@github.com wrote:

Hi!

I need to serialize graph (result from CONSTRUCT or SELECT query) in different RDF serialization formats: rdf/xml, turtle, json-ld and N-triples. I use the graph.toNT() method to get the results in N-triples, what about the rdf/xml and the other formats?

Is there some way to serialize the results in other formats?

Thanks, all the best!

— Reply to this email directly or view it on GitHub.

m1ci commented 10 years ago

Hi Antonio,

I saw the implementation of the .toNT() function and the use of the .toString(), however, I still do not see how I can serialize the results in RDF/XML. I think you are suggesting writing my own converter to XML (RDF/XML). If I am not wrong, also the RDF/XML results for the SPARQL endpoint you are serializing "manually"...

Cheers!

l00mi commented 10 years ago

Hi Milan,

Yes I think this needs to be implemented still. So you can also get the triples an serialize them yourself in an external function. I think it would make sense to include rdf/xml serializing, especially since now also a rdf/xml parser is included.

Best regards, Michael (not Antonio :-)