You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Martynas Jusevičius <ma...@atomgraph.com> on 2020/05/15 10:39:07 UTC

Jena transpiled to TypeScript/JavaScript?

Hi,

RDF JavaScript frameworks are still ~20 years behind Java. So this had
me thinking for a while -- instead of reinventing the wheel, would it
be possible to transpile Jena to TypeScript or JavaScript?

ARQ would probably be my number #1 target, but RIOT would also be useful.

From what I've found, J2CL seems to be the framework that should be
able to do it:
"Java to Closure JavaScript transpiler"
https://github.com/google/j2cl

I haven't tried myself yet, but I know that Saxon-CE (which is now
deprecated in favor of the native Saxon-JS) was first ported using
GWT, the predecessor of J2CL.
http://www.saxonica.com/ce/index.xml

Has anyone had similar ideas or done some experiments? Is this realistic at all?

Martynas

Re: Jena transpiled to TypeScript/JavaScript?

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
I'm aware of JSON-LD, but it is hardly relevant here. Not to start a
flame, but I see it as another RDF syntax, no more.

RDF processing can happen on the server as well as on the browser.
SPARQL processor is still a SPARQL processor, no matter where you
place it. And I will at all costs avoid coding an algorithm in JS for
something that can be achieved declaratively, e.g. with SPARQL or
XSLT.

On Fri, May 15, 2020 at 1:07 PM Silvio Domingos
<si...@gmail.com> wrote:
>
> Dear Martynas,
>
> I think that Jena is more focused on back-end process, may i'm wrong :/...
> Perhaps would be better to focus more on JSON-LD that is an improved JSON (+-) lol.
>
> They already have some javascript implementations for that:
> For example:
> https://github.com/digitalbazaar/jsonld.js/
>
> For me, the use of RDF and its derivatives on application side (Sites, exposing APIs ...) should stop now we have jsonld.
>
> Reasons:
>
> 1 ) Json is more friendly for web developers!
> 2 ) Many semantic web tools, like Jena, already supports it ;)
> 3) JSON is faster and uses fewer resources than its XML counterpart https://www.cs.montana.edu/izurieta/pubs/IzurietaCAINE2009.pdf
> 4) Very easily to boost your SEO. See integration for google https://developers.google.com/search/docs/guides/intro-structured-data
>
> Finally, if they manage to integrate json/jsonld and openapi all together, RDF will be really dead for me.
>
> You can check more what is going on with jsonld here: https://github.com/json-ld
>
> Best
> Silvio
>
> On 2020/05/15 10:39:07, Martynas Jusevičius <ma...@atomgraph.com> wrote:
> > Hi,
> >
> > RDF JavaScript frameworks are still ~20 years behind Java. So this had
> > me thinking for a while -- instead of reinventing the wheel, would it
> > be possible to transpile Jena to TypeScript or JavaScript?
> >
> > ARQ would probably be my number #1 target, but RIOT would also be useful.
> >
> > From what I've found, J2CL seems to be the framework that should be
> > able to do it:
> > "Java to Closure JavaScript transpiler"
> > https://github.com/google/j2cl
> >
> > I haven't tried myself yet, but I know that Saxon-CE (which is now
> > deprecated in favor of the native Saxon-JS) was first ported using
> > GWT, the predecessor of J2CL.
> > http://www.saxonica.com/ce/index.xml
> >
> > Has anyone had similar ideas or done some experiments? Is this realistic at all?
> >
> > Martynas
> >

Re: Jena transpiled to TypeScript/JavaScript?

Posted by Silvio Domingos <si...@gmail.com>.
Dear Martynas,

I think that Jena is more focused on back-end process, may i'm wrong :/...
Perhaps would be better to focus more on JSON-LD that is an improved JSON (+-) lol.

They already have some javascript implementations for that:
For example:
https://github.com/digitalbazaar/jsonld.js/

For me, the use of RDF and its derivatives on application side (Sites, exposing APIs ...) should stop now we have jsonld.

Reasons:

1 ) Json is more friendly for web developers!
2 ) Many semantic web tools, like Jena, already supports it ;)
3) JSON is faster and uses fewer resources than its XML counterpart https://www.cs.montana.edu/izurieta/pubs/IzurietaCAINE2009.pdf
4) Very easily to boost your SEO. See integration for google https://developers.google.com/search/docs/guides/intro-structured-data

Finally, if they manage to integrate json/jsonld and openapi all together, RDF will be really dead for me.

You can check more what is going on with jsonld here: https://github.com/json-ld

Best
Silvio

On 2020/05/15 10:39:07, Martynas Jusevičius <ma...@atomgraph.com> wrote: 
> Hi,
> 
> RDF JavaScript frameworks are still ~20 years behind Java. So this had
> me thinking for a while -- instead of reinventing the wheel, would it
> be possible to transpile Jena to TypeScript or JavaScript?
> 
> ARQ would probably be my number #1 target, but RIOT would also be useful.
> 
> From what I've found, J2CL seems to be the framework that should be
> able to do it:
> "Java to Closure JavaScript transpiler"
> https://github.com/google/j2cl
> 
> I haven't tried myself yet, but I know that Saxon-CE (which is now
> deprecated in favor of the native Saxon-JS) was first ported using
> GWT, the predecessor of J2CL.
> http://www.saxonica.com/ce/index.xml
> 
> Has anyone had similar ideas or done some experiments? Is this realistic at all?
> 
> Martynas
> 

Re: Jena transpiled to TypeScript/JavaScript?

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
Adrian,

I'm not against JS per se, I'm against reinventing the bike, wasting
effort and using imperative tech where declarative could do.

