Closed MattesWhite closed 4 years ago
I started writting my Turtle serializer: https://github.com/MattesWhite/metis-rs
For now it is pretty basic and far from usable but the stream serializer already works (kind of). What stops me from advancing at the moment is the abbreviation of IRI, i.e. how to match against a namespace. Maybe something like
impl IriData {
fn match_ns(&'a self, ns: impl AsRef<str>) -> Option<impl Iterator<Item = &'a Char>>;
}
where in case of a match the Iterator
holds the left chars so it matches all (non-)suffixed IRIs...
I can implement this if you want but as said I wait for the serializer API to be merged before continuing my work.
I started writting my Turtle serializer: https://github.com/MattesWhite/metis-rs
Awesome :)
I'm on my way to improve the stream
API (#38), which will open the way to a cleaner Serializer API (#37). Once this is done, I'd like to release a new version. It's been a long time since the last one, and your crate could depend on a stable version rather than a github link...
Regarding match_ns
, that's a good idea, with the following changes:
&str
for the ns
parameter?char
and not Char
&'a char
? Why not simply char
?@MattesWhite could you please have a loop at the latest commit 9a97dae ? It introduces a new Serializer API which I think will please you better than my former attempt #37.
[...] I think will please you better than my former attempt [...]
Your right :smile:, nice work. I created a PR, fixing some minor issues.
The only thing left on the initial agenda is now separating the 'kinds of term' into own modules. We already talked about this in #35 . Should I take care about this or do you want to do this on your own?
Should I take care about this or do you want to do this on your own?
I don't mind if you do ;-)
For now
sophia
only provides serializers forN-Triples
andN-Quads
. In order to support further serializers, we must develop an API for them, i.e. traits and some utilities. This contributes to #23.When ever triples and graphs are mentioned those can be replaced by quad and dataset respectively. If not mentioned otherwise.
Steps towards an improved serializer API
Term::Literal
an own type likeIriData
orBNodeId
. This way it is easier to implement specific serializations for literals.[x] Remove the
n3()
-method fromTerm
. It can be replaced by introducing a trait, e.g.:Or at least rename the method properly.
Serializer
or several specific one, e.g.TripleSerializer
andGraphSerializer
. The first for streams the second for more sophisticated actions (see #17). Some symmetry to theParser
trait would be nice.All points are open to discussion.