| Server IP : 82.148.16.210 / Your IP : 216.73.216.19 Web Server : nginx/1.29.5 System : Linux mail.sarafai.ru 6.1.0-43-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.162-1 (2026-02-08) x86_64 User : root ( 0) PHP Version : 7.4.33 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /usr/share/nodejs/n3/lib/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.inDefaultGraph = inDefaultGraph;
exports.isBlankNode = isBlankNode;
exports.isDefaultGraph = isDefaultGraph;
exports.isLiteral = isLiteral;
exports.isNamedNode = isNamedNode;
exports.isVariable = isVariable;
exports.prefix = prefix;
exports.prefixes = prefixes;
var _N3DataFactory = _interopRequireDefault(require("./N3DataFactory"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// **N3Util** provides N3 utility functions.
// Tests whether the given term represents an IRI
function isNamedNode(term) {
return !!term && term.termType === 'NamedNode';
}
// Tests whether the given term represents a blank node
function isBlankNode(term) {
return !!term && term.termType === 'BlankNode';
}
// Tests whether the given term represents a literal
function isLiteral(term) {
return !!term && term.termType === 'Literal';
}
// Tests whether the given term represents a variable
function isVariable(term) {
return !!term && term.termType === 'Variable';
}
// Tests whether the given term represents the default graph
function isDefaultGraph(term) {
return !!term && term.termType === 'DefaultGraph';
}
// Tests whether the given quad is in the default graph
function inDefaultGraph(quad) {
return isDefaultGraph(quad.graph);
}
// Creates a function that prepends the given IRI to a local name
function prefix(iri, factory) {
return prefixes({
'': iri.value || iri
}, factory)('');
}
// Creates a function that allows registering and expanding prefixes
function prefixes(defaultPrefixes, factory) {
// Add all of the default prefixes
const prefixes = Object.create(null);
for (const prefix in defaultPrefixes) processPrefix(prefix, defaultPrefixes[prefix]);
// Set the default factory if none was specified
factory = factory || _N3DataFactory.default;
// Registers a new prefix (if an IRI was specified)
// or retrieves a function that expands an existing prefix (if no IRI was specified)
function processPrefix(prefix, iri) {
// Create a new prefix if an IRI is specified or the prefix doesn't exist
if (typeof iri === 'string') {
// Create a function that expands the prefix
const cache = Object.create(null);
prefixes[prefix] = local => {
return cache[local] || (cache[local] = factory.namedNode(iri + local));
};
} else if (!(prefix in prefixes)) {
throw new Error(`Unknown prefix: ${prefix}`);
}
return prefixes[prefix];
}
return processPrefix;
}