-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New work item: crate r2c2_term
#6
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! It's definitely the most important goal of our CG but sadly likely one of the trickiest to get right. We need to find a compromise between ease of use and versatility and I fear it won't be easy.
//! 1. define or import simple wrapper types for building blocks | ||
//! (IRIs, language tags...) | ||
//! 2. define traits for different kinds of terms | ||
//! (Subject, Predicate, Object, GraphName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is imho going a bit too much into the "how" direction. It does not sound obvious that these should be traits and not enums.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll argue in favor of traits here:
What I aim is to avoid as much data transformation as possible when communicating between two implementations. That's why I try to favor lighweight wrapper types, and traits.
Imagine I want to consume some triples produced by oxttl
to canonicalize them with sohpia_c14n
. (I'll focus on subjects but of course the same would apply to predicates and objects). If Subject
was an enum, I would have to transform the subjects produced by oxttl
into that enum. And then sophia_c14n
would have to transform this enum again into its own internal representation.
If OTOH Subject
is a trait, which the types of oxttl
implement, and which sophia_c14n
accepts as input, then the data produced by oxttl
can be passed directly to sophia_c14n
, which then will transform it directly into its own internal representation. That's one transformation less.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the other side having an enum makes manipulation easier. I tend to think this is a compromise to be done when we know more about how we represent IRIs/blank nodes/... and should not be set in stone at the beginning of this work item.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm happy to defer this discussion, the goal was not to set anything in stone. I've just pushed a commit to clarify that the proposed design was just an example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Perfect!
Agreed. I tried to not be too specific in the PR, but on the other hand, keeping things too abstract make them without substance. I don't think it would make sense to agree an a very abstract work-item if we don't have some agreement on what it will contain. But of course, we don't need to figure out all the details up-front. |
Yes! What about something in the line of "It would provide types to encode and manipulate RDF concepts like IRI, blank node, literal, term and triple", making the scope clear while leaving the
I would tend to prefer |
Re. terminology:
|
Add comment to clarify that the proposed design can be challenged.
The idea of this crate is to be the first component of the "common API".
It would focus on RDF terms, and would provide
Subject
,Predicate
,Object
,GraphName
)MaybeIri
,MaybeLiteral
...)Also, since triple terms will force use to define a notion of Triple, it might make sense to also define Quad in this crate, although this stretches the scope of the crate a little bit. Should we name it instead
r2c2_term_statement
, which is more accurate, but a little verbose...