integrations.readNTriplesfunctionno test imports itfunction readNTriples(text: string): Result<Read, readonly IntegrationFinding[]>N-Triples' text as triples: the same reader, which takes N-Triples as the Turtle it is a subset of.
A reader of Turtle and N-Triples, the first importer's input (commons 0019-mizan-integrations FR-004, FR-007): the text of an outside ontology as triples, with what the typed form cannot hold named as findings and never dropped silently. It lives here and not in the kernel, which reads no RDF syntax (0012-ontology FR-007).
It reads @prefix and @base (and the SPARQL forms PREFIX and BASE), IRIs, prefixed names, a, ; and , lists, plain, language and datatyped literals (short and long strings, with the usual escapes), numbers and booleans, blank node labels and comments. A bracketed blank node ([ ... ]) or a collection (( ... )) is skipped with a loss finding that names the line, and everything else is still read. A syntax it does not understand ends the read with a syntax finding and its line.
import { readTurtle } from "./read-rdf.ts";
const r = readTurtle('@prefix ex: <https://example.org/> .\nex:a a ex:B ; ex:n 3 .\n');
r.kind === "ok" && r.value.triples.length; // 2integrations.readNTriplesfunctionno test imports itfunction readNTriples(text: string): Result<Read, readonly IntegrationFinding[]>N-Triples' text as triples: the same reader, which takes N-Triples as the Turtle it is a subset of.
integrations.readTurtlefunctionno test imports itfunction readTurtle(text: string): Result<Read, readonly IntegrationFinding[]>Turtle's text as triples, with the findings of what the typed form cannot hold; a syntax it does not understand ends the read with one syntax finding.
integrations.Readtypeno test imports ittype Read = { readonly triples: readonly RdfTriple[]; readonly findings: readonly IntegrationFinding[] };What a read gives: the triples, and what the typed form cannot hold.
integrations.RdfTermtypeno test imports ittype RdfTerm =
| { readonly kind: "iri"; readonly value: string }
| { readonly kind: "blank"; readonly label: string }
| { readonly kind: "literal"; readonly value: string; readonly datatype: string; readonly lang?: string };A term of a triple as the reader gives it: an IRI, a blank node label, or a literal with its datatype and language.
integrations.RdfTripletypeno test imports ittype RdfTriple = { readonly subject: RdfTerm; readonly predicate: string; readonly object: RdfTerm; readonly line: number };A triple and the line it starts on.
integrations.tripleKeyfunctionno test imports itfunction tripleKey(t: RdfTriple): stringA triple as one N-Triples line, in one form whatever the syntax it was read from: a set of these is a graph, comparable with another.
integrations.TYPEconstno test imports itconst TYPE: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"rdf:type, which a stands for.
readNTriplesfunctionfunction readNTriples(text: string): Result<Read, readonly IntegrationFinding[]>N-Triples' text as triples: the same reader, which takes N-Triples as the Turtle it is a subset of.
readTurtlefunctionfunction readTurtle(text: string): Result<Read, readonly IntegrationFinding[]>Turtle's text as triples, with the findings of what the typed form cannot hold; a syntax it does not understand ends the read with one syntax finding.
Readtypeno test imports ittype Read = { readonly triples: readonly RdfTriple[]; readonly findings: readonly IntegrationFinding[] };What a read gives: the triples, and what the typed form cannot hold.
RdfTermtypeno test imports ittype RdfTerm =
| { readonly kind: "iri"; readonly value: string }
| { readonly kind: "blank"; readonly label: string }
| { readonly kind: "literal"; readonly value: string; readonly datatype: string; readonly lang?: string };A term of a triple as the reader gives it: an IRI, a blank node label, or a literal with its datatype and language.
RdfTripletypetype RdfTriple = { readonly subject: RdfTerm; readonly predicate: string; readonly object: RdfTerm; readonly line: number };A triple and the line it starts on.
tripleKeyfunctionfunction tripleKey(t: RdfTriple): stringA triple as one N-Triples line, in one form whatever the syntax it was read from: a set of these is a graph, comparable with another.
TYPEconstno test imports itconst TYPE: "http://www.w3.org/1999/02/22-rdf-syntax-ns#type"rdf:type, which a stands for.