1.1.0 • Published 6 years ago

sfvalidator v1.1.0

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

sfvalidator

In-browser dataset validation.

Goals

Validating data sets against the rules listed here within a terminal or browser.

Legal

Technical

Syntactic

Semantic

  • Maximum use of standards

Querying

  • Fragmented data: Check for hydra links and timestamps

  • European DCAT-AP standard

Usage

Node

First install the package:

npm install sfvalidator

Then require it and start validating:

const sfv = require("sfvalidator")

sfv.validate_url("https:://www.example.com").then(result => { console.log(result); }

Terminal

Install the package globaly:

npm install -g sfvalidator

Now you are able to run:

sfvalidator <URL>
sfvalidator --file <file-path>

In-browser

  1. Firstly install or download the module.
  2. Secondely install browserify:

    npm install -g browserify
  3. Then use browserify to bundle the module and its dependencies:

    browserify <path-to-module>/lib/browserify-validator.js -o bundle.js
  4. Now you are able to include this bundle as a script in your webpage and use it:

    <script src="bundle.js"></script>
    <script>
    	validator = new window.sfvalidator();
    	validator.validate_url("https:://www.example.com").then(result => { console.log(result); }
    </script>

See the example folder for a more extensive example.

Output

{
	Accessable: { 
		first_attempt: Score,
	  	seconde_attempt: Score
	},
	License: Score,
	Headers: { 
		Cache: Score,
	   	ETag: Score,
	   	Cors: Score
	},
	Rdf: Score,
	Fragmented: Score,
	Timestamped: Score
}

A Score is of this structure:

{
	score: int -> -1 if failed, 0 if not checked or 1 if passed
	message: Object -> the message from the validator
}

The message attribute can have different values when the element passed the validation: - In case of accessable, rdf and timestamped it is just a string. - In case of the headers it is the value of the header in the returned package. - In case of license and fragmented it is a list of found licenses and hydra links respectfully.

Examples

####Terminal Run npm test.

In-browser

Run npm run-script build-example and then run an http server in the example folder.

1.1.0

6 years ago

1.0.12

6 years ago

1.0.11

6 years ago

1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

6 years ago

1.0.6

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago