rio
rio copied to clipboard
N3 parse support
hello @Tpt , thanks for your work.
It would be great if rio supports n3 parser. n3 is also the format chosen for n3-patch format, by solid spec, to patch solid rdf resources.
Thanks again.
Hi! thank you! It's great idea. I believe this parser should implement the community group spec and return generalized quads similarly to the current "GTrig" parser. Is it what you have in mind?
Yes, indeed _/\_. Other advanced features of n3 for rule -systems are not that required to be modelled now. just generalized-quads support is great enough
hello @tpt,
Solid's N3-patch depends on Cited Formulae, to quote a graph.
How should one proceed, if one want to parse n3 as such?
Hi @damooo! That's a great question. A possible way is to parse Cited Formulae as RDF 1.1 named graph using a new blank node as graph identifier. It's what other parsers like N3.js are doing.
thanks @tpt, Is it possible to have that quoted-graph syntax-extension be supported in gtrig parser, as a blank named graph (By default disabled)?
@damooo It's definitely doable but with a bit of work. I would prefer to implement a clean N3 parser instead.
@Tpt , That would be much more great if it is considered _/\_.
Hello @Tpt ,
I would be soon open sourcing a modular rust implementation of solid server, that will allow running solid in wide range of contexts. And makes it possible to convert solid web apps into native apps using rust + tauri, etc.
But that requires N3 support for PATCH operation over a graph using n3-patch as defined in protocol. solid heavily uses that, and all most all solid apps including solid-os make heavy use of it. Thus servers need parser, and any rust clients need a serializer. Solid is major standard for practical rdf world. It would be very useful if rust has basic tools to work against it.
I am quite new to parsing technlogies. If you can guide me little on adapting GTrig parser for N3 parser as mentioned above, i could give it a try.
I would be soon open sourcing a modular rust implementation of solid server, that will allow running solid in wide range of contexts. And makes it possible to convert solid web apps into native apps using rust + tauri, etc.
It's amazing! Congratulation!
I am quite new to parsing technlogies. If you can guide me little on adapting GTrig parser for N3 parser as mentioned above, i could give it a try.
If you prefer I am currently moving forward with the new parser able to support both sync and async I talked about in #98. I have something working for NTriples that is nearly twice as fast the current parser. I plan to add Turtle, TriG and N3 support to it. So if you are ok to wait a few weeks, I hope to have something working by then.
If not, copy/pasting the GTrig parser code and hacking on top of it should do the work. The rio_turtle
crates work by parsing the input byte by byte using the LookAheadByteReader
struct. If you manage to understand this struct then I hope the code won't be to hard to understand.
About formatting, Turtle is a subset of N3 so the Turtle serializer should output something compatible with N3.
Sincere sorry for this nagging @Tpt .
If you don't take it as bad, can you give approximate ETA for N3, so that i will decide if i have to hack till then.
Thank you.
If you don't take it as bad, can you give approximate ETA for N3, so that i will decide if i have to hack till then.
Sorry, I missed your message. I don't know, something like a month or two. So if you want something "soon" writing a quick&dirty parser might be the way to go.
Thanks @Tpt , I feared it may involve some complex parsing expression graammers, etc. But GTrig parser is clear enough, that i adapted it to simple N3 quick enough. Thanks for great work.
It's been a while since this was last discussed - and it seems like N3 support hasn't landed. I'd love to know if the idea was abandoned altogether or if building on top of rio might still be possible here at some point (I'm working on Solid support for a predominantly Rust-based project)?
@Gearme Yes, it has been a while, sadly. The project is not abandonned but not high priority so it's moving slowly (this work is not funded at all so moves forward on my free time). I have a prototype working in the new-turtle
branch. All tests but one in the N3 test suite works.
To use it add to your Cargo.toml
oxttl = { git = "https://github.com/oxigraph/oxigraph", branch = "new-turtle" }
And then a code like:
use use oxttl::n3::{N3Event, N3Parser};
for q in N3Parser::builder()
.with_base_iri(BASE_IRI_IF_USEFUL)?
.with_read(FILE_CONTENT)
{
match q {
Ok(N3Event::Quad(quad)) => /* process quad, the "graph name" part might be a blank node identifying an N3 formula or default graph if not in a formula */
Err(e) => /* error */
}
}
Although very very late, released solid server at Manas. it uses customized n3 parser as of now. Will be great to have standard one. Thanks again for the support @Tpt.
I finally cut a new release of my N3 parser: https://docs.rs/oxttl/0.1.0-alpha.1/oxttl/n3/struct.N3Parser.html
That's great. _/\_