-
Notifications
You must be signed in to change notification settings - Fork 6
[ADR 03] HTML generation approach
Jose Emilio Labra Gayo edited this page Aug 31, 2024
·
5 revisions
We want to generate HTML views of simple ShEx/SHACL schemas which look similar to Schema.org where, for example, a Person is represented as a table with all the properties, expected types for its values and a description.
We already have some running prototype in shapes converter but we generate HTML in an ad-hoc way and we think it would make more sense to use an external, well maintained library.
- Continue with our own approach. At this moment we are using a set of simple functions written by us to generate HTML. The advantage is 0 external dependencies and 100% fit for our use case. The disadvantage is more code to maintain and that it may be better to leverage on a lot of high quality code that has already been written.
- Build_html is a crate that allows to build HTML code programmatically. It seems to be the library that does what we implemented but has its own crate with well documentation and so on. I am not sure if there is a lot of users that follow this approach, but at least there are some crates that depend on it.
- html seems a similar crate but with more emphasis on well typed HTML. In principle it also looks promising but it seems to be a side project of a single author without a lot of dependant crates.
- askama is a template-like system for Rust. It may make more sense to define a set of templates a fill those templates with the different values.
- minininja is another template engine similar to askama and compatible with jinja2. It seems quite powerful and I think it can suppport reading the templates from a folder which in askama seems more difficult.
- quick-xml is an XML reader and writer. It seems it is used a lot and if it can write XML it can also write HTML. However, it may be too low level for what we want.
-
Other web frameworks in RUST. There are several Rust based web frameworks and some of them have template systems to generate HTML. For example, yew has an
html!
macro that can be used to generate HTML, but yew is considered as outdated in that comparison. We may need to do more research on that list to check if someone fits our use case.
We opted for minininja because it seems to allow dynamic template loading so a user can change the default templates and the templates can be familiar for people using jinja2 templates.
- (RDF) Information about a node in RDF file
- (RDF) Merge several RDF data files
- (RDF/SPARQL) Information about a node in Wikidata
- (ShEx) Show info about a schema
- (ShEx) Validate a specific node with a shape
- (SHACL) Show info about a SHACL schema
- (SHACL) Read a SHACL Shapes graph and convert to some format
- (SHACL) Validating RDF data using SHACL
- (SPARQL) Running SPARQL queries
- (Python) Invoking this library from Python
- (SHACL → ShEx) Convert SHACL shapes graph to ShEx schema
- (ShEx → SVG/PNG/...) Convert a ShEx schema to an UML-like visualization in SVG, PNG, ...
- (ShEx → HTML) Convert ShEx schemas to HTML views
- (ShEx → SPARQL) Convert a simple ShEx schema to SPARQL
- (DCTap → ShEx) Convert a CSV file in DCTap to a ShEx schema
- (DCTap → SVG/PNG/...) Convert a CSV file in DCTap to an UML-like visualization in SVG, PNG, ...