RDF/JS is a great initiative, as an RDF API for JS was lacking. Is it
anything specific to JS though? Hardly, it's just OO interfaces and
implementations. Something that Jena had for decades.

What is missing is IMO an RDF graph store and a compatible SPARQL
processor that run in the browser. I haven't tried Comunica yet, but I
hope it fills that gap, as well as node-quadstore [1].

Even so, these projects are in their very early days, compared to a
massive effort put over the years into Jena's compliance, features,
bugfixes, optimizations etc. You would probably agree that we are not
likely to see an OWL API or a reasoner in a JS framework any time
soon?

RDF and SPARQL software is not really language-dependent, and
transpiling and cross-compiling techniques are quite advanced these
days, so why not try to bring (parts of) Jena's time-tested codebase
to the browser? Which would be virtually for free, if it's possible at
all -- which is what I was wondering about. Maybe the performance
would suck, I don't know.


I'm personally excited about the upcoming Saxon-JS 2.0 [2]. It's a
native JS implementation of XSLT 3.0 processor. JS is useful here as
it's not used for the end-to-end implementation, but rather to
implement a processor for a declarative technology.

[1] https://github.com/beautifulinteractions/node-quadstore
[2] http://www.saxonica.com/saxon-js/index.xml

On Fri, May 15, 2020 at 7:54 PM Adrian Gschwend <ml...@netlabs.org> wrote:
>
> On 15.05.20 12:39, Martynas Jusevičius wrote:
>
> Hi
>
> > RDF JavaScript frameworks are still ~20 years behind Java. So this had
> > me thinking for a while -- instead of reinventing the wheel, would it
> > be possible to transpile Jena to TypeScript or JavaScript?
>
> When my colleague sees that I answer your post he will complain that I
> "feed the troll" but I'll give it a try anyway as some in here might
> have missed what happened in the JS world the past few years.
>
> The goal of a JavaScript ecosystem for should be to be as close to what
> JavaScript/Web developers expect as possible. You might not necessarily
> like that but that's a sensible choice for attracting new people to RDF.
>
> Within the RDFJS effort, we managed to define a standard interface for
> RDF and build tooling around it. Have a look at
>
> https://rdf.js.org/
>
> You will find multiple implementations and abstractions on top of these
> interface definitions.
>
> We @Zazuko build additional abstractions on top of it, for example the
> RDF-Ext stack. See an introduction to it here
>
> https://zazuko.com/get-started/developers/
>
> and an overview of libraries here
>
> https://github.com/rdf-ext/rdf-ext
>
> Most recently we re-factored Holgers SHACL reference implementation to
> match these interfaces:
>
> https://github.com/zazuko/rdf-validate-shacl
>
> A great base for doing additional work is Comunica, a modular framework
> for querying the web. It also provides stores & SPARQL interfaces on top:
>
> https://comunica.linkeddatafragments.org/
>
> Quoting from your intro phrase:
>
> > RDF JavaScript frameworks are still ~20 years behind Java.
>
> I know that you Martynas do not give a f-ck about anything that is not
> Java and/or XML but let me ask the question anyway: What exactly would
> you like to do in JavaScript that should be done in JavaScript and
> cannot be done in it right now?
>
> We @Zazuko are happily using JavaScript in Frontend & Backend (Node) and
> rely on things like Fuseki or Stardog that are both written in Java on
> the backend.
>
> We are also experimenting with WASM for things where it does not make
> sense for various reason to approach the problem in JavaScript itself.
>
> But I really fail to see the point of having a full "Jena" API in
> JavaScript, however that would look like.
>
> regards
>
> Adrian
>

Re: Jena transpiled to TypeScript/JavaScript?

Posted by Adrian Gschwend <ml...@netlabs.org>.
On 15.05.20 12:39, Martynas Jusevičius wrote:

Hi

> RDF JavaScript frameworks are still ~20 years behind Java. So this had
> me thinking for a while -- instead of reinventing the wheel, would it
> be possible to transpile Jena to TypeScript or JavaScript?

When my colleague sees that I answer your post he will complain that I
"feed the troll" but I'll give it a try anyway as some in here might
have missed what happened in the JS world the past few years.

The goal of a JavaScript ecosystem for should be to be as close to what
JavaScript/Web developers expect as possible. You might not necessarily
like that but that's a sensible choice for attracting new people to RDF.

Within the RDFJS effort, we managed to define a standard interface for
RDF and build tooling around it. Have a look at

https://rdf.js.org/

You will find multiple implementations and abstractions on top of these
interface definitions.

We @Zazuko build additional abstractions on top of it, for example the
RDF-Ext stack. See an introduction to it here

https://zazuko.com/get-started/developers/

and an overview of libraries here

https://github.com/rdf-ext/rdf-ext

Most recently we re-factored Holgers SHACL reference implementation to
match these interfaces:

https://github.com/zazuko/rdf-validate-shacl

A great base for doing additional work is Comunica, a modular framework
for querying the web. It also provides stores & SPARQL interfaces on top:

https://comunica.linkeddatafragments.org/

Quoting from your intro phrase:

> RDF JavaScript frameworks are still ~20 years behind Java.

I know that you Martynas do not give a f-ck about anything that is not
Java and/or XML but let me ask the question anyway: What exactly would
you like to do in JavaScript that should be done in JavaScript and
cannot be done in it right now?

We @Zazuko are happily using JavaScript in Frontend & Backend (Node) and
rely on things like Fuseki or Stardog that are both written in Java on
the backend.

We are also experimenting with WASM for things where it does not make
sense for various reason to approach the problem in JavaScript itself.

But I really fail to see the point of having a full "Jena" API in
JavaScript, however that would look like.

regards

Adrian