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

vsbl2sparql

v0.2.2

Published

This package provides a Parser for VSBL-Models in JSON to SPARQL

Downloads

11

Readme

vsbl2sparql

This package allows to parse JSONs created by the Visual SPARQL Builder and translate them to SPARQL. It is available as angular module via bower and as node module/standalone via npm.

Example

{
  "CONFIG": "DBPEDIA_CONFIG",
  "START": {
    "type": "LIST_ALL",
    "linkTo": "person"
  },
  "SUBJECTS": [
    {
      "uri": "http://dbpedia.org/ontology/Person",
      "view": true,
      "alias": "person",
      "properties": []
    }
  ]
}

translates to

Select Distinct ?person {?person <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://dbpedia.org/ontology/Person>}

standalone usage

npm install -g vsbl2sparql
cat example.json | vsbl2sparql # Read from stdin, write to stdout
cat example.json | vsbl2sparql -o example.sparql # Read from stdin, write to example.sparql
vsbl2sparql example.json # Read from file, write to stdout
vsbl2sparql example.json -o example.sparql # Read from file, write to example.sparql
#Alternative reading from file:
vsbl2sparql < example.json > example.sparql

npm usage

npm install vsbl2sparql
var vsbl2sparql = require('vsbl2sparql');

var json = JSON.parse('{"CONFIG":"foo","START":{"type":"LIST_ALL","linkTo":"person"},"SUBJECTS":[{"uri":"http://dbpedia.org/ontology/Person","view":true,"alias":"person","properties":[]}]}');

console.log(
  vsbl2sparql.translateJSONToSPARQL(json).toString()
);

angular usage

bower install vsbl2sparql
<html ng-app="app">
<head>
  <style>textarea {width: 450px;height:200px}</style>
</head>
<body ng-controller="appController">

<textarea ng-model="json"></textarea>
<textarea ng-model="sparql" disabled></textarea>

<script src="bower_components/bluebird/js/browser/bluebird.js"></script>
<script src="bower_components/jassa/jassa.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/vsbl2sparql/vsbl2sparql-angular.js"></script>

<script>
angular.module('app',['VSBL2SPARQL'])
  .controller('appController',function($scope, VSBL2SPARQL){
    $scope.json = '{"CONFIG":"foo","START":{"type":"LIST_ALL","linkTo":"person"},"SUBJECTS":[{"uri":"http://dbpedia.org/ontology/Person","view":true,"alias":"person","properties":[]}]}'

    $scope.sparql = VSBL2SPARQL.translateJSONToSPARQL($scope.json).toString()

    $scope.$watch($scope.json,function(json){
      $scope.sparql = VSBL2SPARQL.translateJSONToSPARQL(json).toString()
    });

  })
</script>
</body>
</html>