# A standard sharing experience?

**URL:** <https://forum.solidproject.org/t/a-standard-sharing-experience/554>\
**Category:** Developer Experience\
**Created:** [November 13, 2018, 10:41pm UTC](https://forum.solidproject.org/t/a-standard-sharing-experience/554 "2018-11-13T22:41:25Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![joshuef](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/joshuef/32/262_2.png) [@joshuef](https://forum.solidproject.org/u/joshuef)\
**Post date:** [November 26, 2018, 11:36am UTC](https://forum.solidproject.org/t/a-standard-sharing-experience/554/5 "2018-11-26T11:36:30Z")

</div>

Hey @justin,

Here’s what I’m imagining could form part of a web dev toolchain (so a JS focus):

I’ve set about defining schemas as JS modules. The aim being that we can then use these at run time to provide feedback to devs / warnings etc, and provide validation.

So using a [Book schema pulled from schema.org](https://github.com/joshuef/schema-doter), using a POC lib for [sheperding data](https://github.com/joshuef/semantic-shepherd)

```auto
import shepderd from '../src/shepherd';
import { Book } from 'schema-doter';
import rdflib from 'rdflib';

const sampleObject = {
    'id' : 'safe://here',
    'author' : 'Josh',
    'publisher' : 'Somebody'
};

let rdf;

rdf = await shepderd( sampleObject, Book );

rdflib.serialize( null, rdf, sampleObject.id, 'text/turtle', ( err, result ) =>
{
    console.log( result ) // Logs a turtle graph as a string
} );

```

The idea here is that the dev doesn’t actually need to worry about RDF _that much_. If you have data and want to ensure its portability, all you need is a schema for your data and you should be able to get going.

After choosing a vocab they can easily convert their data without having to worry about turtle/json-ld etc _at all_.

There’d be no URLs to be resolving for validating the schema once you’ve gotten your schema package installed (so this could work offline, eg).

Having a package available can allow for some validation checks and documentation to be generated for a given schema also.  
So I’ve another proto-lib: [https://github.com/joshuef/rdf-check-mate](https://github.com/joshuef/rdf-check-mate) which could be hooked into a toolchain to throw warnings on invalid data types eg.

Validity:

```auto
// Checking against Book schema from schema.org
import { Book } from 'schema-doter';

const sampleObject = {
    'numberOfPages' : 4,
    'title' : 'Dave',
    'author' : 'me',
    'published' : 'now',
    'publisher' : 'yes '
};

valid = validate( Book, sampleObject );

// This warns in console:
//
// There is some incompatability between your provided object and the schema...
// title , published do not exist on this schema

// But (potentially still...):
console.log( valid ) // true

```

Invalid:

```auto
const badObject = {
    'numberOfPages' : 4.1,
    'title' : 'Dave',
    'author' : 'me',
    'published' : 'now',
    'publisher' : 'yes '
};

valid = validate( Book, badObject );
console.log( valid ) // false

// also throws:
// Candidate data type error: 4.1 is number should be: Integer

```

All of which, I’m hoping could just make it _that bit easier_ to get going with RDF. As above, that’s all proof of concept modules at the mo, but for me, it _seems_ like a simpler way of getting folk to use RDF data, as there’s:

- Less decision paralysis
  - no, schema serialisation to worry about…
  - if there’s limited vocab packages, it’s that much simpler to choose from popular ones, NPM etc can already act as a measure for this.
  - simpler to publish your own schema… as simple as an NPM package anyway…

- Feedback!
  - Get warning or errors when attempting to parse invalid data.
  - Potential to provide/generate a simpler set of documentation for any schemas

- Just use your JS, but with the potential for full RDF.lib objects / serialisation so you should be able to hook into any RDF styled apis easily enough…
  - An no need to get \_into \_ RDFlib and start wondering about literals etc…

Any feedback/thoughts on the above appreciated! And I’m super curious to see what yous have been up to 👍

---

_[View the full topic](https://forum.solidproject.org/t/a-standard-sharing-experience/554)._
