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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@verisav/graphql-rdf-vocabularies

v1.0.0

Published

Expose RDF/OWL vocabularies (TTL, JSON-LD) via GraphQL. Used at Verisav for DPP, RMA, WTY. Template for your own ontologies.

Readme

@verisav/graphql-rdf-vocabularies

Expose RDF/OWL vocabularies (Turtle, JSON-LD) via GraphQL.
Parse TTL files, then query classes and properties with optional language. Used in production at Verisav for the DPP, RMA, and WTY vocabularies.

Use this package to serve your own ontologies over GraphQL with minimal setup.

Install

npm install @verisav/graphql-rdf-vocabularies graphql

Quick start

  1. Put your Turtle vocabularies in a folder, e.g.:

    ./vocabularies/
      dpp/
        dpp.ttl
      my-ontology/
        my-ontology.ttl
  2. Create a parser and build the schema:

import { VocabularyParser, buildGraphQLSchema } from '@verisav/graphql-rdf-vocabularies'
import { createYoga } from 'graphql-yoga'

const parser = new VocabularyParser({
  basePath: join(process.cwd(), 'vocabularies'),
  vocabularyFiles: {
    dpp: 'dpp.ttl',
    'my-ontology': 'my-ontology.ttl',
  },
})

const schema = buildGraphQLSchema(parser)
const yoga = createYoga({ schema })

// Serve: e.g. export default yoga (Next.js) or yoga.handle (Node)
  1. Query via GraphQL:
query {
  vocabularies {
    id
    title(lang: "en")
    classes {
      name
      label(lang: "fr")
    }
  }
  vocabulary(id: "dpp") {
    id
    properties {
      name
      type
      domain
    }
  }
}

API

VocabularyParser(config)

  • config.basePath – Directory containing one folder per vocabulary (e.g. vocabularies/).
  • config.vocabularyFiles – Map of vocabulary id → filename (e.g. { dpp: 'dpp.ttl' }).

Methods:

  • parseVocabulary(id: string): Promise<ParsedVocabulary> – Parse and cache one vocabulary.
  • `clearCache(): void – Clear in-memory cache.
  • getVocabularyIds(): string[] – List configured vocabulary ids.

buildGraphQLSchema(parser: VocabularyParser): GraphQLSchema

Builds a GraphQL schema with:

  • Query.vocabularies – List all vocabularies (metadata + classes + properties).
  • Query.vocabulary(id) – One vocabulary by id.
  • Query.classes(vocabularyId) – All classes of a vocabulary.
  • Query.class(vocabularyId, name) – One class by name.
  • Query.properties(vocabularyId) – All properties.
  • Query.property(vocabularyId, name) – One property by name.

Fields title, description, label, comment accept an optional lang argument (e.g. en, fr).

Turtle requirements

Your TTL files should use standard RDF/OWL terms:

  • Classes: rdf:type owl:Class, rdfs:label, rdfs:comment, rdfs:subClassOf.
  • Properties: rdf:type owl:ObjectProperty or owl:DatatypeProperty, rdfs:label, rdfs:comment, rdfs:domain, rdfs:range.
  • Ontology metadata: dc:title, dc:description, dc:creator, owl:versionInfo, etc.

The parser reads from the default graph; it does not support named graphs.

References

License

MIT