UXF: a plain text human readable storage format supporting custom types

UXF is a plain text human readable optionally typed storage format.

UXF is an alternative to csv, ini, json, toml, and similar formats, useful for both configuration data and application data. Its main advantage is that it supports custom types which can make UXF files more compact and readable; also its syntax is fairly light. (See an example at the end.)

There are now two UXF libraries, one written in Python, and one written in Rust. The rust library includes a uxf executable which can do canonical formatting, linting, and comparisons.

Most of the tests are provided as black box regression tests which makes it easier to compare implementations. For example, on Linux the Python library typically completes the regression tests in just over 42sec, while the Rust library takes just over 2sec. (On Windows the times are 130sec vs 44sec but the test runner is written in Python and uses a network connection to localhost which I think ruins the performance in the Windows 7 VM.)

Here's the start of a GeoJSON example taken from WikiPedia:

{
"type": "FeatureCollection",
"features": [
    {
    "type": "Feature",
    "geometry": {
        "type": "Point",
        "coordinates": [102.0, 0.5]
    },
    "properties": {
        "prop0": "value0"
    }

And here's the complete example converted to canonical UXF:

uxf 1
=Feature geometry properties:map
=LineString points:Point
=Point x:real y:real
=Polygon points:Point
(Feature
  (Point 102.0 0.5) {<prop0> <value0>}
  (LineString (Point 102.0 0.0 103.0 1.0 104.0 0.0 105.0 1.0) {<prop0> <value0> <prop1> 0.0}
  (Polygon (Point 100.0 0.0 101.0 0.0 101.0 1.0 100.0 1.0 100.0 0.0)) {<prop0> <value0> <prop1> {<this> <that>}}
)

This example is shown and explained in full in the UXF Overview.

2 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.