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

Support for containers #8

Open
YuukanOO opened this issue Aug 12, 2020 · 1 comment
Open

Support for containers #8

YuukanOO opened this issue Aug 12, 2020 · 1 comment
Labels
enhancement New feature or request high energy Represents a task which need a lot of energy long-run Planned features for the long-run
Milestone

Comments

@YuukanOO
Copy link
Contributor

YuukanOO commented Aug 12, 2020

Sometimes the same kind of resource is split in multiple documents tied together by containers. For example, blog posts could live in paths blog/year/month/posts.ttl.

As of now, repositories manage a single resource (dataset). We could extend it to allow source to be a container url (in the example given above, source could be <baseurl>/blog). If it's a container, we can determine the dataset needed to persist a data by asking for a (data: TData) => string to return a relative path given a data to persist. With this function, we can determine the needed path from the source root container.

The repository should then create containers and dataset as needed to save the final stuff. It should also enable data to be moved between dataset by checking if the data.url !== generatedUrl.

For type index, we may determine if it's a container with the instanceContainer ?

@YuukanOO YuukanOO added this to the Planned milestone Aug 12, 2020
@YuukanOO YuukanOO added enhancement New feature or request long-run Planned features for the long-run labels Aug 12, 2020
@YuukanOO YuukanOO changed the title Support for multiple datasets for a single resource type Support for containers for a single resource type Aug 19, 2020
@YuukanOO YuukanOO changed the title Support for containers for a single resource type Support for containers Aug 19, 2020
@YuukanOO
Copy link
Contributor Author

YuukanOO commented Sep 5, 2020

For example, if you have blog posts stored by date (http://pod/posts/2019/posts.ttl, http://pod/posts/2020/posts.ttl), you will be able to provide the root (http://pod/posts/) ldp container and an option along the lines:

interface Post {
  permalink: string
  title: string
  date: Date
}

const repo = new Repository<Post>({
  source: "http://pod/posts/",
  // The line below provide informations on how to get a dataset path based on a data to persist
  resolveTo: (post: Post): string => `${post.date.getFullYear()}/posts.ttl`,
  type: "...",
  schema: { ... }
});

And the repository will take care of the rest : creating intermediate containers if it needs to, retrieving posts in nested documents and so on without the developer having to do it itself.

@YuukanOO YuukanOO added the high energy Represents a task which need a lot of energy label Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high energy Represents a task which need a lot of energy long-run Planned features for the long-run
Projects
None yet
Development

No branches or pull requests

1 participant