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

wurtle

v0.0.1

Published

Utilities to parse grouped quads from the N3-family of serializations based on parser directives

Downloads

16

Readme

Wurtle

Wurtle.js contains utilities to work with RDF serializations (the ones supported by N3.js) that support grouping quads based on a parser directive or pragma in the comments.

Take for example this Turtle file:

# @group begin 0
ex:Collection1 a tree:Collection;
            rdfs:label "A Collection of 2 subjects"@en;
            tree:member ex:Subject1, ex:Subject2 .
# @group end 0
# @group begin 1
ex:Subject1 a ex:Subject ;
            rdfs:label "Subject 1" ;
            ex:linkedTo [ a ex:Subject ] .
# @group end 1
# @group begin 2
ex:Subject2 a ex:Subject ;
            rdfs:label "Subject 2" ;
            ex:linkedTo ex:Subject3 .

ex:Subject3 a ex:Subject ;
            rdfs:label "Subject 3" ;
            ex:linkedTo ex:Subject2 .
# @group end 2

These directives indicate to the parser that each group of triples are a separate message and should be emitted as one group. Instead of a stream of quads, we will thus have waves of quads.

The name: Wurtle stands for the Waved RDF Triple Language, similar to Turtle. In the Dutch dialect of Ghent, Wurtle means carrot (🥕), used as a name for people who complain a lot, when one would like to urge them to be more pragmatic and mild. For example: folks within the RDF community that find this extension to Turtle heresy would be wurtles.

Groups can be nested and overlap: this way quads will be part of multiple groups and will also be emitted multiple times. Quads that are not in any group will be emitted in their own group and will be emitted from the moment they appear.

Utilities

GroupedParser

The grouped parser follows the same pattern as the N3.js Parser documentation. For example:

import {GroupedParser} from 'wurtle';
const parser = new GroupedParser(),
      rdfStream = fs.createReadStream('cartoons.ttl');

parser.parse(rdfStream, (error, groupedQuads) => {
    if (!error)
        console.dir(groupedQuads);
});

The parser will callback groupedQuads from the moment and end group is found. Unclosed groups are emitted at the end of the file.

GroupedStreamParser

Similar as the Parser, but now using NodeJS streams.

import {GroupedStreamParser} from 'wurtle';
const parser = new GroupedStreamParser(),
      rdfStream = fs.createReadStream('cartoons.ttl');

const parsedStream = rdfStream.pipe(parser);
parsedStream.on('data', (groupedQuads) => {
    console.dir(groupedQuads);
});

GroupedWriter

This supports writing out groups of quads. The writer does not support nesting or overlapping groups.

Options of the GrouperWriter is the same options as the N3.Writer

import {GroupedWriter} from 'wurtle';
const writer = new GroupedWriter(options);
writer.addGroupedQuads(quadGroup0);
writer.addGroupedQuads(quadGroup1);
writer.end((error, result) => {
    console.log(result);
});