simeonackermann / RDForm

Create and edit RDF data in a HTML form
GNU General Public License v2.0
19 stars 5 forks source link

SHACL shape templates #18

Open simeonackermann opened 4 years ago

simeonackermann commented 4 years ago

Implement SHACL as template language

Branch: https://github.com/simeonackermann/RDForm/tree/feature-shacl

Usage

Attributes

Current supported SHACL properties

Class (sh:NodeShape)

RDForm SHACL Comment
ID @id Required URI of the shape
Type @type = sh:NodeShape Required
URI generation rdform:resource URI of a new resource
TODO RML URI generation see comment 690188701
Target Class sh:targetClass Required
Properties sh:property
Legend sh:name, rdfs:label or @id Name/Label of the Class
TODO: help sh:message

Property (sh:property)

RDForm SHACL Comment
PropertyShape @id Optional, id of used PropertyShape
Property path (object/relation) sh:path Required predicate if @id not given
Datatype sh:datatype eg xsd:string
Label sh.name, rdfs:label or sh:path
Nested Form sh:node IRI of nested shape
External resource sh:nodeKind sh:IRI Only if sh:node not given
Additional property sh:minCount = 0
Required property sh:minCount > 0
Hidden property sh:maxCount = 0
Multiple property sh:maxCount > 1
input types: textarea, select (plus select-options), checkbox, rdform:[type] = true
attributes to subforms rdform:arguments
Placeholder rdform:placeholder
default value rdform:value, TODO: sh:defaultValue
help rdform:help, TODO: may sh:description or sh:message
TODO: groups sh:group
TODO: order sh:order
TODO: class typeof selection -> use sh:property { rdf:type ... } as native SHACL way instead
TODO: Autocompletion (with SPARQL requests) may see sh:select and/or sh:sparql

PropertyShape

RDForm SHACL Comment
ID @id Required URI
Type @type Required sh:PropertyNode
... ... see sh:property

else TODO

white-gecko commented 3 years ago

I suggest to also take the property dash:applicableToClass (http://datashapes.org/dash#) into account. Also check this: http://datashapes.org/forms.html

Regarding TODO multiple rootShapes. I think a drop down would be good or just support a singe rootshape and the including application has to care about making a selection.

Regarding the placeholder I think this is not very important as it is just some kind of label you can make a switch to either render the label as placeholder or leave the placeholder empty.

Regardging iri generation: Keep the string pattern, which is similar to the way how RML is doing it or adapt the way how SHACL expressed property paths. Or a combination of both:

@prefix ex: <http://example.org/> .
# the following prefixes are fake
@prefix rdform: <http://rdform.org/> .
@prefix foaf: <http://foaf.org/> .
@prefix sh: <http://shacl.org/> .

ex:shape rdform:iripattern ( [rdform:iri ex:] "person-" foaf:name )
ex:shape rdform:iripattern "http://example.org/person-{<http://foaf.org/name>}"

ex:kind rdform:iripattern ( [rdform:iri ex:] "kind-von-" ([ sh:inversePath ex:parent ] foaf:name) )
simeonackermann commented 3 years ago

Hm, the class type rdf:type, given by sh:targetClass is quite deep integrated into the logic ;( It's not an easy cake to have it optional...