RDForm icon indicating copy to clipboard operation
RDForm copied to clipboard

SHACL shape templates

Open simeonackermann opened this issue 5 years ago • 2 comments

Implement SHACL as template language

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

Usage

Attributes

  • template (Object) required, JSON-LD SHACL shape
  • rootShape (string), required if multiple shapes of type sh:NodeShape given, defines the root shape
  • ... see Readme#Parameter for more attributes like hooks, prefixes, base, debug, verbose etc. those are also with SHACL shapes supported supported

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

  • may find root shape
  • targetClass might be optional! alternative dash:applicableToClass, Problem: it's used as rdf:type, which is quite deep integrated...
  • IRI generation with RDF terms, see SHACL property paths
  • describe rdfom: prefix namespace
  • subform hook, callback with next shape
  • new repo rdform-vue

simeonackermann avatar Feb 05 '20 15:02 simeonackermann

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) )

white-gecko avatar Sep 10 '20 11:09 white-gecko

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...

simeonackermann avatar Oct 08 '20 12:10 simeonackermann