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

@rmlio/matey

v1.1.1

Published

Web-based editor for YARRRML rules.

Downloads

111

Readme

Matey

A browser-based editor meant for writing YARRRML rules. The corresponding RML rules can be exported for use outside of Matey. Additionally, the rules can be executed on a sample of the data, which allows users to inspect the generated Linked Data.

Table of contents

  1. Requirements
  2. Installation
  3. Usage
  4. Examples
  5. Run tests
  6. License

Requirements

Node.js

Installation

npm i @rmlio/matey

Usage

Setting up the RMLMapper Web API endpoint

To generate Linked Data triples, Matey does its RML mapping through a remote server. For this, Matey requires you to provide an RMLMapper endpoint. You can either provide the URL of an existing server, or set one up yourself by following the instructions here. Make sure that you provide the correct URL for the endpoint during configuration.

Preparing your page

Put a div element with a certain id where you want your Matey editor to be:

<div id="matey-id"></div>

Try to avoid declaring div elements with id's suffixed with "-matey", as most div elements that will be inserted into your page have such an id. For example: elements with id's such as "btn-matey" or "editor-matey" are reserved by Matey.

Setting up Matey by including minified script in page

  • Install dependencies by running npm install.
  • Create minified version by running npm run build:browser, which puts the scripts in the current working directory. You can also choose your own file destination by running browserify lib/index.js --standalone Matey -t urify/transform -t brfs -t browserify-css | terser > my/file/destination.min.js.
  • Start an RMLMapper Web API endpoint (sugggested: rmlmapper-webapi-js)
  • Include the script in your HTML code, and call Matey's init function on an instance of the Matey class:
<head>
    <!-- otherwise browsers won't be able to parse the minified script -->
    <meta charset="UTF-8">
</head>

<script src="matey.min.js" type="text/javascript"></script>
<script>
    let matey = new Matey();
    const config = {
       rmlMapperUrl: "http://localhost:4000/execute" // make sure an RMLMapper endpoint with this URL is active!
    };
    matey.init("matey-id", config);
</script>

Setting up Matey using a bundler

In your JavaScript code, import the Matey class from the package, and on an instance call the init function with the id of the div element for the editor.

const Matey = require("matey");
const matey = new Matey();
const config = {
  rmlMapperUrl: "https://rml.io/api/rmlmapper/execute" // make sure an RMLMapper endpoint with this URL is active!
};
matey.init("matey-id", config);

You can use browserify from within the project's root directory to bundle up the code and its dependencies, so you can include it into your HTML code. The example in the folder examples/with_bundler used the following command to bundle the code up into examples/with_with_bundler/bundle.js:

browserify examples/with_bundler/init.js -t urify/transform -t brfs -t browserify-css --minify=true | terser > examples/with_bundler/bundle.js

The browserify transformations used in the example are necessary for Matey to work.

Configuring Matey

To configure Matey, you can pass a JSON object as an argument to Matey's init method. The configuration options are:

  • rmlMapperUrl: URL of RMLMapper Web API endpoint

An example of calling init with a configuration object would be:

let config = {
    rmlMapperUrl: "http://tw06v069.ugent.be/rmlmapper/process"
};
matey.init("matey-id", config);

Examples

Examples of usage can be found in the examples directory of the project. Both examples illustrate the use of Matey through a single web page which only contains Matey's editors. In these examples, Matey is configured to use an RMLMapper endpoint with URL "http://localhost:4000/execute", so if you want these examples to run, make sure you have such an endpoint set up.

Run tests

The tests also assume that an RMLMapper endpoint with URL http://localhost:4000/execute is up and running. Once you have it set up, run the following commands from inside the project directory:

npm install
npm test

License

This code is copyrighted by Ghent University – imec and released under the MIT license.