RDF playground using WASM-compiled Sophia


SoWasm: an RDF playground based on Sophia

This started as an experiment of compiling Sophia into WebAssembly, and grew into a (hopefully) useful playground for RDF validation, conversion, canonicalization, and possibly more in the future...

Building from source

wasm-pack build --target web


Run a local web server (e.g. with python -m http.server) and visit http://localhost:8000/demo/.

  • Add Monaco editor

    Add Monaco editor

    Hi @pchampin , about https://github.com/pchampin/sowasm/issues/4 I tried running the Monaco editor using the ESM import, and it worked without any issue! (the problem I faced in my app was due to a HighlightJS import conflict). The API to manipulate the Monaco editor is quite straightforward, so I went ahead and updated the app:

    • Use the Monaco editor for input and output, it works exactly like before, but now uses the Monaco editor instead of textarea
    • Enabled automatic language change when the input/output format changes. It switches between xml, json, and sparql (works for every w3c syntax: nt, turtle, quads...)
    • Used the solarized-dark theme from https://github.com/brijeshb42/monaco-themes/tree/master/themes
    • Changed the layout to use flexbox, center items, and make it responsive: on medium and large screen the input and output editor will be displayed side by side, on small screen they will be displayed on top of each other
    • Added the w3c RDF logo as SVG to use as favicon (feel free to change if you have a better idea in mind)

    There is still the placeholder in the input editor to implement, I added a comment with a pointer on how to do it

    Here is what it looks like with the solarized-dark theme:

    Screenshot from 2023-11-29 11-37-06

    And with the solarized-light theme:

    Screenshot from 2023-11-29 11-39-19

    Let me know which changes you would like to do next. I am thinking about this:

    • increase the height of the editors depending on screen size
    • reduce the size of the title to gain space for the rest, and make it more informative. Something like "SoWasm - RDF playground based on Sophia: validate, convert, canonicalize" on 1 line
    opened by vemonet 7
  • More UI improvements

    More UI improvements

    This PR follows up on https://github.com/pchampin/sowasm/pull/12 by making more consequent improvements to the UI

    After a bit of usage it feels like having the 2 editors side by side on medium screen is really hard to read

    The 1st example (JSON-LD) is readable, because really small. But the 2 others examples with XML are a pain to read

    We should try to optimize the screen space used, I propose to:

    • Integrate the "SoWasm" title in the intro paragraph
    • Only put the editor side by side on large screens. From my experience I found it much more enjoyable to use it this way. It is nice to be able to properly read the RDF and edit it if necessary. Having the editors side by side don't have much advantages apart from being able to really quickly see or copy the converted RDF without the need to scroll
    • Change the editor height to be 70vh, this will make the editors takes about 70% of the actual user screen, and prevents the editor from being bigger than the screen (which can be confusing). This way the editor are always large enough for users with medium to small screen, and they can better switch between the 2 editors (each editor takes most of the screen, which prevent confusion and improve focus). Editors also extend properly if the user have a large screen so they can make use of this awesome largeness and comfortably contemplate 2 large RDF files in one glance
    opened by vemonet 1
  • Minor UI improvements

    Minor UI improvements

    A few minor UI improvements:

    • Improve margin around the load URL input
    • Fix some indentations in the HTML
    • Update the body font-family to use sans-serif, which is more adapted to normal text in websites than serif
    • Make the cursor a pointer when hovering the Advanced options expandable div
    opened by vemonet 0
  • Decouple the core of the app from the monaco-editor

    Decouple the core of the app from the monaco-editor

    The addition of the monaco-editor (in response to #4) is very nice (line numbering, syntax and error highlighting...), but it take a significant time at startup.

    It is all the more of an issue when we automatically load content from a URL, because the loading of the URL starts only when the monaco-editor is entirely set up.

    Proposed solution:

    • reinstate the textareas for input and output as they were before PR #9, i.e. all the rest of the application depends on them (and not on the monaco editor)
    • however, they will be kept invisble
    • the monaco-editors will keep in sync with the corresponding textareas, which will be the only "interface" between them and the rest of the application
    • the monaco-editors will be visible (as soon as they are ready)


    • when the application starts, we don't need to wait for the monaco-editors to be ready to start the rest of the application (init SoWasm, setup event listeners, start loading the URL if any)
    • we can even add a checkbox in the advanced options to disable monaco-editors completely, for people who prefer good-old textareas
    opened by pchampin 3
  • Handle redirect manually

    Handle redirect manually

    When corsproxy.io encounters a redirect, it redirects to the "bare" destination, while we would want to use corsproxy.io again for the redirected URL.

    So we should use the redirect: manual parameter of fetch for this.

    bug help wanted 
    opened by pchampin 1
  • Move execution of WASM code into a worker

    Move execution of WASM code into a worker

    On big inputs, the WASM functions sometime take a non negligible time, causing responsiveness problems.

    An alternative would their execution into a worker.

    enhancement help wanted 
    opened by pchampin 1
  • Should 'guess' be more lenient?

    Should 'guess' be more lenient?

    Currently, syntax guessing is performed by trying to parse the whole file. If the file is not valid in any syntax, it is reported as "could not be guessed". This has several drawbacks:

    • it can be relatively long on big input, which hurts responsiveness ;
    • when 'guess' is checked, no useful error message is displayed (it either succeeds to parse, or fails with "could not be guessed")

    An alternative would be to parse only a subset of the string, and result to the syntax that accepts the longest part of the fragment (in other words, that fails the furthest down the road).

    The drawback is that the guessing would be less precise: it would need to always favour N-Quads over N-Triples, even if the sample contains no quad (because the input beyond the sample may still contain quads...). Likewise for TriG and Turtle. Actually, if the sample contains only N-Triples triples, it is impossible to decide with certainty between N-Quads and Turtle/TriG.

    opened by pchampin 0
  • Better error handling.

    Better error handling.

    The error messages often contain the location of the error. This location information should be extracted and presented in a more uniform and readable way.

    If/when #4 is implemented, it would even be better to highlight the error directly in the input editor.

    opened by pchampin 1
Pierre-Antoine Champin
Pierre-Antoine Champin
Fast regex in Rust for Apache Arrow, compiled to WASM

Rust regex in wasm I have been looking for a fast regular expression library in Javascript that runs on Apache Arrow for a few years. Arrow uses UTF-8

Nomic AI 3 May 3, 2023
Program analysis playground for a simple, imperative language

Proggers Proggers is a program analysis playground for a simple, imperative language. Features Numerical analysis using abstract interpretation Type-c

Niels Saurer 32 Nov 24, 2022
A minimal library for building compiled Node.js add-ons in Rust via Node-API

A minimal library for building compiled Node.js add-ons in Rust via Node-API

Node-API (N-API) for Rust 3.1k Dec 29, 2022
A forth-inspired, bytecode-compiled scripting language for Anachro Powerbus

Anachro Forth (core) Anachro Forth is a forth-inspired, bytecode-compiled scripting language for Anachro Powerbus platform. Use Case The intended use

null 14 May 27, 2022
Distribute a wasm SPA as HTML by wrapping it as a polyglot "html+wasm+zip"

A packer that adds a webpage to WASM module, making it self-hosted! Motivation At the moment, Browsers can not execute WebAssembly as a native single

Andreas Molzer 3 Jan 2, 2023
Parametric surfaces drawn using the Rust + WASM toolchain with WebGL, React, and TypeScript.

Parametric Surfaces in the Browser My.Movie.3.mp4 Wanted to experiment with WebGL using the Rust + WASM toolchain, with React and TypeScript to glue e

Benji Nguyen 45 Oct 21, 2022
Realtime audio processing / synthesis using Rust/WASM in the browser.

Rust Audio About This repo is my investigation into using Rust for creative audio coding on various platforms (e.g. desktop, web, etc.), but especiall

Austin Theriot 30 Jan 5, 2023
Low level tooling for WebAssembly in JavaScript using wasm-tools

js-wasm-tools js-wasm-tools compiles some of the API of wasm-tools to JavaScript and WebAssembly via wasm-bindgen. This offers low level tooling for W

Dominic Elm 59 Dec 19, 2022
📦✨ your favorite rust -> wasm workflow tool!

?? ✨ wasm-pack Your favorite Rust → Wasm workflow tool! Docs | Contributing | Chat Built with ?? ?? by The Rust and WebAssembly Working Group About Th

Rust and WebAssembly 4.8k Jan 5, 2023
Facilitating high-level interactions between Wasm modules and JavaScript

wasm-bindgen Facilitating high-level interactions between Wasm modules and JavaScript. Guide | API Docs | Contributing | Chat Built with ?? ?? by The

Rust and WebAssembly 5.9k Jan 8, 2023
Gun port in rust & wasm

gun-rs-wasm Rust & WASM port of Gun. For a non-wasm version, check out gun-rs Example (source) Use npm install rusty-gun import { Node as Gun } from "

Martti Malmi 39 Dec 19, 2022
Install `wasm-pack` by downloading the executable

wasm-pack-action Install wasm-pack by downloading the executable (much faster than cargo install wasm-pack, seconds vs minutes). Usage - uses: jetli/w

Jet Li 33 Nov 23, 2022
`wasm-snip` replaces a WebAssembly function's body with an `unreachable`

wasm-snip wasm-snip replaces a Wasm function's body with an unreachable instruction. API Docs | Contributing | Chat Built with ?? ?? by The Rust and W

Rust and WebAssembly 177 Dec 28, 2022
gc-sections for wasm

wasm-gc Note: you probably don't need to use this project. This project is no longer necessary to run by hand, nor do you need the wasm-gc executable

Alex Crichton 245 Oct 22, 2022
List the symbols within a wasm file

wasm-nm List the symbols within a wasm file. Library Executable License Contributing Executable To install the wasm-nm executable, run $ cargo install

Nick Fitzgerald 38 Nov 6, 2022
Instrument and transform wasm modules.

wasm-instrument A Rust library containing a collection of wasm module instrumentations and transformations mainly useful for wasm based block chains a

Parity Technologies 31 Dec 16, 2022
Just a little game I made in a day to try out the WASM-4 fantasy console.

Dodgeball This is just a little game I made in a day to try out the WASM-4 fantasy console. Play it here. The palette is SODA-CAP by Cappuchi. License

Sander in 't Veld 1 Jan 15, 2022
WebAssembly (Wasm) interpreter.

Continuous Integration Test Coverage Documentation Crates.io wasmi- WebAssembly (Wasm) Interpreter wasmi was conceived as a component of parity-ethere

Parity Technologies 1k Jan 4, 2023
📝 A template for creating WASM + Typescript + Rust workflow libraries.

Create Rust + TypeScript libraries with ease! PR'S WELCOMED! ✨ Inspiration I wanted to create a WebAssembly/Rust library with additional JS features,

Shaoru Ian Huang 25 Dec 24, 2022