I'm really too Shexy for my POD


#1

Well, well, related to my old post about shex shapes and forms, i’ve got some news…

Let’s say you want to build a Todo app with a simple form (note that what I say here could apply to bigger forms too )

What you only do is to define your form as a shexy shape using ShEx language
Let’s take a look !

You need first a Start point that you naturally name start & must write like

start = <Todo>

then you can describe the fields of your form using

<Todo>{
... ... # property of first field & type of the value of the first field  in ttl format
... ... # property of second field & type of the value of the first field   in ttl format
... ... # property of third field & type of the value of the first field   in ttl format
}

for example, our definition could be something like that :

<Todo>{
  schema:name              xsd:string  ;
  schema:dateCreated       xsd:date?  ;
  schema:text              LITERAL  ;
}

You see that we use schema & xsd vocabulary, and adding a “hola:” prefix (used to store data until I finish with foorprint) so the complete definition is something like

PREFIX schema: <https://schema.org/>
PREFIX xsd:  <http://www.w3.org/2001/XMLSchema#>
PREFIX hola: <https://holacratie.solid.community/public/>

start = hola:Todo

hola:Todo{               # A Todo has:
  schema:name              xsd:string  ;
  schema:dateCreated       xsd:date?  ;
  schema:text              LITERAL  ;
}

That’s all !

What the F??? and then ??? what to do with that definition???
nothing more than put the url it in a .shex file on a POD or at an accessible url…
(be sure to use .shex & not .ttl extension)

I’ve put mine at https://holacratie.solid.community/public/Schema/todo_basic.shex

And then ???

Open it with a magic app putting its url as a ?shape_url= parameter…
Something like that, for example :slight_smile:
https://scenaristeur.github.io/holon/?shape_url=https://holacratie.solid.community/public/Schema/todo_basic.shex

And you should see something like that…

Could it be more simple ??? I don’t think…

The write data to the POD, and footprint are in progress, but I couldn’t wait to share it …

So ?
Do you think this could be usefull ?

If you find some interest, there are more complex examples


Question on forms
#2

Yes, by far :stuck_out_tongue_winking_eye: this is something that flitted in my mind (I thought about for a millisecond :wink: It seems that anything always boils down to the xsd schema(or) the leaves are xsd schema fields. Am I getting this right? The difficulty is the stuff inbetween…


#3

That’s a testament to XSD being useful (my experiments reached a similar conclusion). IRIs also show up some and I can imagine support for wgs84 datatypes (which don’t currently exist, but they could someday).

I asked James Martin for links to his ShEx forms work. Channeling James:
[[
https://github.com/inrupt/solid-react-sdk is a decent intro, or https://github.com/inrupt/generator-solid-react for the whole SDK / generator
also https://github.com/inrupt/generator-solid-react#forms-and-form-models and https://github.com/inrupt/solid-react-components#formmodel
]]


#4

thxs
sure xsd:date is used to build an <input type="date"...>

Edit : now that app transform shex to form and can write to holacratie pod if you are logged in https://scenaristeur.github.io/holon/ . Next step is to allow user to choose where to store that data … To be continued…