pchampin / sophia_rs

Sophia: a Rust toolkit for RDF and Linked Data
Other
214 stars 23 forks source link

Have IriData implement PartialOrd #51

Closed phillord closed 8 months ago

phillord commented 4 years ago

I need to match a number of triples against patterns. But the semantics of RDF make this painful as triples are not naturally ordered. It would make life easier if I could sort the triples first so that they would come out in a predictable order.

This is easiest enough to achieve with IriData by simply calling to_string and comparing these, but there is no real reason to make that String when we could compare the underlying data.

The same would apply for Literal and Variable also.

pchampin commented 4 years ago

Thanks for this suggestion, this is indeed a good idea. We are currently in a big refactoring of the Term type (see for example #47 and #48), so I will probably wait until this is finished to address this issue. But I definitely will...

phillord commented 4 years ago

Thank you. Moving the IRI type out also looks interesting. Currently I have my own IRI type, and have also been using https://docs.rs/curie/0.1.1/curie/ which (effectively) provides a third. Perhaps there needs to be some coming together here, or a separate crate?

pchampin commented 8 months ago

Closing: types in sophia_iri now implement PartialOrd.