opening-hours / opening_hours.js

Library to parse and process the opening_hours tag from OpenStreetMap data
https://openingh.ypid.de/evaluation_tool/
222 stars 119 forks source link

Use this library again in JOSM? Depends on Java support. #340

Open ypid opened 4 years ago

ypid commented 4 years ago

A user asked if I am working on a way to run this library on newer versions of Java again to maybe reintroduce it into JOSM where it was removed because of Oracles further directions of Java. For transparency, I am moving this thread to the official bug tracker of the project because this could also be interesting for others.

Personally, I am not working on getting it working on newer versions Java. Neither would I be a good person for contract work to do this (nor am I currently available for this). But I am very interested in having the best support for opening_hours in JOSM there is, be it this library or another one.

I of course have some ideas what could be done, but they are more long-term. #136 is about rewriting the library in a more suitable language. Then I played with calling this library on Android some time ago, see https://github.com/ypid/ComplexAlarm.

Ref: https://josm.openstreetmap.de/ticket/18140

So something similar would be my proposal. Find some way to wrap this library and call it from your favorite language. In #136, there was also another way presented by using NodeJS. Depending on your use case, you can also use the https://github.com/opening-hours/opening_hours_server.js which is still up and running.

There is also https://github.com/simonpoole/OpeningHoursParser of course, but it’s feature set is limited.

This issue can be used to exchange what works and what does not.

Artoria2e5 commented 3 years ago

I have misread the "rewrite in something else and call from NodeJS" thing as "let other languages call NodeJS", which is weird but certainly doable, and might takes less time to "work". The thing to look for is the N-API and napi_call_function. The module system is unavailable, which is a big bummer, but probably still acceptable if you start with the web version. (For JVM you would want to use a different engine. Anything with some sort of run_script and call_function should work.)

The wrapper code is going to need to, uh, collapse the world of JS types into more rigid structs or classess for the outside world. Judging from types/index.d.ts, it would need some way to express tagged unions and date types.


Ahh that's what your project does! sdfhjkajgfdas

ypid commented 3 years ago

Thanks for the tip with using N-API.