Closed filippodebortoli closed 7 months ago
Thanks for your interest in Sophia :)
Yes, Sophia could be used for that. More specifically, it can parse this RDF/XML file into a Graph. This can be done by adapting the first part of this example, using the RDF/XML parser instead of the Turtle one. Once you have your Graph, you can use its method (e.g. triples_matching) to browse its triples in order to reconstruct your Object
s and your Term
s.
Sophia does not provide, for the moment, any mechanism to automatically "map" your Graph to custom datatypes (alla Serde). That would be an interesting addition, but it is far from trivial...
I don't think that Rio would be more convenient for this, because like Sophia, it does not provide a better abstraction than triples. And contrarily to Sophia, Rio does not provide a Graph type that you can conveniently query.
quick_xml
could be an option if your RDF/XML file have a very rigid structure (i.e. Objects are always at the top level, Terms are always embedded in their object...), in which case you could use it to write a dedicated parser, that would immediately build your datatypes, without the intermediate notion of graph or triple.
quick_xml could be an option if your RDF/XML file have a very rigid structure (i.e. Objects are always at the top level, Terms are always embedded in their object...), in which case you could use it to write a dedicated parser, that would immediately build your datatypes, without the intermediate notion of graph or triple.
An even simpler method: Use quick-xml
Serde support that allows to easily deserialize XML to Rust structs.
@filippodebortoli I believe this issue can be closed. Do you concur?
You might also be interested in this project: https://github.com/spruceid/linked-data-rs/ . Note that I would like, at some point, to integrate it with Sophia.
@filippodebortoli I believe this issue can be closed. Do you concur?
You might also be interested in this project: https://github.com/spruceid/linked-data-rs/ . Note that I would like, at some point, to integrate it with Sophia.
Yes, my questions have been answered. Thank you very much for the detailed explanation! :-)
I would like to use
sophia
to deserialize RDF/XML files looking like the following example:into a
Vec
ofObject
s according to the following declaration:Is
sophia
the right choice for this task? If so, what is the recommended way to go about the process? If not, would you have any recommendation as to where to look for a solution? The cratequick_xml
seems to be a possibility, I am not well informed about the capabilities ofrio
.By the way, thank you for the great work!