provide sophia implementations if the 'sophia' feature is enabled#26
Conversation
Tpt
left a comment
There was a problem hiding this comment.
Thank you for this PR. I just have a global question.
Why integrating all the Sophia adapters in Rio instead of having them in Sophia?
It makes sense for the datamodel where it's trait impls, I have an harder time understanding why it is useful for the parsers where you wrap Rio structs into new ones.
| .into() | ||
| } | ||
| #[inline] | ||
| fn datatype(&self) -> Option<SimpleIri<'_>> { |
There was a problem hiding this comment.
Dumb question about Sophia. Why not returning rdf:langString for language-tagged strings ?
There was a problem hiding this comment.
Because I'm distracted, and that's what it should do! Thanks for spotting that...
There was a problem hiding this comment.
Why integrating all the Sophia adapters in Rio instead of having them in Sophia?
In the end, the sophia crate is meant to become an empty shell re-exporting stuff from other, more specialized crates. And while this is useful for quick prototyping, I would encourage developers of bigger projects to directly pick and chose the specialized package they really need.
Regarding trait impl vs. wrappers: my goal was not (only) to work around Rust limitations for implementing traits on foreign types. It was more generally to add a layer of sophia-compliance atop Rio. Rio provides parsers, it then makes sense that it implements, somehow, the TripleParser/QuadParser traits of Sophia. Since Rio and Sophia have slightly different notions of what a parser is, this needs a few wrappers, but these wrappers are slim enough (I think).
Of course, if you disagree, I will just leave the trait impl and move the wrappers to a separate crate in the Sophia repo.
Thanks to @Tpt for spotting that.
|
To say the truth I would feel better if you keep the Sophia wrappers in a separate crate for now, if it ok for you. We could add to the Rio README a link to it. Sorry for having wasted a bit of your time with this pull request. |
No problem, I understand perfectly :-) I'll remove the Maybe we could meet halfway though, and keep |
Would #27 solve this problem? It makes all the |
I don't mind either way. Anyway, I think I will need to wrap it inside a |
|
I see. I would feel better if everything related to the Sophia parsers are in the |
|
Do you want to move forward with this PR? I would be very happy to add the implementation of Sophia traits to RioApi datamodel. I could do it if you prefer. I plan to do a new release of Rio soon before releasing Oxigraph 0.1 |
instead, introduce macros in rio_api to automate the creations of adapters: - Rio's TriplesParser -> Sophia's TripleSource - Rio's QuadsParser -> Sophia's QuadSource - Rio's GeneralizedQuadsParser -> Sopia's QuadSource
|
Sorry about the delay. I just pushed a new version, where I removed all the Sophia-specific types implementing Sophia's parser traits. Instead, I simply implement TripleSource / QuadSource (which is a straightforward match) for Rio's parsers. The only Sophia-specifc items that are still exposed by
If really you don't want to expose anything (beyond trait impl), I can move them into |
|
Thank you!
Yes, I would feel better to not expose these implementation details in |
now the 'sophia' features only enables trait impl; it adds nothing to the exposed API of the crates.
Done |
|
Thank you! |
As we discussed previously, here is a PR adding Sophia compliance to Rio.
This is "hidden" behind the optional feature
sophia,so it will not have any impact on Rio users not interested in Sophia.