A TypeScript library for working with RDF vocabularies in Node.js and browsers. It powers the Mentor VS Code extension, providing structured access to ontologies through a repository pattern and lightweight structural reasoning.
Access RDF resources through specialized repositories that provide type-safe, SPARQL-free querying:
Built-in reasoners expand your RDF graphs with inferred triples:
rdfs:subClassOf, rdfs:subPropertyOf, domain/range inferenceAn RDF.js-compatible triple store with:
Works in Node.js (>=16) and modern browsers:
npm install @faubulous/mentor-rdf
import { Store, VocabularyRepository, OwlReasoner } from '@faubulous/mentor-rdf';
// Create a store with OWL reasoning
const store = new Store(new OwlReasoner());
// Load an ontology
await store.loadFromTurtleStream(turtleData, 'http://example.org/my-ontology');
// Query using repositories
const repository = new VocabularyRepository(store);
// Get all classes defined in the ontology
for (const classUri of repository.getClasses('http://example.org/my-ontology')) {
console.log(classUri);
}
// Get class hierarchy (includes inferred subclass relationships)
const subClasses = repository.getSubClasses('http://example.org/my-ontology', 'http://example.org/MyClass');