Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SHACL shape templates #18

Open
simeonackermann opened this issue Feb 5, 2020 · 2 comments
Open

SHACL shape templates #18

simeonackermann opened this issue Feb 5, 2020 · 2 comments

Comments

@simeonackermann
Copy link
Owner

simeonackermann commented Feb 5, 2020

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 added a commit that referenced this issue Apr 7, 2020
…ons, see #18

Introduce arguments for subforms, textareas, selects etc. ..
simeonackermann added a commit that referenced this issue Apr 7, 2020
@white-gecko
Copy link
Contributor

white-gecko commented Sep 10, 2020

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
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants