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

Provide a ScalaJS implementation #117

Open
labra opened this issue Aug 14, 2018 · 2 comments
Open

Provide a ScalaJS implementation #117

labra opened this issue Aug 14, 2018 · 2 comments
Labels

Comments

@labra
Copy link
Member

labra commented Aug 14, 2018

Shaclex doesn't use any Java-specific feature so it should be easy to offer a ScalaJS version.

At this moment, the main difficulty is to configure sbt adding the ScalaJS option. Some projects that could inspire us are circe.

@labra labra added the SHACLEX label Aug 14, 2018
@Locke
Copy link
Contributor

Locke commented Mar 29, 2019

Shaclex doesn't use any Java-specific feature so it should be easy to offer a ScalaJS version.

To support ScalaJS all library dependencies need to support ScalaJS as well.

This is obviously not the case for Java dependencies like jgrapht, antlr4, jena or rdf4j.

It should be possible to restructure / split some modules to isolate most Java dependencies but from my understanding either jena or rdf4j would still be needed to run Shaclex; at least the jena dependency is pulled into a lot of modules / tests.

With the current libraryDependencies and dependsOn tree only the modules typing and srdf appear to be free of Java dependencies. As both cats and circe support ScalaJS it should be possible to cross compile those two modules to ScalaJS but I can't judge the benefit of that.

@labra
Copy link
Member Author

labra commented Mar 29, 2019

Shaclex doesn't use any Java-specific feature so it should be easy to offer a ScalaJS version.

To support ScalaJS all library dependencies need to support ScalaJS as well.

Yes, or we can provide alternative implementations from the Javascript world. At this moment, all RDF handling from the validation is done through the srdf interfaces in order not to depend no Jena or RDF4j. And that's the core of the Shaclex library.

This is obviously not the case for Java dependencies like jgrapht, antlr4, jena or rdf4j.

Of those dependencies:

  • jgrapht is used mainly as a utility for creating a dependency graph. I think it could be easily be implemented in Scala or maybe using some scala graph libraries that provides the possibility of calculating strongly connected components in a graph.
  • antlr: this one is maybe more difficult although I think it is possible to generate javascript code also from antlr.
  • Jena, RDF4j are outside of the core of the validator which only depends on srdf, so they would not need to be ported to ScalaJs. We would only need to create another implementation of the SRDF interface using some Javascript library for RDF like n3.js

It should be possible to restructure / split some modules to isolate most Java dependencies but from my understanding either jena or rdf4j would still be needed to run Shaclex; at least the jena dependency is pulled into a lot of modules / tests.

Not really...this part has already been isolated so the hardest work has already been done.

With the current libraryDependencies and dependsOn tree only the modules typing and srdf appear to be free of Java dependencies. As both cats and circe support ScalaJS it should be possible to cross compile those two modules to ScalaJS but I can't judge the benefit of that.

Yes, I think most of the libraries that shaclex depends on already work with ScalaJs. The benefit of providing a Shaclex version in ScalaJs would be that the library could work in Javascript environments.

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

No branches or pull requests

2 participants