@faubulous/mentor-rdf-serializers 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +582 -0
- package/dist/base-serializer.d.ts +63 -0
- package/dist/base-serializer.d.ts.map +1 -0
- package/dist/base-serializer.js +144 -0
- package/dist/base-serializer.js.map +1 -0
- package/dist/base-token-formatter.d.ts +225 -0
- package/dist/base-token-formatter.d.ts.map +1 -0
- package/dist/base-token-formatter.js +521 -0
- package/dist/base-token-formatter.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonld/serializer.d.ts +99 -0
- package/dist/jsonld/serializer.d.ts.map +1 -0
- package/dist/jsonld/serializer.js +282 -0
- package/dist/jsonld/serializer.js.map +1 -0
- package/dist/n3/formatter.d.ts +105 -0
- package/dist/n3/formatter.d.ts.map +1 -0
- package/dist/n3/formatter.js +444 -0
- package/dist/n3/formatter.js.map +1 -0
- package/dist/n3/serializer.d.ts +103 -0
- package/dist/n3/serializer.d.ts.map +1 -0
- package/dist/n3/serializer.js +134 -0
- package/dist/n3/serializer.js.map +1 -0
- package/dist/nquads/formatter.d.ts +44 -0
- package/dist/nquads/formatter.d.ts.map +1 -0
- package/dist/nquads/formatter.js +116 -0
- package/dist/nquads/formatter.js.map +1 -0
- package/dist/nquads/serializer.d.ts +38 -0
- package/dist/nquads/serializer.d.ts.map +1 -0
- package/dist/nquads/serializer.js +70 -0
- package/dist/nquads/serializer.js.map +1 -0
- package/dist/ntriples/formatter.d.ts +44 -0
- package/dist/ntriples/formatter.d.ts.map +1 -0
- package/dist/ntriples/formatter.js +116 -0
- package/dist/ntriples/formatter.js.map +1 -0
- package/dist/ntriples/serializer.d.ts +38 -0
- package/dist/ntriples/serializer.d.ts.map +1 -0
- package/dist/ntriples/serializer.js +79 -0
- package/dist/ntriples/serializer.js.map +1 -0
- package/dist/sorting/index.d.ts +5 -0
- package/dist/sorting/index.d.ts.map +1 -0
- package/dist/sorting/index.js +5 -0
- package/dist/sorting/index.js.map +1 -0
- package/dist/sorting/strategies.d.ts +46 -0
- package/dist/sorting/strategies.d.ts.map +1 -0
- package/dist/sorting/strategies.js +259 -0
- package/dist/sorting/strategies.js.map +1 -0
- package/dist/sparql/formatter.d.ts +103 -0
- package/dist/sparql/formatter.d.ts.map +1 -0
- package/dist/sparql/formatter.js +764 -0
- package/dist/sparql/formatter.js.map +1 -0
- package/dist/token-serializer.d.ts +96 -0
- package/dist/token-serializer.d.ts.map +1 -0
- package/dist/token-serializer.js +456 -0
- package/dist/token-serializer.js.map +1 -0
- package/dist/trig/formatter.d.ts +99 -0
- package/dist/trig/formatter.d.ts.map +1 -0
- package/dist/trig/formatter.js +418 -0
- package/dist/trig/formatter.js.map +1 -0
- package/dist/trig/serializer.d.ts +39 -0
- package/dist/trig/serializer.d.ts.map +1 -0
- package/dist/trig/serializer.js +170 -0
- package/dist/trig/serializer.js.map +1 -0
- package/dist/turtle/formatter.d.ts +56 -0
- package/dist/turtle/formatter.d.ts.map +1 -0
- package/dist/turtle/formatter.js +325 -0
- package/dist/turtle/formatter.js.map +1 -0
- package/dist/turtle/serializer.d.ts +87 -0
- package/dist/turtle/serializer.d.ts.map +1 -0
- package/dist/turtle/serializer.js +343 -0
- package/dist/turtle/serializer.js.map +1 -0
- package/dist/types.d.ts +323 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +14 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +157 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +446 -0
- package/dist/utils.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { RdfSyntax } from '../types.js';
|
|
2
|
+
import { TurtleSerializer } from '../turtle/serializer.js';
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a term is an N3 formula.
|
|
5
|
+
*/
|
|
6
|
+
export function isN3Formula(term) {
|
|
7
|
+
return term !== null && typeof term === 'object' && term.termType === 'Formula';
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Checks if a term is an N3 quick variable.
|
|
11
|
+
*/
|
|
12
|
+
export function isN3QuickVariable(term) {
|
|
13
|
+
return term !== null && typeof term === 'object' && term.termType === 'QuickVariable';
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Serializer for N3 (Notation3) format.
|
|
17
|
+
*
|
|
18
|
+
* N3 extends Turtle with additional features:
|
|
19
|
+
* - Formulas (graph literals): { ... }
|
|
20
|
+
* - Implications: { antecedent } => { consequent }
|
|
21
|
+
* - Universal quantification: @forAll :x .
|
|
22
|
+
* - Existential quantification: @forSome :x .
|
|
23
|
+
* - Quick variables: ~x
|
|
24
|
+
* - Built-in predicates for logic and computation
|
|
25
|
+
*
|
|
26
|
+
* @see https://w3c.github.io/N3/spec/
|
|
27
|
+
*/
|
|
28
|
+
export class N3Serializer extends TurtleSerializer {
|
|
29
|
+
syntax = RdfSyntax.N3;
|
|
30
|
+
n3Options = {};
|
|
31
|
+
/**
|
|
32
|
+
* The log: namespace IRI for N3 built-ins.
|
|
33
|
+
*/
|
|
34
|
+
static LOG_NAMESPACE = 'http://www.w3.org/2000/10/swap/log#';
|
|
35
|
+
/**
|
|
36
|
+
* The log:implies predicate IRI.
|
|
37
|
+
*/
|
|
38
|
+
static LOG_IMPLIES = `${N3Serializer.LOG_NAMESPACE}implies`;
|
|
39
|
+
/**
|
|
40
|
+
* The owl:sameAs predicate IRI.
|
|
41
|
+
*/
|
|
42
|
+
static OWL_SAMEAS = 'http://www.w3.org/2002/07/owl#sameAs';
|
|
43
|
+
/**
|
|
44
|
+
* Serializes a single quad to N3 format.
|
|
45
|
+
*/
|
|
46
|
+
serializeQuad(quad, options) {
|
|
47
|
+
const opts = this.getN3Options(options);
|
|
48
|
+
// Check for implications shorthand
|
|
49
|
+
if (opts.useImpliesShorthand !== false &&
|
|
50
|
+
quad.predicate.termType === 'NamedNode' &&
|
|
51
|
+
quad.predicate.value === N3Serializer.LOG_IMPLIES) {
|
|
52
|
+
const subject = this.serializeN3Term(quad.subject, opts);
|
|
53
|
+
const object = this.serializeN3Term(quad.object, opts);
|
|
54
|
+
return `${subject} => ${object} .`;
|
|
55
|
+
}
|
|
56
|
+
// Check for sameAs shorthand
|
|
57
|
+
if (opts.useSameAsShorthand !== false &&
|
|
58
|
+
quad.predicate.termType === 'NamedNode' &&
|
|
59
|
+
quad.predicate.value === N3Serializer.OWL_SAMEAS) {
|
|
60
|
+
const subject = this.serializeN3Term(quad.subject, opts);
|
|
61
|
+
const object = this.serializeN3Term(quad.object, opts);
|
|
62
|
+
return `${subject} = ${object} .`;
|
|
63
|
+
}
|
|
64
|
+
const subject = this.serializeN3Term(quad.subject, opts);
|
|
65
|
+
const predicate = this.serializeN3Term(quad.predicate, opts);
|
|
66
|
+
const object = this.serializeN3Term(quad.object, opts);
|
|
67
|
+
return `${subject} ${predicate} ${object} .`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Serializes a term with N3-specific handling.
|
|
71
|
+
*/
|
|
72
|
+
serializeN3Term(term, opts) {
|
|
73
|
+
if (isN3Formula(term)) {
|
|
74
|
+
return this.serializeFormula(term, opts);
|
|
75
|
+
}
|
|
76
|
+
if (isN3QuickVariable(term)) {
|
|
77
|
+
return `~${term.value}`;
|
|
78
|
+
}
|
|
79
|
+
return this.serializeTerm(term, opts);
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Serializes an N3 formula (graph literal).
|
|
83
|
+
*/
|
|
84
|
+
serializeFormula(formula, opts) {
|
|
85
|
+
if (formula.quads.length === 0) {
|
|
86
|
+
return '{}';
|
|
87
|
+
}
|
|
88
|
+
const indent = opts.prettyPrint ? opts.indent : '';
|
|
89
|
+
const lineEnd = opts.prettyPrint ? opts.lineEnd : ' ';
|
|
90
|
+
if (opts.prettyPrint && formula.quads.length > 1) {
|
|
91
|
+
const lines = formula.quads.map(q => {
|
|
92
|
+
const s = this.serializeN3Term(q.subject, opts);
|
|
93
|
+
const p = this.serializeN3Term(q.predicate, opts);
|
|
94
|
+
const o = this.serializeN3Term(q.object, opts);
|
|
95
|
+
return `${indent}${s} ${p} ${o} .`;
|
|
96
|
+
});
|
|
97
|
+
return `{${lineEnd}${lines.join(lineEnd)}${lineEnd}}`;
|
|
98
|
+
}
|
|
99
|
+
const triples = formula.quads.map(q => {
|
|
100
|
+
const s = this.serializeN3Term(q.subject, opts);
|
|
101
|
+
const p = this.serializeN3Term(q.predicate, opts);
|
|
102
|
+
const o = this.serializeN3Term(q.object, opts);
|
|
103
|
+
return `${s} ${p} ${o} .`;
|
|
104
|
+
}).join(' ');
|
|
105
|
+
return `{ ${triples} }`;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Serializes a variable (N3 supports both ?var and $var syntax).
|
|
109
|
+
*/
|
|
110
|
+
serializeVariable(variable, _opts) {
|
|
111
|
+
return `?${variable.value}`;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Gets merged N3 options with defaults.
|
|
115
|
+
*/
|
|
116
|
+
getN3Options(options) {
|
|
117
|
+
const baseOpts = this.getOptions(options);
|
|
118
|
+
return {
|
|
119
|
+
...baseOpts,
|
|
120
|
+
useImpliesShorthand: options?.useImpliesShorthand ?? true,
|
|
121
|
+
useSameAsShorthand: options?.useSameAsShorthand ?? true,
|
|
122
|
+
useQuantifiers: options?.useQuantifiers ?? true
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Formats quads with detailed result information.
|
|
127
|
+
*/
|
|
128
|
+
format(quads, options) {
|
|
129
|
+
return {
|
|
130
|
+
output: this.serialize(quads, options)
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources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,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;YAClD,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;YAC/C,OAAO,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;QAC9B,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,OAAO,KAAK,OAAO,IAAI,CAAC;IAC5B,CAAC;IAED;;OAEG;IACgB,iBAAiB,CAAC,QAAkB,EAAE,KAAkC;QACvF,OAAO,IAAI,QAAQ,CAAC,KAAK,EAAE,CAAC;IAChC,CAAC;IAED;;OAEG;IACK,YAAY,CAAC,OAA6B;QAC9C,MAAM,QAAQ,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO;YACH,GAAG,QAAQ;YACX,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,IAAI,IAAI;YACzD,kBAAkB,EAAE,OAAO,EAAE,kBAAkB,IAAI,IAAI;YACvD,cAAc,EAAE,OAAO,EAAE,cAAc,IAAI,IAAI;SAClD,CAAC;IACN,CAAC;IAED;;OAEG;IACM,MAAM,CAAC,KAAiC,EAAE,OAA6B;QAC5E,OAAO;YACH,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;SACzC,CAAC;IACN,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IToken } from 'chevrotain';
|
|
2
|
+
import type { IRdfFormatter, SerializationResult, SerializerOptions, TokenSerializerOptions, RdfSyntax as RdfSyntaxType } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* N-Quads-specific formatting options.
|
|
5
|
+
*/
|
|
6
|
+
export interface NQuadsFormatterOptions extends SerializerOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Whether to normalize whitespace to single spaces.
|
|
9
|
+
* Default: true
|
|
10
|
+
*/
|
|
11
|
+
normalizeWhitespace?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Formatter for N-Quads (line-based RDF dataset format).
|
|
15
|
+
*
|
|
16
|
+
* N-Quads extends N-Triples to support named graphs.
|
|
17
|
+
* Each line contains: subject predicate object [graph] .
|
|
18
|
+
*
|
|
19
|
+
* This formatter normalizes spacing and ensures proper line endings.
|
|
20
|
+
*
|
|
21
|
+
* @see https://www.w3.org/TR/rdf12-n-quads/
|
|
22
|
+
*/
|
|
23
|
+
export declare class NQuadsFormatter implements IRdfFormatter {
|
|
24
|
+
readonly syntax: RdfSyntaxType;
|
|
25
|
+
private lexer;
|
|
26
|
+
/**
|
|
27
|
+
* Formats an N-Quads document.
|
|
28
|
+
*/
|
|
29
|
+
formatFromText(input: string, options?: NQuadsFormatterOptions): SerializationResult;
|
|
30
|
+
/**
|
|
31
|
+
* Formats from already-parsed tokens.
|
|
32
|
+
*/
|
|
33
|
+
formatFromTokens(tokens: IToken[], options?: NQuadsFormatterOptions & TokenSerializerOptions): SerializationResult;
|
|
34
|
+
format(input: string, options?: NQuadsFormatterOptions): SerializationResult;
|
|
35
|
+
/**
|
|
36
|
+
* Formats tokens into a string.
|
|
37
|
+
*/
|
|
38
|
+
private formatTokens;
|
|
39
|
+
/**
|
|
40
|
+
* Gets merged options with defaults.
|
|
41
|
+
*/
|
|
42
|
+
private getOptions;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/nquads/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,YAAY,CAAC;AAGpD,OAAO,KAAK,EACR,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,SAAS,IAAI,aAAa,EAC7B,MAAM,aAAa,CAAC;AAIrB;;GAEG;AACH,MAAM,WAAW,sBAAuB,SAAQ,iBAAiB;IAC7D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,eAAgB,YAAW,aAAa;IACjD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAoB;IAClD,OAAO,CAAC,KAAK,CAAqB;IAElC;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,mBAAmB;IAYpF;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,sBAAsB,GAAG,mBAAmB;IAMlH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB,GAAG,mBAAmB;IAI5E;;OAEG;IACH,OAAO,CAAC,YAAY;IA0EpB;;OAEG;IACH,OAAO,CAAC,UAAU;CAOrB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { RdfToken, NQuadsLexer } from '@faubulous/mentor-rdf-parsers';
|
|
2
|
+
import { RdfSyntax } from '../types.js';
|
|
3
|
+
import { mergeOptions } from '../utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Formatter for N-Quads (line-based RDF dataset format).
|
|
6
|
+
*
|
|
7
|
+
* N-Quads extends N-Triples to support named graphs.
|
|
8
|
+
* Each line contains: subject predicate object [graph] .
|
|
9
|
+
*
|
|
10
|
+
* This formatter normalizes spacing and ensures proper line endings.
|
|
11
|
+
*
|
|
12
|
+
* @see https://www.w3.org/TR/rdf12-n-quads/
|
|
13
|
+
*/
|
|
14
|
+
export class NQuadsFormatter {
|
|
15
|
+
syntax = RdfSyntax.NQuads;
|
|
16
|
+
lexer = new NQuadsLexer();
|
|
17
|
+
/**
|
|
18
|
+
* Formats an N-Quads document.
|
|
19
|
+
*/
|
|
20
|
+
formatFromText(input, options) {
|
|
21
|
+
const opts = this.getOptions(options);
|
|
22
|
+
const result = this.lexer.tokenize(input);
|
|
23
|
+
if (result.errors.length > 0) {
|
|
24
|
+
return { output: input };
|
|
25
|
+
}
|
|
26
|
+
const comments = result.groups?.comments ?? [];
|
|
27
|
+
return this.formatTokens(result.tokens, opts, comments);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Formats from already-parsed tokens.
|
|
31
|
+
*/
|
|
32
|
+
formatFromTokens(tokens, options) {
|
|
33
|
+
const opts = this.getOptions(options);
|
|
34
|
+
return this.formatTokens(tokens, opts);
|
|
35
|
+
}
|
|
36
|
+
// Backwards-compatible alias
|
|
37
|
+
format(input, options) {
|
|
38
|
+
return this.formatFromText(input, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Formats tokens into a string.
|
|
42
|
+
*/
|
|
43
|
+
formatTokens(tokens, opts, comments = []) {
|
|
44
|
+
const parts = [];
|
|
45
|
+
const sortedComments = [...comments].sort((a, b) => (a.startOffset ?? 0) - (b.startOffset ?? 0));
|
|
46
|
+
let commentIndex = 0;
|
|
47
|
+
let needsSpace = false;
|
|
48
|
+
let lastNonWsToken = null;
|
|
49
|
+
for (const token of tokens) {
|
|
50
|
+
// Insert comments that appear before this token
|
|
51
|
+
while (commentIndex < sortedComments.length) {
|
|
52
|
+
const comment = sortedComments[commentIndex];
|
|
53
|
+
if ((comment.startOffset ?? 0) < (token.startOffset ?? 0)) {
|
|
54
|
+
if (parts.length > 0) {
|
|
55
|
+
parts.push(opts.lineEnd);
|
|
56
|
+
}
|
|
57
|
+
parts.push(comment.image);
|
|
58
|
+
parts.push(opts.lineEnd);
|
|
59
|
+
commentIndex++;
|
|
60
|
+
needsSpace = false;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Skip whitespace tokens
|
|
67
|
+
if (token.tokenType === RdfToken.WS) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
// Handle comment tokens in stream
|
|
71
|
+
if (token.tokenType === RdfToken.COMMENT) {
|
|
72
|
+
if (parts.length > 0 && lastNonWsToken?.tokenType !== RdfToken.PERIOD) {
|
|
73
|
+
parts.push(' ');
|
|
74
|
+
}
|
|
75
|
+
parts.push(token.image);
|
|
76
|
+
parts.push(opts.lineEnd);
|
|
77
|
+
needsSpace = false;
|
|
78
|
+
lastNonWsToken = token;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Handle period (end of quad)
|
|
82
|
+
if (token.tokenType === RdfToken.PERIOD) {
|
|
83
|
+
parts.push(' .');
|
|
84
|
+
parts.push(opts.lineEnd);
|
|
85
|
+
needsSpace = false;
|
|
86
|
+
lastNonWsToken = token;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// Add space before term tokens
|
|
90
|
+
if (needsSpace) {
|
|
91
|
+
parts.push(' ');
|
|
92
|
+
}
|
|
93
|
+
parts.push(token.image);
|
|
94
|
+
needsSpace = true;
|
|
95
|
+
lastNonWsToken = token;
|
|
96
|
+
}
|
|
97
|
+
// Add trailing comments
|
|
98
|
+
while (commentIndex < sortedComments.length) {
|
|
99
|
+
parts.push(sortedComments[commentIndex].image);
|
|
100
|
+
parts.push(opts.lineEnd);
|
|
101
|
+
commentIndex++;
|
|
102
|
+
}
|
|
103
|
+
return { output: parts.join('').trim() + (parts.length > 0 ? opts.lineEnd : '') };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Gets merged options with defaults.
|
|
107
|
+
*/
|
|
108
|
+
getOptions(options) {
|
|
109
|
+
const base = mergeOptions(options);
|
|
110
|
+
return {
|
|
111
|
+
...base,
|
|
112
|
+
normalizeWhitespace: options?.normalizeWhitespace ?? true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/nquads/formatter.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IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACtF,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,OAAgC;QAC/C,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO;YACH,GAAG,IAAI;YACP,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,IAAI,IAAI;SAC5D,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Quad } from '@rdfjs/types';
|
|
2
|
+
import type { Rdf12Quad, SerializerOptions, SerializationResult, RdfSyntax as RdfSyntaxType } from '../types.js';
|
|
3
|
+
import { BaseSerializer } from '../base-serializer.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serializer for N-Quads format (RDF 1.2 compatible).
|
|
6
|
+
*
|
|
7
|
+
* N-Quads extends N-Triples to support named graphs (datasets).
|
|
8
|
+
* Each line contains: subject predicate object [graph] .
|
|
9
|
+
*
|
|
10
|
+
* RDF 1.2 adds support for triple terms (quoted triples) as subjects or objects.
|
|
11
|
+
*
|
|
12
|
+
* @see https://www.w3.org/TR/rdf12-n-quads/
|
|
13
|
+
*/
|
|
14
|
+
export declare class NQuadsSerializer extends BaseSerializer {
|
|
15
|
+
readonly syntax: RdfSyntaxType;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Serializes a single quad to N-Quads format.
|
|
19
|
+
*
|
|
20
|
+
* @param quad The quad to serialize.
|
|
21
|
+
* @param options Serialization options.
|
|
22
|
+
* @returns The serialized N-Quad string.
|
|
23
|
+
*/
|
|
24
|
+
serializeQuad(quad: Quad | Rdf12Quad, options?: SerializerOptions): string;
|
|
25
|
+
/**
|
|
26
|
+
* Serializes multiple quads to N-Quads format.
|
|
27
|
+
*
|
|
28
|
+
* @param quads The quads to serialize.
|
|
29
|
+
* @param options Serialization options.
|
|
30
|
+
* @returns The serialized N-Quads string.
|
|
31
|
+
*/
|
|
32
|
+
serialize(quads: Iterable<Quad | Rdf12Quad>, options?: SerializerOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* Formats quads with detailed result information.
|
|
35
|
+
*/
|
|
36
|
+
format(quads: Iterable<Quad | Rdf12Quad>, options?: SerializerOptions): SerializationResult;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/nquads/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD;;;;;;;;;GASG;AACH,qBAAa,gBAAiB,SAAQ,cAAc;IAChD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAoB;;IAWlD;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAgB1E;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAejF;;OAEG;IACM,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,mBAAmB;CAKvG"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { RdfSyntax } from '../types.js';
|
|
2
|
+
import { BaseSerializer } from '../base-serializer.js';
|
|
3
|
+
import { sortQuads } from '../utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serializer for N-Quads format (RDF 1.2 compatible).
|
|
6
|
+
*
|
|
7
|
+
* N-Quads extends N-Triples to support named graphs (datasets).
|
|
8
|
+
* Each line contains: subject predicate object [graph] .
|
|
9
|
+
*
|
|
10
|
+
* RDF 1.2 adds support for triple terms (quoted triples) as subjects or objects.
|
|
11
|
+
*
|
|
12
|
+
* @see https://www.w3.org/TR/rdf12-n-quads/
|
|
13
|
+
*/
|
|
14
|
+
export class NQuadsSerializer extends BaseSerializer {
|
|
15
|
+
syntax = RdfSyntax.NQuads;
|
|
16
|
+
constructor() {
|
|
17
|
+
super();
|
|
18
|
+
// N-Quads does not support prefixes or shortcuts
|
|
19
|
+
this.supportsPrefixes = false;
|
|
20
|
+
this.supportsRdfTypeShorthand = false;
|
|
21
|
+
// N-Quads 1.2 supports triple terms
|
|
22
|
+
this.supportsRdf12 = true;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Serializes a single quad to N-Quads format.
|
|
26
|
+
*
|
|
27
|
+
* @param quad The quad to serialize.
|
|
28
|
+
* @param options Serialization options.
|
|
29
|
+
* @returns The serialized N-Quad string.
|
|
30
|
+
*/
|
|
31
|
+
serializeQuad(quad, options) {
|
|
32
|
+
const opts = this.getOptions(options);
|
|
33
|
+
const subject = this.serializeTerm(quad.subject, opts);
|
|
34
|
+
const predicate = this.serializeTerm(quad.predicate, opts);
|
|
35
|
+
const object = this.serializeTerm(quad.object, opts);
|
|
36
|
+
// Include graph if present and not default graph
|
|
37
|
+
if (quad.graph && quad.graph.termType !== 'DefaultGraph') {
|
|
38
|
+
const graph = this.serializeTerm(quad.graph, opts);
|
|
39
|
+
return `${subject} ${predicate} ${object} ${graph} .`;
|
|
40
|
+
}
|
|
41
|
+
return `${subject} ${predicate} ${object} .`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Serializes multiple quads to N-Quads format.
|
|
45
|
+
*
|
|
46
|
+
* @param quads The quads to serialize.
|
|
47
|
+
* @param options Serialization options.
|
|
48
|
+
* @returns The serialized N-Quads string.
|
|
49
|
+
*/
|
|
50
|
+
serialize(quads, options) {
|
|
51
|
+
const opts = this.getOptions(options);
|
|
52
|
+
const quadArray = Array.from(quads);
|
|
53
|
+
// Sort if requested
|
|
54
|
+
const sortedQuads = opts.sort ? sortQuads(quadArray) : quadArray;
|
|
55
|
+
const lines = [];
|
|
56
|
+
for (const quad of sortedQuads) {
|
|
57
|
+
lines.push(this.serializeQuad(quad, opts));
|
|
58
|
+
}
|
|
59
|
+
return lines.join(opts.lineEnd) + (lines.length > 0 ? opts.lineEnd : '');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Formats quads with detailed result information.
|
|
63
|
+
*/
|
|
64
|
+
format(quads, options) {
|
|
65
|
+
return {
|
|
66
|
+
output: this.serialize(quads, options)
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=serializer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.js","sourceRoot":"","sources":["../../src/nquads/serializer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC;;;;;;;;;GASG;AACH,MAAM,OAAO,gBAAiB,SAAQ,cAAc;IACvC,MAAM,GAAkB,SAAS,CAAC,MAAM,CAAC;IAElD;QACI,KAAK,EAAE,CAAC;QACR,iDAAiD;QACjD,IAAI,CAAC,gBAAgB,GAAG,KAAK,CAAC;QAC9B,IAAI,CAAC,wBAAwB,GAAG,KAAK,CAAC;QACtC,oCAAoC;QACpC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;IAC9B,CAAC;IAED;;;;;;OAMG;IACH,aAAa,CAAC,IAAsB,EAAE,OAA2B;QAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QAEtC,MAAM,OAAO,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,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;OAEG;IACM,MAAM,CAAC,KAAiC,EAAE,OAA2B;QAC1E,OAAO;YACH,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC;SACzC,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { IToken } from 'chevrotain';
|
|
2
|
+
import type { IRdfFormatter, SerializationResult, SerializerOptions, TokenSerializerOptions, RdfSyntax as RdfSyntaxType } from '../types.js';
|
|
3
|
+
/**
|
|
4
|
+
* N-Triples-specific formatting options.
|
|
5
|
+
*/
|
|
6
|
+
export interface NTriplesFormatterOptions extends SerializerOptions {
|
|
7
|
+
/**
|
|
8
|
+
* Whether to normalize whitespace to single spaces.
|
|
9
|
+
* Default: true
|
|
10
|
+
*/
|
|
11
|
+
normalizeWhitespace?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Formatter for N-Triples (line-based RDF format).
|
|
15
|
+
*
|
|
16
|
+
* N-Triples is a simple line-based format where each line contains
|
|
17
|
+
* exactly one triple: subject predicate object .
|
|
18
|
+
*
|
|
19
|
+
* This formatter normalizes spacing and ensures proper line endings.
|
|
20
|
+
*
|
|
21
|
+
* @see https://www.w3.org/TR/rdf12-n-triples/
|
|
22
|
+
*/
|
|
23
|
+
export declare class NTriplesFormatter implements IRdfFormatter {
|
|
24
|
+
readonly syntax: RdfSyntaxType;
|
|
25
|
+
private lexer;
|
|
26
|
+
/**
|
|
27
|
+
* Formats an N-Triples document.
|
|
28
|
+
*/
|
|
29
|
+
formatFromText(input: string, options?: NTriplesFormatterOptions): SerializationResult;
|
|
30
|
+
/**
|
|
31
|
+
* Formats from already-parsed tokens.
|
|
32
|
+
*/
|
|
33
|
+
formatFromTokens(tokens: IToken[], options?: NTriplesFormatterOptions & TokenSerializerOptions): SerializationResult;
|
|
34
|
+
format(input: string, options?: NTriplesFormatterOptions): SerializationResult;
|
|
35
|
+
/**
|
|
36
|
+
* Formats tokens into a string.
|
|
37
|
+
*/
|
|
38
|
+
private formatTokens;
|
|
39
|
+
/**
|
|
40
|
+
* Gets merged options with defaults.
|
|
41
|
+
*/
|
|
42
|
+
private getOptions;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=formatter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.d.ts","sourceRoot":"","sources":["../../src/ntriples/formatter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,YAAY,CAAC;AAGpD,OAAO,KAAK,EACR,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,SAAS,IAAI,aAAa,EAC7B,MAAM,aAAa,CAAC;AAIrB;;GAEG;AACH,MAAM,WAAW,wBAAyB,SAAQ,iBAAiB;IAC/D;;;OAGG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,YAAW,aAAa;IACnD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAsB;IACpD,OAAO,CAAC,KAAK,CAAuB;IAEpC;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,mBAAmB;IAYtF;;OAEG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,sBAAsB,GAAG,mBAAmB;IAMpH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB,GAAG,mBAAmB;IAI9E;;OAEG;IACH,OAAO,CAAC,YAAY;IA0EpB;;OAEG;IACH,OAAO,CAAC,UAAU;CAOrB"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { RdfToken, NTriplesLexer } from '@faubulous/mentor-rdf-parsers';
|
|
2
|
+
import { RdfSyntax } from '../types.js';
|
|
3
|
+
import { mergeOptions } from '../utils.js';
|
|
4
|
+
/**
|
|
5
|
+
* Formatter for N-Triples (line-based RDF format).
|
|
6
|
+
*
|
|
7
|
+
* N-Triples is a simple line-based format where each line contains
|
|
8
|
+
* exactly one triple: subject predicate object .
|
|
9
|
+
*
|
|
10
|
+
* This formatter normalizes spacing and ensures proper line endings.
|
|
11
|
+
*
|
|
12
|
+
* @see https://www.w3.org/TR/rdf12-n-triples/
|
|
13
|
+
*/
|
|
14
|
+
export class NTriplesFormatter {
|
|
15
|
+
syntax = RdfSyntax.NTriples;
|
|
16
|
+
lexer = new NTriplesLexer();
|
|
17
|
+
/**
|
|
18
|
+
* Formats an N-Triples document.
|
|
19
|
+
*/
|
|
20
|
+
formatFromText(input, options) {
|
|
21
|
+
const opts = this.getOptions(options);
|
|
22
|
+
const result = this.lexer.tokenize(input);
|
|
23
|
+
if (result.errors.length > 0) {
|
|
24
|
+
return { output: input };
|
|
25
|
+
}
|
|
26
|
+
const comments = result.groups?.comments ?? [];
|
|
27
|
+
return this.formatTokens(result.tokens, opts, comments);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Formats from already-parsed tokens.
|
|
31
|
+
*/
|
|
32
|
+
formatFromTokens(tokens, options) {
|
|
33
|
+
const opts = this.getOptions(options);
|
|
34
|
+
return this.formatTokens(tokens, opts);
|
|
35
|
+
}
|
|
36
|
+
// Backwards-compatible alias
|
|
37
|
+
format(input, options) {
|
|
38
|
+
return this.formatFromText(input, options);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Formats tokens into a string.
|
|
42
|
+
*/
|
|
43
|
+
formatTokens(tokens, opts, comments = []) {
|
|
44
|
+
const parts = [];
|
|
45
|
+
const sortedComments = [...comments].sort((a, b) => (a.startOffset ?? 0) - (b.startOffset ?? 0));
|
|
46
|
+
let commentIndex = 0;
|
|
47
|
+
let needsSpace = false;
|
|
48
|
+
let lastNonWsToken = null;
|
|
49
|
+
for (const token of tokens) {
|
|
50
|
+
// Insert comments that appear before this token
|
|
51
|
+
while (commentIndex < sortedComments.length) {
|
|
52
|
+
const comment = sortedComments[commentIndex];
|
|
53
|
+
if ((comment.startOffset ?? 0) < (token.startOffset ?? 0)) {
|
|
54
|
+
if (parts.length > 0) {
|
|
55
|
+
parts.push(opts.lineEnd);
|
|
56
|
+
}
|
|
57
|
+
parts.push(comment.image);
|
|
58
|
+
parts.push(opts.lineEnd);
|
|
59
|
+
commentIndex++;
|
|
60
|
+
needsSpace = false;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
// Skip whitespace tokens
|
|
67
|
+
if (token.tokenType === RdfToken.WS) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
// Handle comment tokens in stream
|
|
71
|
+
if (token.tokenType === RdfToken.COMMENT) {
|
|
72
|
+
if (parts.length > 0 && lastNonWsToken?.tokenType !== RdfToken.PERIOD) {
|
|
73
|
+
parts.push(' ');
|
|
74
|
+
}
|
|
75
|
+
parts.push(token.image);
|
|
76
|
+
parts.push(opts.lineEnd);
|
|
77
|
+
needsSpace = false;
|
|
78
|
+
lastNonWsToken = token;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
// Handle period (end of triple)
|
|
82
|
+
if (token.tokenType === RdfToken.PERIOD) {
|
|
83
|
+
parts.push(' .');
|
|
84
|
+
parts.push(opts.lineEnd);
|
|
85
|
+
needsSpace = false;
|
|
86
|
+
lastNonWsToken = token;
|
|
87
|
+
continue;
|
|
88
|
+
}
|
|
89
|
+
// Add space before term tokens
|
|
90
|
+
if (needsSpace) {
|
|
91
|
+
parts.push(' ');
|
|
92
|
+
}
|
|
93
|
+
parts.push(token.image);
|
|
94
|
+
needsSpace = true;
|
|
95
|
+
lastNonWsToken = token;
|
|
96
|
+
}
|
|
97
|
+
// Add trailing comments
|
|
98
|
+
while (commentIndex < sortedComments.length) {
|
|
99
|
+
parts.push(sortedComments[commentIndex].image);
|
|
100
|
+
parts.push(opts.lineEnd);
|
|
101
|
+
commentIndex++;
|
|
102
|
+
}
|
|
103
|
+
return { output: parts.join('').trim() + (parts.length > 0 ? opts.lineEnd : '') };
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Gets merged options with defaults.
|
|
107
|
+
*/
|
|
108
|
+
getOptions(options) {
|
|
109
|
+
const base = mergeOptions(options);
|
|
110
|
+
return {
|
|
111
|
+
...base,
|
|
112
|
+
normalizeWhitespace: options?.normalizeWhitespace ?? true,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=formatter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatter.js","sourceRoot":"","sources":["../../src/ntriples/formatter.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAQxE,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAa3C;;;;;;;;;GASG;AACH,MAAM,OAAO,iBAAiB;IACjB,MAAM,GAAkB,SAAS,CAAC,QAAQ,CAAC;IAC5C,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;IAEpC;;OAEG;IACH,cAAc,CAAC,KAAa,EAAE,OAAkC;QAC5D,MAAM,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;QAE1C,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3B,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;QAC7B,CAAC;QAED,MAAM,QAAQ,GAAI,MAAM,CAAC,MAAM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,CAAC,GAAG,CAAC,CAAC;YACpB,CAAC;YAED,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACxB,UAAU,GAAG,IAAI,CAAC;YAClB,cAAc,GAAG,KAAK,CAAC;QAC3B,CAAC;QAED,wBAAwB;QACxB,OAAO,YAAY,GAAG,cAAc,CAAC,MAAM,EAAE,CAAC;YAC1C,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC;YAC/C,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACzB,YAAY,EAAE,CAAC;QACnB,CAAC;QAED,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACtF,CAAC;IAED;;OAEG;IACK,UAAU,CAAC,OAAkC;QACjD,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO;YACH,GAAG,IAAI;YACP,mBAAmB,EAAE,OAAO,EAAE,mBAAmB,IAAI,IAAI;SAC5D,CAAC;IACN,CAAC;CACJ"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Quad } from '@rdfjs/types';
|
|
2
|
+
import type { Rdf12Quad, SerializerOptions, SerializationResult, RdfSyntax as RdfSyntaxType } from '../types.js';
|
|
3
|
+
import { BaseSerializer } from '../base-serializer.js';
|
|
4
|
+
/**
|
|
5
|
+
* Serializer for N-Triples format (RDF 1.2 compatible).
|
|
6
|
+
*
|
|
7
|
+
* N-Triples is a line-based, plain text format for encoding RDF graphs.
|
|
8
|
+
* Each line contains a single triple: subject predicate object .
|
|
9
|
+
*
|
|
10
|
+
* RDF 1.2 adds support for triple terms (quoted triples) as subjects or objects.
|
|
11
|
+
*
|
|
12
|
+
* @see https://www.w3.org/TR/rdf12-n-triples/
|
|
13
|
+
*/
|
|
14
|
+
export declare class NTriplesSerializer extends BaseSerializer {
|
|
15
|
+
readonly syntax: RdfSyntaxType;
|
|
16
|
+
constructor();
|
|
17
|
+
/**
|
|
18
|
+
* Serializes a single quad/triple to N-Triples format.
|
|
19
|
+
*
|
|
20
|
+
* @param quad The quad to serialize.
|
|
21
|
+
* @param options Serialization options.
|
|
22
|
+
* @returns The serialized N-Triple string.
|
|
23
|
+
*/
|
|
24
|
+
serializeQuad(quad: Quad | Rdf12Quad, options?: SerializerOptions): string;
|
|
25
|
+
/**
|
|
26
|
+
* Serializes multiple quads/triples to N-Triples format.
|
|
27
|
+
*
|
|
28
|
+
* @param quads The quads to serialize.
|
|
29
|
+
* @param options Serialization options.
|
|
30
|
+
* @returns The serialized N-Triples string.
|
|
31
|
+
*/
|
|
32
|
+
serialize(quads: Iterable<Quad | Rdf12Quad>, options?: SerializerOptions): string;
|
|
33
|
+
/**
|
|
34
|
+
* Formats quads with detailed result information.
|
|
35
|
+
*/
|
|
36
|
+
format(quads: Iterable<Quad | Rdf12Quad>, options?: SerializerOptions): SerializationResult;
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=serializer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serializer.d.ts","sourceRoot":"","sources":["../../src/ntriples/serializer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAGvD;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,SAAQ,cAAc;IAClD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAsB;;IAWpD;;;;;;OAMG;IACH,aAAa,CAAC,IAAI,EAAE,IAAI,GAAG,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAU1E;;;;;;OAMG;IACH,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,MAAM;IAmBjF;;OAEG;IACM,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,mBAAmB;CAiBvG"}
|