Skip to content
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

Change Term::batch_join into something more usable #50

Closed
pchampin opened this issue Mar 2, 2020 · 2 comments
Closed

Change Term::batch_join into something more usable #50

pchampin opened this issue Mar 2, 2020 · 2 comments

Comments

@pchampin
Copy link
Owner

pchampin commented Mar 2, 2020

Currently, there are two ways to resolve (possibly relative) terms agains a base IRI:

  • base.join for one-shot operations,
  • base.batch_join for multiple operations.

The rationale for this design is that joining requires the structure of the base IRI to be parsed, and we do not store that structure in IRI Terms (to save space -- not all IRIs in a graph are expected to be used as base IRIs). batch_join allows to perform the parsing only once, and resolve multiple terms in a row.

A possibly better design would be to have a dedicated type, storing the parsed structure of an IRI, and providing methods to resove terms (and why not, whold triples, quads, or even graphs and datasets?). Term::batch_join would then be replaced by a Term::to_base method, returning such an object. This would allow for this kind of pattern:

let base = some_iri_term.to_base();
let abs_triples = some_triple_source.map_triples(|t| base.join_triple(&t));
@pchampin pchampin mentioned this issue Mar 2, 2020
6 tasks
@MattesWhite
Copy link
Contributor

Isn't this issue solved due to the Resolve-trait?

@pchampin
Copy link
Owner Author

pchampin commented Apr 8, 2020

Absolutely! 🎉

@pchampin pchampin closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants