pchampin / sophia_rs

Sophia: a Rust toolkit for RDF and Linked Data
Other
210 stars 23 forks source link

XML Serialization! #99

Closed phillord closed 7 months ago

phillord commented 3 years ago

As far as I can see there isn't an XML serializer available at the moment. This would be a nice to have.

Tpt commented 3 years ago

There is already a simple RDF/XML formatter in RIo: https://docs.rs/rio_xml/0.5.1/rio_xml/struct.RdfXmlFormatter.html

phillord commented 3 years ago

Yes, I have seen. I have currently implemented most of my library in terms of sophia. I'm actually fairly unclear about the relationship between sophia and rio; I know that rio has a sophia adaptor as a feature. It isn't clear to me whether I should be using rio directly or sophia as I am at the moment (this wasn't a principled decision on my behalf; I just found sophia first!).

Tpt commented 3 years ago

I'm actually fairly unclear about the relationship between sophia and rio; I know that rio has a sophia adaptor as a feature.

It's a bit complicated indeed. Rio implements some sophia_api traits and sophia wraps the Rio parsers (RDF/XML and Turtle/Trig/Ntriples/NQuads) to provide its own parsing APIs. To summaries, Rio crates have an optional dependency on sophia_api and sophia depends on sophia_api and on the Rio crates. Rio also provides formatters (used in e.g. Oxigraph) but Sophia uses it owns formatters for Turtle and derived formats.

phillord commented 3 years ago

Thank you for the explanation. It's very clear!

pchampin commented 3 years ago

To complete @Tpt's excellent summary: it would indeed be nice to wrap Rio formattes into Sophia's serializer API, the same way it is currently done for parsers... TODO++

pchampin commented 3 years ago

The latest commit (017aab4f) adds a wrapper around Rio's RDF/XML and Turtle parsers. An example of how to use it is provided in sophia/examples/convert.rs.

phillord commented 3 years ago

Thank you indeed!