Coder Social home page Coder Social logo

vue-shacl-form's Introduction

vue-shacl-form

A Vue.js component for HTML5 form generation based on SHACL

Installation

npm i -S vue-shacl-form

Usage

Demo

basic example

<template>
  <div id="app">
    <h1>vue-shacl-form</h1>
    <shacl-form :shapesGraphText="shapes" targetClass="http://example.com/Book" @update="onUpdate"></shacl-form>
    <pre v-text="data"></pre>
  </div>
</template>

<script>
import "bootstrap/dist/css/bootstrap.min.css";
import VueShaclForm from "vue-shacl-form";

const shapes = `
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix sh:   <http://www.w3.org/ns/shacl#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix ex: <http://example.com/> .

ex:BookShape
    a sh:NodeShape ;
    sh:targetClass ex:Book ;
    sh:property [
        sh:path ex:title ;
        sh:minCount 1 ;
    ] ;
    sh:property [
        sh:path ex:author ;
    ] ;
    sh:property [
        sh:path ex:datePublished ;
        sh:datatype xsd:date ;
    ] ;
    sh:property [
        sh:path ex:isbn ;
        sh:pattern "^(97(8|9))?\\\\d{9}(\\\\d|X)$" ;
        sh:maxCount 1 ;
    ] ;
    .
`;

export default {
  name: "app",
  data() {
    return {
      shapes: shapes,
      data: ""
    };
  },
  methods: {
    onUpdate(dataGraph) {
      if (dataGraph) {
        this.data = dataGraph.toNT();
      }
    }
  },
  components: {
    "shacl-form": VueShaclForm
  }
};
</script>

Development

start dev server

npm run serve

build bundle files

npm run build

vue-shacl-form's People

Contributors

babibubebon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

felixpe certiman

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.