oxigraph/rio

Why can a Subject be a Triple?

hoijui opened this issue · 6 comments

Reffering to:
https://docs.rs/rio_api/0.6.1/rio_api/model/enum.Subject.html

To me, that is very confusing.
Could you maybe add a comment explaining that,
maybe referencing the related part of the RDF spec?

Tpt commented

Hi! I have tried a rewording as #64. Does it look better to you?

Thank you!
Though... the documentation you linked to, states:

the subject, which is an IRI or a blank node

So this makes me even more confused,
why your code allows to use a triple as the subject.
I see:

  • NamedNode in code maps to IRI in the definition
  • BlankNode in code maps to blank node in the definition
  • Triple in code ... I don't understand
Tpt commented

Hi! Yes, that's a great point. It's because Rio does support RDF-star that allows triples to be the subject of other triples. To make it less confusing, I can maybe define Subject as the union of NamedNode, BlankNode and Triple without connecting it to the notion of "RDF triple subject". Similarly a Term can be a Triple in Rio.

ahaa!!
thanks, now I got it!
I would like to see this explanation there!

maybe:

pub enum Subject<'a> {
    NamedNode(NamedNode<'a>),
    BlankNode(BlankNode<'a>),
    /// Rio does support [RDF-star](https://w3c.github.io/rdf-star/cg-spec/2021-07-01.html#dfn-triple),
    /// which allows triples to be the subject of other triples.
    /// If you do not use RDF-star, you should not see or use this variant.
    Triple(&'a Triple<'a>),
}

?

Tpt commented

Thank you for taking time to help with that. I have updated the PR #64.

ahh nice, thank you!
that should do now. :-)