@inrupt/solid-sdk-forms
Solid library for converting and generating Forms
Last updated 9 months ago by james-martin-jd .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @inrupt/solid-sdk-forms 
SYNC missed versions from official npm registry.

Solid SDK Forms

This is a standalone Typescript library designed to handle the creation of Form Models from shapes, and other form-related features.

NOTE: This library is still a work in progress. We are using lessons learned while building the library to improve the code and structure.

Installation

To install, simply run the command

npm install --save @inrupt/solid-sdk-forms

Usage

There are a few things you can do with this library. The most common usage will be converting a ShEx shape to a Form Model object.

This can be done with the following code:

import { ShexFormModel, FormModel } from '@inrupt/solid-sdk-forms';

const formModel = new FormModel();
const schema = await formModel.parseSchema(schemaUrl);
const shexClass = new ShexFormModel(schema);
const formModelOutput = shexClass.convert();

In this example, we are given a schemaUrl (hardcoded or fetched, whichever you prefer) and use the new FormModel class to convert it. The breakdown is as follows:

FormModel.parseSchema

This function fetches and parses the ShEx schema and returns it. This can be in ShExC, ShExR, or ShExJ format.

ShexFormModel.convert

This function, belonging to the ShexFormModel class, does the actual conversion from a ShEx schema to a FormModel object. It does this by the following high level steps:

  1. Find the start shape of the schema. This is the shape in the schema that represents the "beginning" of the shape. If one does not exist, we take the first shape in the array. This is very important when a schema file has multiple shapes in the same file.
  2. Traverse the shape recursively, to build out a Form Model. This will walk the whole schema, including nested and linked shapes, and build out the Form Model from each expression in each shape. During traversal, it detects things like annotations, constraints, and data types to make "best guesses" as to which piece of the Form Model it maps to. The output is currently a string representation of a Turtle (.ttl) file that can be copied/uploaded to a Pod.

Current Tags

  • 0.1.1-dev.6                                ...           dev (10 months ago)
  • 0.1.1                                ...           latest (9 months ago)
  • 0.1.1-rc.0                                ...           rc (10 months ago)

23 Versions

  • 0.1.1                                ...           9 months ago
  • 0.1.1-rc.0                                ...           10 months ago
  • 0.1.1-dev.6                                ...           10 months ago
  • 0.1.1-dev.5                                ...           10 months ago
  • 0.1.1-dev.4                                ...           a year ago
  • 0.1.1-dev.3                                ...           a year ago
  • 0.1.1-dev.2                                ...           a year ago
  • 0.1.1-dev.1                                ...           a year ago
  • 0.1.1-dev.0                                ...           a year ago
  • 0.1.0                                ...           a year ago
  • 0.1.0-rc.3                                ...           a year ago
  • 0.1.0-rc.2                                ...           a year ago
  • 0.1.0-rc.1                                ...           a year ago
  • 0.1.0-dev.0                                ...           a year ago
  • 0.1.0-rc.0                                ...           a year ago
  • 0.0.1-dev.7                                ...           a year ago
  • 0.0.1-dev.6                                ...           a year ago
  • 0.0.1-dev.5                                ...           a year ago
  • 0.0.1-dev.4                                ...           a year ago
  • 0.0.1-dev.3                                ...           a year ago
  • 0.0.1-dev.2                                ...           a year ago
  • 0.0.1-dev.1                                ...           a year ago
  • 0.0.1-dev.0                                ...           a year ago
Downloads
Today 0
This Week 0
This Month 24
Last Day 0
Last Week 0
Last Month 1
Dependencies (15)

Copyright 2014 - 2017 © taobao.org |