npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@seidhr/sanity-plugin-semantic-sanity

v1.2.0

Published

Convert Sanity Schemas to an OWL ontology and a JSON-LD Context

Downloads

11

Readme

sanity-plugin-semantic-sanity

Convert Sanity Schemas to an OWL ontology and a JSON-LD Context.

Why is this useful? You could create an API endpoint and dump the content of Sanity with a JSON-LD Context, convert the result to RDF and feed the result along with the ontology into a Sparql endpoint!

Mind! This tool only give you a starting point for manuall tweaking. Some can be done with options.semanticSanity, some in a more suitable tool like Protégé.

Also mind! It is more of a PoC than anything else.

Installation

sanity install @seidhr/sanity-plugin-semantic-sanity

Sanity moves the tools default config into /config based on the name used in the install step (i might be wrong). So either use sanity install the full name and scope or use yarn/npm and manual add it to the sanity.json file.

Configuration

The plugin is configured with <your-studio-folder>/config/@seidhr/sanity-plugin-semantic-sanity.json with these defaults.

{
  "name": "Example ontology",
  "base": "http://data.example.org/",
  "vocab": {
    "prefix": "ex",
    "uri": "http://example.org/model/0.1/"
  },
  "prefixes": {
    "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
    "rdfs": "http://www.w3.org/2000/01/rdf-schema#",
    "xsd": "http://www.w3.org/2001/XMLSchema#",
    "owl": "http://www.w3.org/2002/07/owl#"
  }
}
  • name used as ontology title.
  • base is the url used for every document and object in the dataset, http://data.example.org/{_id}.
  • vocab defines the default prefix and url to use for the classes and properties, http://example.org/model/0.1/{name}.
  • prefixes adds prefixes used in options in the schemas. NB! You need to manually add all prefixes used.

Options

Add options to documents, objects and properties.

{
  "options": {
    "semanticSanity": {
      "exclude": true,
      "@container": "@set",
      "@type": "@id",
      "@id": "URL",
      "domain": ["URL"],
      "range": ["URL"],
      "subClassOf": ["URL"],
      "subPropertyOf": ["URL"]
    }
  }
}

exclude

  • Type: boolean
  • Default: false

Use if this document, object or property should be excluded from the OWL ontology and the JSON-LD context.

@container

  • Type: string
  • Default: undefined

@container defines if an array is unordered or ordered. If set, use @set or @list.

@type

  • Type: string
  • Default: undefined

If set, use @id for a relationship using a URI or @json to capture more complex property value as just JSON. For strings you can type them using xsd:date, xsd:dateTime, xsd:boolean or other XML Schema datatypes.

@id

  • Type: string
  • Default: undefined

Override the uri for the document, object or property, e.g. schema:healthCondition or https://schema.org/healthCondition.

domain

  • Type: array
  • Default: undefined

Add domain for document, object or property, e.g. schema:Patient or https://schema.org/Patient. Domain is not a contraint. Adding domain: "schema:Organization" to a property means that for example a document of type Person using this property is also of the type schema:Organization.

range

  • Type: array
  • Default: undefined

Add range for document, object or property, e.g. ex:MedicalCondition or http://exmple.org/MedicalCondition. Range is not a contraint. Adding range: "ex:Sauce" to a property means that for example the document of type ex:Meat that is the target of this property is also of the type ex:Sauce.

subClassOf

  • Type: array
  • Default: undefined

Add subClassOf for document or object, e.g. schema:Person or a URI

subPropertyOf

  • Type: array
  • Default: undefined

Add subPropertyOf for propery, e.g. schema:memberOf or a URI

Issues

semantic-sanity is not thoroughly tested so all feedback is most welcome! Submit issue

License

MIT © Tarje Lavik See LICENSE