Open sideshowtom opened 4 years ago
Looking at that shape, it most likely won't work as-is in the shex converter. This is partially because it is not a shape within a node, but just a set of rules (or rather, a rule) on a root. The converter needs to point at a starting shape, which you cannot easily do with this format.
An example of what I mean can be seen on the userprofile shex shape, which is used in the react SDK profile page. If you're still learning ShEx don't worry - all that matters is the piece at the top:
START=@<#UserProfile>
Then inside the shape there is a <#UserProfile> node that defines the start of the shape, and links/branches out from there. Basically, the form needs some root shape to start building from, and without one we don't know what links to which piece.
Here's an example of the primer example shape you sent that works - however since the school:Enrollee is not part of a node it will not be referenced anywhere in the output. You could add a link inside of the <#PrimerExample> node somewhere, or pull that ex:hasGuardian condition inside of the PrimerExampler.
Hope this helps!
Yes, thanks, that helps. I'm still learning :)
-edit- I'm trying to figure out where the START=@<#UserProfile> syntax is explained. I think its in http://shex.io/shex-semantics/#prod-startActions but I'm not sure. It isn't explained in the shex primer.
If you are interested in learning about ShEx (and SHACL), I recommend Validating RDF Data. There is an HTML version with lots of examples.
Example ShEx shapes and Form Model used when testing the React SDK can be found at https://solidsdk.inrupt.net/public/FormLanguage/examples/.
Thank you! I also didn't know about these documents https://www.w3.org/ns/shex# and http://shex.io/shape-map/
-edit (2)-
Sorry to be so persistent about this, but I just want to make sure I understand, so I know what the Form Model Converter does and how to use it.
What is the field in the Form Model Converter labelled 'ShEx Layout'? Is that the same thing as a shape map?
@sideshowtom The ShEx primer actually doesn't explain START syntax, I opened an issue in the shex repo a while back to address this: https://github.com/shexSpec/primer/issues/18
ShEx Layout is not currently used, it is something new to ShEx that is still experimental in nature. Don't worry about the layout piece for now, as the field value isn't ever read or enabled, it should always be disabled for now.
Sorry if this is user inexperience. In the field labelled 'ShEx Shape' I entered the url https://github.com/sideshowtom/wit2/blob/master/shexPrimerExample.shex which contains
PREFIX school: http://school.example/# PREFIX xsd: http://www.w3.org/2001/XMLSchema# PREFIX ex: http://ex.example/#
school:enrolleeAge xsd:integer MinInclusive 13 MaxInclusive 20
school:Enrollee { ex:hasGuardian IRI {1,2} }
which is an example from the Shex primer, and I left the field labelled 'ShEx Layout' blank. Then when I press convert, a red error box pops up with Error: TypeError: undefined is not a function