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

schema-org-adapter

v7.0.1

Published

Fast, simple & flexible API for the Schema.org Vocabulary (and vocabulary extensions!) for Node and Browsers

Downloads

431

Readme

Features

Empowers the semantic web: Schema.org has become the standard vocabulary for the semantic web. The Schema.org Adapter (SDO-Adapter) gives developers a clear API to access the schema.org vocabulary in a simple way.

Clear data model: The data model of the rdf-based, machine-readable version of Schema.org is slightly adapted (see algorithm documentation for details) to create the clear and pragmatic data model for the Schema.org Adapter.

Supports schema.org versions and external vocabularies: The Schema.org Adapter is lightweight because it does NOT include the vocabulary data, instead it allows the user to input his needed local/remote vocabularies (JSON-LD or URL to JSON-LD). This gives users the possibility to specify the version of Schema.org (including http/https variations) they need, also to use external vocabularies.

Built-in reasoning: The simple-to-use API of this library offers functions and parameters that enable built-in reasoning on the used vocabulary-terms (e.g. resolution of properties, subclasses, ranges, etc.)

Install and load

Independent of the installation and loading method it is expected that a variable named SOA provides this library.

NPM

npm install schema-org-adapter

Node.js

Require/import the package:

const { SOA } = require('schema-org-adapter');
// or
import { SOA } from 'schema-org-adapter';

Browser

Script-include the bundled package in /dist:

<script src="/dist/schema-org-adapter.min.js"></script>
<!--Global variable 'SOA' is available-->

CDN

For the browser you can also directly load the library via CDN:

<script src="https://cdn.jsdelivr.net/gh/semantifyit/schema-org-adapter/dist/schema-org-adapter.min.js"></script>
<!--Global variable 'SOA' is available-->

Usage

// 1. Create an SDO-Adapter instance with the latest schema.org vocabulary version
const mySdoAdapter = await SOA.create({
  schemaVersion: "latest"
});

// 2. Use the SDO-Adapter!

// get all properties that are usable by the class schema:Hotel
const hotelInstance = mySdoAdapter.getClass('schema:Hotel');
const hotelProperties = hotelInstance.getProperties();
// ["schema:audience", "schema:checkinTime", "schema:availableLanguage", ...]

// get all data-types and classes that are valid ranges for the property schema:address
const addressInstance = mySdoAdapter.getProperty("schema:address");
const addressRanges = addressInstance.getRanges();
// ["schema:PostalAddress", "schema:Text"]

Documentation

Technical API documentation

Data Model of the Schema.org Adapter

Expected Vocabulary Structure

Conversion Algorithm for Vocabularies

Code Examples

Example for Node

Example for Browser

All examples

Changelog

History.md

Migration Guide to v6.0.0