weso / shaclex

SHACL/ShEx implementation
http://weso.github.io/shaclex
MIT License
76 stars 17 forks source link

Provide a ScalaJS implementation #117

Open labra opened 5 years ago

labra commented 5 years ago

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.

Locke commented 5 years ago

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 commented 5 years ago

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:

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.