Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@graphy/content.ttl.write

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@graphy/content.ttl.write - npm Package Compare versions

Comparing version 4.2.1 to 4.3.0

62

main.js

@@ -33,4 +33,8 @@

const XC_DIRECTIVES_TYPE_SPARQL = 0b001;
const XC_DIRECTIVES_CASE_PASCAL = 0b010;
const XC_DIRECTIVES_CASE_UPPER = 0b100;
class Turtle_Writer extends Writable {

@@ -51,2 +55,4 @@ constructor(gc_writer={}) {

_b_simplify_default_graph: false,
_xc_directives: 0,
_s_token_prefix: '@prefix',
});

@@ -61,2 +67,46 @@

}
// use sparql directives
let z_directives = gc_style.directives || gc_style.directives;
if(z_directives) {
switch(z_directives) {
case 'sparql': {
this._xc_directives = XC_DIRECTIVES_TYPE_SPARQL;
this._s_token_prefix = 'prefix';
break;
}
case 'Sparql': {
this._xc_directives = XC_DIRECTIVES_TYPE_SPARQL | XC_DIRECTIVES_CASE_PASCAL;
this._s_token_prefix = 'Prefix';
break;
}
case 'SPARQL': {
this._xc_directives = XC_DIRECTIVES_TYPE_SPARQL | XC_DIRECTIVES_CASE_UPPER;
this._s_token_prefix = 'PREFIX';
break;
}
case 'turtle': {
break;
}
case 'Turtle': {
this._xc_directives = XC_DIRECTIVES_CASE_PASCAL;
this._s_token_prefix = '@Prefix';
break;
}
case 'TURTLE': {
this._xc_directives = XC_DIRECTIVES_CASE_UPPER;
this._s_token_prefix = '@PREFIX';
break;
}
default: {
throw new Error(`Value not understood for 'directives' option: ${z_directives}`);
}
}
}
}

@@ -79,2 +129,4 @@

// serialize initial prefix mappings
let s_token_prefix = this._s_token_prefix;
let s_prefix_eol = (this._xc_directives & XC_DIRECTIVES_TYPE_SPARQL)? '\n': ' .\n';
let s_prefixes = '';

@@ -90,3 +142,3 @@ try {

// append to string
s_prefixes += `@prefix ${s_prefix_id}: ${factory.namedNode(h_prefixes[s_prefix_id]).verbose()} .\n`;
s_prefixes += `${s_token_prefix} ${s_prefix_id}: ${factory.namedNode(h_prefixes[s_prefix_id]).verbose()}${s_prefix_eol}`;
}

@@ -116,2 +168,8 @@ }

// ref prefix token
let s_token_prefix = this._s_token_prefix;
// prep eol string
let s_prefix_eol = (this._xc_directives & XC_DIRECTIVES_TYPE_SPARQL)? '\n': ' .\n';
// each user-defined prefix

@@ -125,3 +183,3 @@ for(let s_prefix_id in h_prefixes) {

// append to string
s_prefixes += `@prefix ${s_prefix_id}: ${factory.namedNode(h_prefixes[s_prefix_id]).verbose()} .\n`;
s_prefixes += `${s_token_prefix} ${s_prefix_id}: ${factory.namedNode(h_prefixes[s_prefix_id]).verbose()}${s_prefix_eol}`;

@@ -128,0 +186,0 @@ // set prefix

6

package.json
{
"name": "@graphy/content.ttl.write",
"version": "4.2.1",
"version": "4.3.0",
"description": "RDF Turtle content writer for dynamic and stylized output",

@@ -26,4 +26,4 @@ "keywords": [

"dependencies": {
"@graphy/core.class.writable": "^4.2.1",
"@graphy/core.data.factory": "^4.2.1",
"@graphy/core.class.writable": "^4.3.0",
"@graphy/core.data.factory": "^4.3.0",
"big-integer": "^1.6.48"

@@ -30,0 +30,0 @@ },

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc