Comparing version 0.0.2 to 0.0.3
#!/usr/bin/env node | ||
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; | ||
function verb(n) { return function (v) { return step([n, v]); }; } | ||
function step(op) { | ||
if (f) throw new TypeError("Generator is already executing."); | ||
while (g && (g = 0, op[0] && (_ = 0)), _) try { | ||
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; | ||
if (y = 0, t) op = [op[0] & 2, t.value]; | ||
switch (op[0]) { | ||
case 0: case 1: t = op; break; | ||
case 4: _.label++; return { value: op[1], done: false }; | ||
case 5: _.label++; y = op[1]; op = [0]; continue; | ||
case 7: op = _.ops.pop(); _.trys.pop(); continue; | ||
default: | ||
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } | ||
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } | ||
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } | ||
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } | ||
if (t[2]) _.ops.pop(); | ||
_.trys.pop(); continue; | ||
} | ||
op = body.call(thisArg, _); | ||
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } | ||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; | ||
} | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var parser_1 = require("./parser"); | ||
exports.writeDynamic = exports.writeGraph = exports.makeGraph = exports.parseN3File = void 0; | ||
const parser_1 = require("./parser"); | ||
var parser_2 = require("./parser"); | ||
Object.defineProperty(exports, "parseN3File", { enumerable: true, get: function () { return parser_2.parseN3File; } }); | ||
Object.defineProperty(exports, "makeGraph", { enumerable: true, get: function () { return parser_2.makeGraph; } }); | ||
Object.defineProperty(exports, "writeGraph", { enumerable: true, get: function () { return parser_2.writeGraph; } }); | ||
Object.defineProperty(exports, "writeDynamic", { enumerable: true, get: function () { return parser_2.writeDynamic; } }); | ||
if (process.argv.length != 3) { | ||
console.log("usage: ".concat(process.argv[1], " n3-file")); | ||
console.log(`usage: ${process.argv[1]} n3-file`); | ||
process.exit(1); | ||
} | ||
var input = process.argv[2]; | ||
const input = process.argv[2]; | ||
const knownPredicates = [ | ||
'http://www.w3.org/1999/02/22-rdf-syntax-ns#type', | ||
'http://www.w3.org/2000/10/swap/log#onNegativeSurface', | ||
'http://www.w3.org/2000/10/swap/log#onPositiveSurface', | ||
'http://www.w3.org/2000/10/swap/log#onNeutralSurface', | ||
'http://www.w3.org/2000/10/swap/log#onQuerySurface', | ||
'http://www.w3.org/2000/10/swap/log#negativeTriple' | ||
]; | ||
main(input); | ||
function main(path) { | ||
return __awaiter(this, void 0, void 0, function () { | ||
var store, graph, n3s; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: return [4 /*yield*/, (0, parser_1.parseN3File)(path)]; | ||
case 1: | ||
store = _a.sent(); | ||
graph = (0, parser_1.makeGraph)(store); | ||
n3s = (0, parser_1.writeGraph)(graph); | ||
console.log(n3s); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
async function main(path) { | ||
let store; | ||
try { | ||
store = await (0, parser_1.parseN3File)(path); | ||
} | ||
catch (e) { | ||
console.error(e); | ||
process.exit(2); | ||
} | ||
try { | ||
const graph = (0, parser_1.makeGraph)(store); | ||
const dynamic = (0, parser_1.writeDynamic)(graph, knownPredicates); | ||
const n3s = (0, parser_1.writeGraph)(graph); | ||
if (dynamic.length) { | ||
console.log(dynamic); | ||
} | ||
console.log(n3s); | ||
} | ||
catch (e) { | ||
console.error(e.message); | ||
process.exit(3); | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "n32s", | ||
"version": "0.0.2", | ||
"description": "Notation3 to N3S precompiler", | ||
"version": "0.0.3", | ||
"description": "Notation3 (RDF Surfaces) to N3S precompiler", | ||
"main": "js/index.js", | ||
"types": "js/index.d.ts", | ||
"author": "Patrick Hochstenbach <Patrick.Hochstenbach@UGent.be>", | ||
@@ -16,4 +17,10 @@ "license": "MIT", | ||
}, | ||
"files": [ | ||
"js/**/*.d.ts", | ||
"js/**/*.js", | ||
"js/**/*.js.map" | ||
], | ||
"scripts": { | ||
"build": "yarn exec tsc", | ||
"watch": "yarn exec -- tsc --watch", | ||
"demo": "node js/index.js data/00-simple.n3" | ||
@@ -20,0 +27,0 @@ }, |
# n32s | ||
The n32s code is a precompiler from Notation3 to a N3S format that is used by Prolog reasoners such as [eye](https://github.com/eyereasoner/eye), [retina](https://github.com/eyereasoner/retina) and [Latar](https://github.com/MellonScholarlyCommunication/Latar) | ||
The n32s code is a precompiler from Notation3 (RDF Surfaces) to a N3S format that is used by Prolog reasoners such as [eye](https://github.com/eyereasoner/eye), [retina](https://github.com/eyereasoner/retina) and [Latar](https://github.com/MellonScholarlyCommunication/Latar). | ||
@@ -5,0 +5,0 @@ ## Installation |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
27791
440
9
2