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

Extract prefix list into its own library #55

Closed
thewilkybarkid opened this issue Mar 5, 2020 · 10 comments · Fixed by #141 or #153
Closed

Extract prefix list into its own library #55

thewilkybarkid opened this issue Mar 5, 2020 · 10 comments · Fixed by #141 or #153
Labels
enhancement New feature or request

Comments

@thewilkybarkid
Copy link

@zazuko/rdf-vocabularies is quite large (nearly 20MB). tpluscode/rdf-ns-builders@3019d71 was committed to avoid forcing this as a runtime dependency, but there are still cases where it would be useful to have a simple library containing just prefixes.js to avoid having to hard-code the IRIs elsewhere (eg libero/article-store#260 (comment)).

Would it be possible to extract this into its own package? (@zazuko/rdf-vocabulary-prefixes or something?)

@ktk
Copy link
Member

ktk commented Mar 6, 2020

Good point, I think it makes sense to reflect what we were trying to do and what we might want to do in the future and then decide what should be done next.

My initial goal in another repo was to have predefined prefixes that I could use anywhere, a bit like a pre-configured namespaces that would be used within the code but also when I for example serialize to Turtle or do something with JSON-LD. When we started working on that we started to source ontologies, which was more difficult than it should be so we thought it makes sense to store them as well so we don't have to go through that pain every time we need classes/properties of vocabularies.

After that we created prefix.zazuko.com because that made sense with what we had as a base. Later we added some APIs to the prefix service so we can use that from tools that need autocomplete.

So my current list of things that would be useful are

  • prefixes, without content (classes/properties/...). For those who agree with us that this is a good collection of common prefixes
  • the whole schema/ontology in RDF for those who do not use JS but do not want to go through the same pain we did for fetching them. They might probably cherrypick the ones they need
  • the whole schema/ontology in a form that JS libs can use it without the need to parse it first, so in some form of JS structures.

We used it in various ways, I fetched a list of classes/properties for certain prefixes via the API provided by prefix.zazuko.com but some colleagues used it differently.

So @bergos @tpluscode @martinmaillard @vhf @l00mi @mchlrch any comments here?

@tpluscode
Copy link
Contributor

My initial goal in another repo was to have predefined prefixes that I could use anywhere, a bit like a pre-configured namespaces

prefixes, without content

Cue @tpluscode/rdf-ns-builders which @thewilkybarkid mentions above.

You gave me an idea to maybe also generate exports of only property name and only class names, etc.

the whole schema/ontology in RDF

I believe that rdf-vocabularies provides this feature nicely?

the whole schema/ontology in a form that JS libs can use it without the need to parse it first

this might be useful in browser environment if it can make do without importing the large-ish RDF/JS dependencies

@vhf
Copy link
Contributor

vhf commented Mar 9, 2020

there are still cases where it would be useful to have a simple library containing just prefixes.js to avoid having to hard-code the IRIs elsewhere (eg libero/article-store#260 (comment)).

Would it be possible to extract this into its own package? (@zazuko/rdf-vocabulary-prefixes or something?)

I like this idea, it looks clean and simple.

@ktk
Copy link
Member

ktk commented Mar 9, 2020

@tpluscode yes it does, I just want to list all possible use-cases I could think of

@tpluscode
Copy link
Contributor

I just got this idea to extract the code used to generate this package contents (index, etc.) as well as the generator of @tpluscode/rdf-ns-builders

This would allow others to create their own similar packages for other ontologies which we might not want to incorporate in this list for some reason.

@tpluscode
Copy link
Contributor

@thewilkybarkid coming back to this, is the problem the total size of this package? Granted, it is bound to grow until we break it up into smaller pieces (if ever) but at runtime your application would not be affected thanks to tree shaking and dynamic imports.

You can import { prefixes } from '@zazuko/rdf-vocabularies or even import prefixes from '@zazuko/rdf-vocabularies/prefixes' and you will get a plain JS object with all namespaces

Is this good enough to close?

@thewilkybarkid
Copy link
Author

Yeah, it was about NPM usage rather than runtime. This is made worse when using Docker, though BuildKit helps locally as you can now mount in a cache during the build (but not in CI).

@tpluscode
Copy link
Contributor

Ok, here's another idea.

@ktk how about a @zazuko/rdf-vocabularies-lite package which would be exactly the same thing minus the actual datasets? We could have it deployed automatically to match version

@ktk
Copy link
Member

ktk commented Sep 23, 2021

I think we should reflect how we use it right now and how we might use it in the future. Not a problem for me to split things but I would do it in a way that it stays like this for a while.

Right now is very JS centric but the content/ontologies are useful in many other contexts as well.

@tpluscode
Copy link
Contributor

We recently looked at some docker image of our apps. We managed to get it down to ~350 MB where 80 MB was the vocabularies package

I think it does justify the need to separate the actual datasets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants